Repository navigation
fix(annotations): allow hyphens in annotation names - #3441
Closed
yunaremaia wants to merge 3 commits into
Closed
yunaremaia wants to merge 3 commits into
yunaremaia wants to merge 3 commits into
Conversation
Widens the validation pattern for Annotation.name from ^[\w]+$ to ^[\w-]+$ so that hyphenated names like 'my-annotation' are accepted. Regenerates protobuf code (Go), TypeScript definitions, and JSON Schema files from the updated proto. Fixes chainloop-dev#3405 Signed-off-by: Yunare Maia <yunare@gmail.com>
CI generates with v1.36.11; sync committed generated files to match.
Assisted-by: Hermes Agent Signed-off-by: Yunare Maia <yunare@gmail.com>
Contributor
Security Checks —
|
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
⚠️ iac-scan — 1 failing
| Status | Policy | Messages |
|---|---|---|
iac-misconfiguration |
Ensure that arrays have a maximum number of items in "app/controlplane/api/gen/temp-openapi/apidocs.swagger.json" (error) |
PR info
| Status | Policy | Messages |
|---|---|---|
pr-min-approvals |
PR/MR #3441 has 0 approving reviews, 1 required. | |
| ✅ Passed | pr-description-required |
- |
| ✅ Passed | pr-user-story-linked |
- |
⏭️ 2 scans not applied
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
Powered by Chainloop and Chainloop Trace
Contributor
There was a problem hiding this comment.
1 issue found across 33 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/controlplane/api/workflowcontract/v1/crafting_schema.proto">
<violation number="1" location="app/controlplane/api/workflowcontract/v1/crafting_schema.proto:249">
P2: The new pattern ^[\w-]+$ accepts names made only of hyphens ("-", "--"), and names with leading, trailing, or consecutive hyphens ("-foo", "foo-", "foo--bar"), which contradicts the comment's stated intent of words optionally separated by _ or -. Restrict hyphens to separators between word characters.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // function syntax in Go template consumers like Dependency-Track: | ||
| // {{ index .Material.Annotations "my-annotation" }} | ||
| // rather than direct field access {{ .Material.Annotations.my-annotation }}. | ||
| string name = 1 [(buf.validate.field).string.pattern = "^[\\w-]+$"]; |
Contributor
There was a problem hiding this comment.
P2: The new pattern ^[\w-]+$ accepts names made only of hyphens ("-", "--"), and names with leading, trailing, or consecutive hyphens ("-foo", "foo-", "foo--bar"), which contradicts the comment's stated intent of words optionally separated by _ or -. Restrict hyphens to separators between word characters.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/controlplane/api/workflowcontract/v1/crafting_schema.proto, line 249:
<comment>The new pattern ^[\w-]+$ accepts names made only of hyphens ("-", "--"), and names with leading, trailing, or consecutive hyphens ("-foo", "foo-", "foo--bar"), which contradicts the comment's stated intent of words optionally separated by _ or -. Restrict hyphens to separators between word characters.</comment>
<file context>
@@ -241,7 +241,12 @@ message CraftingSchemaV2Spec {
+ // function syntax in Go template consumers like Dependency-Track:
+ // {{ index .Material.Annotations "my-annotation" }}
+ // rather than direct field access {{ .Material.Annotations.my-annotation }}.
+ string name = 1 [(buf.validate.field).string.pattern = "^[\\w-]+$"];
// This value can be set in the contract or provided during the attestation
string value = 2;
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Context
Fixes #3405 — annotation names with hyphens were rejected by validation.
Test plan
Notes
Regenerates 33 files (mostly auto-generated protobuf artifacts). The source change is a 1-line regex widen in the proto definition + documentation.