Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error parsing some custom metadata annotation #1082

Closed
anderseknert opened this issue Sep 9, 2024 · 1 comment · Fixed by #1087
Closed

Error parsing some custom metadata annotation #1082

anderseknert opened this issue Sep 9, 2024 · 1 comment · Fixed by #1087
Labels
bug Something isn't working

Comments

@anderseknert
Copy link
Member

@garethahealy reported that Regal v0.26.1 fails to process policies with some particular custom metadata annotations.

Example:

p.rego

# METADATA
# custom:
#   matchers:
#     kinds:
#     - apiGroups:
#       - osb.openshift.io
#       kinds:
#       - AutomationBroker
#       - TemplateServiceBroker
#   skipConstraint: true
package ocp.deprecated.ocp4_2.osb_v1
regal lint p.rego
error(s) encountered while linting: failed to lint using Rego rules: error encountered in rule evaluation failed preparing AST: JSON rountrip failed for module: ReadMapCB: object not ended with }, error found in #10 byte of ...|":null}]}"skipConstr|..., bigger context ...|ustom":{"matchers":{"kinds":[{"apiGroups":null}]}"skipConstraint":true}}],"comments":[{"location":"1|...

OPA doesn't seem to have any issues with the same file.

@anderseknert
Copy link
Member Author

anderseknert commented Sep 9, 2024

This bug is in the new roast JSON encoder, where multiple key/value-pairs in the custom object wasn't properly separated by commas. It thought we had got a fairly good coverage just by serializing all 200+ Rego files in the Regal repo... but it turns out we never have 2+ custom attributes in any metadata here 🤦

Fixed in StyraInc/roast#3 ... as soon as that's merged, I'll push a new tag and will bump the dependency for v0.26.2

anderseknert added a commit that referenced this issue Sep 9, 2024
This also ups the OPA version used by roast to v0.68.0, aligned
with Regal.

Fixes #1082

Signed-off-by: Anders Eknert <anders@styra.com>
srenatus pushed a commit to srenatus/regal that referenced this issue Oct 1, 2024
…c#1087)

This also ups the OPA version used by roast to v0.68.0, aligned
with Regal.

Fixes StyraInc#1082

Signed-off-by: Anders Eknert <anders@styra.com>
charlieegan3 pushed a commit to charlieegan3/regal that referenced this issue Jan 6, 2025
…c#1087)

This also ups the OPA version used by roast to v0.68.0, aligned
with Regal.

Fixes StyraInc#1082

Signed-off-by: Anders Eknert <anders@styra.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant