oracle / oracle/macaron

Incorrect invocation.configSource.uri value for inferred provenance value.

Open
#578 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug report user_experience
Dominant language
Python
Stars
210
Forks
36
Avg merge
1d 10h
Merged PRs (30d)
2

Description

How to replicate

Run this command:

macaron analyze -rp https://github.com/ben-manes/caffeine.git --skip-deps

Because this repository doesn't have a provenance that Macaron can detect, Macaron put an inferred provenance in the final JSON report.
The content of the JSON report of this analysis is as follow:

...
                             "invocation": {
                                "configSource": {
                                    "uri": "https://github.com/ben-manes/caffeine@refs/heads/None",
...

Description

The logic for generating the content of invocation.configSource.uri for the inferred provenance is located here:

predicate["invocation"]["configSource"]["uri"] = (
    f"{ctx.component.repository.remote_path}"
    f"@refs/heads/{ctx.component.repository.branch_name}"
)

In scenarios where the branch name is not available, the content of this uri will be incorrect

Suggestion

If the branch name is not available for this software component, we can use f"{ctx.component.repository.remote_path}" only without f"@refs/heads/{ctx.component.repository.branch_name}"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/macaron/slsa_analyzer/checks/build_as_code_check.py around the inferred provenance logic, then run the documented macaron analyze command against the caffeine repository. Check the generated invocation.configSource.uri when branch_name is unavailable; done means it no longer includes the literal None suffix while retaining the repository remote path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.