8000 Fix publication attestation policy evaluation by Mnehmos · Pull Request #26 · Mnehmos/MathOS · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions scripts/publication-attestation-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,21 @@ report_content_hash="$(jq -cS . "$report" | tr -d '\n' | sha256sum | cut -d ' '
bundle_hash="$(sha256sum "$bundle" | cut -d ' ' -f 1)"
raw_hash="$(sha256sum "$raw_verification" | cut -d ' ' -f 1)"

jq -e --arg report_hash "$report_hash" --arg predicate_type "$predicate_type" '
if ! jq -e --arg report_hash "$report_hash" --arg predicate_type "$predicate_type" '
type == "array" and length > 0 and
all(.[].verificationResult.statement.predicateType == $predicate_type) and
any(.[].verificationResult.statement.subject[]?; .digest.sha256 == $report_hash) and
all(.[].verificationResult.verifiedTimestamps | type == "array" and length > 0)
' "$raw_verification" >/dev/null
all(.[];
.verificationResult.statement.predicateType == $predicate_type
) and
any(.[].verificationResult.statement.subject[]?;
.digest.sha256 == $report_hash
) and
all(.[];
(.verificationResult.verifiedTimestamps | type == "array" and length > 0)
)
' "$raw_verification" >/dev/null; then
printf 'publication attestation policy rejected verified output\n' >&2
exit 71
fi

attestation_count="$(jq 'length' "$raw_verification")"
timestamp_count="$(jq '[.[].verificationResult.verifiedTimestamps | length] | add' "$raw_verification")"
Expand Down
Loading
0