Skip to content

Compare the blob policy verification level as a string - #593

Open
arpitjain099 wants to merge 1 commit into
notaryproject:mainfrom
arpitjain099:fix/global-blob-policy-skip-guard
Open

arpitjain099 wants to merge 1 commit into
notaryproject:mainfrom
arpitjain099:fix/global-blob-policy-skip-guard

Conversation

@arpitjain099

Copy link
Copy Markdown

BlobDocument.Validate means to forbid a global blob policy from skipping verification, but the comparison cannot fire. SignatureVerification.VerificationLevel is a string holding the level name, while LevelSkip is a *VerificationLevel, so reflect.DeepEqual is handed two different types and is always false.

The sibling in verifier.go:253 runs the same idiom correctly, because there verificationLevel really is a *VerificationLevel returned by GetVerificationLevel. Only the blob document path compares the raw string.

There is no second gate behind it. validatePolicyCore rejects skip when trust stores or trusted identities are set, but permits it when they are absent, which is the shape that reaches this check. So a blob policy document with globalPolicy: true and level: skip validates cleanly today and ends up with every enforcement field set to skip.

Comparing against LevelSkip.Name is what the field holds, and reflect was imported only for this line so it goes too.

The new case fails on main with got <nil> from Validate, and passes here. I added the non-global case beside it, since a statement that is not the global policy is still allowed to use skip and should stay that way. The repo is green, zero failures across all packages.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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