Skip to content

Read all certificates in a notation PEM bundle - #2247

Open
Adham-Kiwan wants to merge 1 commit into
fluxcd:mainfrom
Adham-Kiwan:fix/notation-pem-bundle
Open

Adham-Kiwan wants to merge 1 commit into
fluxcd:mainfrom
Adham-Kiwan:fix/notation-pem-bundle

Conversation

@Adham-Kiwan

Copy link
Copy Markdown

The notation trust store called pem.Decode once per entry and ignored the rest of the data. If a Secret key held a bundle with several certificates, every certificate after the first was dropped, so signatures chaining to a later CA failed verification.

All PEM blocks in each entry are now parsed. Raw DER input is handled as before. A bundle with an invalid later block now returns an error instead of silently ignoring it.

This addresses the first problem in #2246. The second one (storeType and namedStore being ignored) needs a design decision, so I left it out.

Testing

Added TestTrustStoreGetCertificates. I did not run the full make test locally; these ran in a GitHub Actions run on my fork:

  • go test -race ./internal/oci/notation/ passes with the fix.
  • With the old notation.go, the new test fails.
  • gofmt and go vet pass. golangci-lint reported one errcheck finding in notation_test.go, a file this PR does not change.

AI disclosure: written with Claude Code, as noted in the Assisted-by commit trailer.

Relates to #2246

🤖 Generated with Claude Code

The notation trust store decoded only the first PEM block of each entry
and silently dropped the rest, so signatures chaining to a later CA in a
bundle failed verification.

Assisted-by: claude-code/claude-sonnet-5-5
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
@Adham-Kiwan
Adham-Kiwan force-pushed the fix/notation-pem-bundle branch from 69fad74 to 83f503e Compare November 26, 2026 18:28
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.

1 participant