Skip to content

fix: support all base64 variants in DSSE decoding and normalize type filter#4

Open
Sandipmandal25 wants to merge 1 commit intoSBOMit:masterfrom
Sandipmandal25:fix/dsse-base64-and-type-filter
Open

fix: support all base64 variants in DSSE decoding and normalize type filter#4
Sandipmandal25 wants to merge 1 commit intoSBOMit:masterfrom
Sandipmandal25:fix/dsse-base64-and-type-filter

Conversation

@Sandipmandal25
Copy link
Copy Markdown

@Sandipmandal25 Sandipmandal25 commented Mar 31, 2026

Description

decodeBase64Any previously only used base64.StdEncoding. However, the DSSE spec (https://github.com/secure-systems-lab/dsse) encodes payloads using base64url without padding (RawURLEncoding). As a result, real witness run attestations failed to parse with an illegal base64 data error.

Additionally, ExtractAll stored raw type filter strings without normalization. This caused all files to be silently dropped when --types was passed as values like Command-Run or COMMAND-RUN, even though the parser layer already normalizes these values.

fixes #5

Changes Made

  • Fixed parser.go:

    • decodeBase64Any now attempts all four base64 variants in order:
      RawURLEncoding → URLEncoding → StdEncoding → RawStdEncoding
  • Fixed extractor.go:

    • Normalize type filter entries using:
      strings.ToLower(strings.TrimSpace(t))
    • Ensures consistency with extractAttestations
  • Added tests:

    • parser_test.go to validate base64 decoding across variants
    • extractor_test.go to verify type normalization behavior

Testing

Before:

image

After:

image

@Sandipmandal25 Sandipmandal25 force-pushed the fix/dsse-base64-and-type-filter branch 3 times, most recently from 6434704 to 37b409b Compare March 31, 2026 08:02
Comment thread pkg/attestation/parser.go Outdated
…filter

Signed-off-by: Sandipmandal25 <sandipmandal02.sm@gmail.com>
@Sandipmandal25 Sandipmandal25 force-pushed the fix/dsse-base64-and-type-filter branch from 37b409b to 011c3ac Compare April 2, 2026 09:22
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.

bug: DSSE payloads fail to parse and type filter silently drops attestations

2 participants