Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce a manifest with a non-zero config #270

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

cbandy
Copy link
Contributor

@cbandy cbandy commented Oct 9, 2024

I could not copy trivy-checks into Harbor today because Harbor does not understand a "size":0 manifest config.

The OCI image spec calls out this case and recommends sending an empty JSON object instead: https://github.com/opencontainers/image-spec/blob/v1.1.0/manifest.md#guidance-for-an-empty-descriptor

ORAS knows what to do with these things, so this change uses it the same way as trivy-db: https://github.com/aquasecurity/trivy-db/blob/32c63a9af03ffd449a6ffb4471745b6ec9714875/.github/workflows/cron.yml#L73

            ./oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json \

Here's a discussion about the OPA bundle format showing similar: open-policy-agent/opa#1413 (comment)

  "config": {
    "mediaType": "application/vnd.cncf.openpolicyagent.config.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2
  },

@cbandy cbandy requested a review from simar7 as a code owner October 9, 2024 16:19
@CLAassistant
Copy link

CLAassistant commented Oct 9, 2024

CLA assistant check
All committers have signed the CLA.

@simar7
Copy link
Member

simar7 commented Oct 10, 2024

@cbandy thanks for the catch, it lgtm!

simar7
simar7 previously approved these changes Oct 10, 2024
@simar7
Copy link
Member

simar7 commented Oct 10, 2024

One small note, we can also add this to our testing here:

var OrasPush = []string{"--config", "/dev/null:application/vnd.cncf.openpolicyagent.config.v1+json", fmt.Sprintf("%s:application/vnd.cncf.openpolicyagent.layer.v1.tar+gzip", bundlePath)}

Some OCI registry implementations do not know how to handle completely
empty manifest config. ORAS knows what to do in this case.

See: https://github.com/opencontainers/image-spec/blob/v1.1.0/manifest.md#guidance-for-an-empty-descriptor
@cbandy
Copy link
Contributor Author

cbandy commented Oct 10, 2024

Thank you for the quick response! Amended and rebased.

📝 I was not able to run that test locally.

@cbandy
Copy link
Contributor Author

cbandy commented Oct 10, 2024

For reference, here's the issue I opened with Harbor: goharbor/harbor#21018

@simar7 simar7 enabled auto-merge October 11, 2024 04:42
@simar7 simar7 self-requested a review October 11, 2024 04:42
@simar7 simar7 added this pull request to the merge queue Oct 11, 2024
Merged via the queue into aquasecurity:main with commit c00f263 Oct 11, 2024
5 checks passed
@cbandy cbandy deleted the compatible-config branch October 11, 2024 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants