Skip to content
Open
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
3 changes: 3 additions & 0 deletions infra/opa/policies/retail/retail_api/accounts.rego
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# METADATA
# title: Accounts
# field: other
Comment on lines +1 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What are the valid metadata annotation attributes in Open Policy Agent (OPA)?

💡 Result:

In OPA Rego metadata annotations (# METADATA YAML blocks), the built-in/valid top-level attributes are: scope, title, description, related_resources, authors, organizations, schemas, entrypoint, and custom. [1]

scope valid values: rule, document, package, subpackages. [1]

[1] (openpolicyagent.org)

Citations:


Remove invalid metadata attribute field.

The field attribute is not a valid OPA metadata annotation attribute. According to OPA documentation, valid top-level metadata attributes are: scope, title, description, related_resources, authors, organizations, schemas, entrypoint, and custom.

Use the custom attribute if you need to include custom metadata:

Suggested fix
 # METADATA
 # title: Accounts
-# field: other
+# custom:
+#   field: other

Alternatively, remove line 3 if this metadata is not needed.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# METADATA
# title: Accounts
# field: other
# METADATA
# title: Accounts
# custom:
# field: other
🧰 Tools
🪛 Regal (0.39.0)

[error] 3-3: Invalid attribute in metadata annotation

(bugs)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@infra/opa/policies/retail/retail_api/accounts.rego` around lines 1 - 3, The
metadata block in the policy contains an invalid top-level attribute `field`;
update the metadata in accounts.rego to remove the `field` attribute or move its
value under a valid top-level key such as `custom` (e.g., replace `field: other`
with `custom: {"field": "other"}`) so the policy metadata uses only valid OPA
attributes like `title` and `custom`.

package retail.retail_api.accounts

import rego.v1
Expand Down
Loading