Skip to content

Parse policy materials written in HJSON - #28

Merged
miniprow[bot] merged 1 commit into
mainfrom
nromalize-preds
Sep 14, 2026
Merged

miniprow[bot] merged 1 commit into
mainfrom
nromalize-preds

Conversation

@puerco

@puerco puerco commented Sep 14, 2026

Copy link
Copy Markdown
Member

The policy, policy set and policy group parsers fed raw bytes to protojson, so policies authored in HJSON (comments, unquoted keys, multiline strings) failed as unparseable when read through the attestation collector, even though the policy module itself accepts both formats.

Normalize input to JSON before unmarshaling: valid JSON is untouched, HJSON is converted, and anything else is reported as not this format so other predicate parsers get their turn. On the HJSON path an empty or non-object document is rejected, since HJSON's braceless root would otherwise turn empty input into an empty policy.

The policy, policy set and policy group parsers fed raw bytes to
protojson, so policies authored in HJSON (comments, unquoted keys,
multiline strings) failed as unparseable when read through the
attestation collector, even though the policy module itself accepts
both formats.

Normalize input to JSON before unmarshaling: valid JSON is untouched,
HJSON is converted, and anything else is reported as not this format
so other predicate parsers get their turn. On the HJSON path an empty
or non-object document is rejected, since HJSON's braceless root would
otherwise turn empty input into an empty policy.

Signed-off-by: Adolfo Garc铆a Veytia (Puerco) <adolfo.garcia@uservers.net>
@miniprow miniprow Bot added lgtm Indicates that a PR is ready to be merged (Looks Good To Me) approved Indicates a PR has been approved by an approver from all required OWNERS files labels Sep 14, 2026
@miniprow

miniprow Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: puerco

The full list of commands accepted by this bot can be found here.

Details Approved by a repository administrator.

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@miniprow
miniprow Bot merged commit fec2bb0 into main Sep 14, 2026
5 checks passed
@puerco
puerco deleted the nromalize-preds branch September 14, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files lgtm Indicates that a PR is ready to be merged (Looks Good To Me)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant