fix(annotations): allow hyphens in annotation names - #3406
Conversation
Security Checks — ✅ 9 passing✅
|
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | cwe-top26-40-cusp |
- |
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
✅ iac-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | iac-misconfiguration |
- |
PR info
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | pr-min-approvals |
- |
| ✅ 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
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Nice work. I was working on #3405 too and noticed one downstream case that may be worth testing. Dependency-Track uses annotation keys for filtering and interpolation. Hyphenated keys work for exact filters and templates can access them with: Since the issue mentions confirming that path, a small test there could be useful. |
|
Thanks @cubic-dev-ai for the review. Valid concern about hyphenated keys in Go template field access. I'll address this by adding documentation to the proto comment noting that hyphenated annotation names require the |
@yunaremaia Agreed, that's the right call. Widen the pattern in the schema is correct — the restriction was never deliberate, and it keeps annotation names consistent with contract/material names. Hyphenated keys only break down at template interpolation time, so a comment flagging One small thing worth keeping in mind as you write it: since the proto comment in Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
|
Thanks @yunaremaia for the contribution, could you please sign the commit and perform a sign-off too, thanks!
https://github.com/chainloop-dev/chainloop/blob/main/CONTRIBUTING.md#commit-format |
149630c to
4bfed68
Compare
|
Thanks @migmartri — done. Both commits now carry a sign-off trailer and are GPG-signed:
One note: the key was freshly generated on my signing machine and is not yet registered under my GitHub account settings, so the badge may show Unverified until then. You can verify manually with |
|
Hi @migmartri — gentle bump on PR #3406. Both commits are now signed-off and GPG-signed (key 5CA4D4C4410B322E). Public key published at the gist linked in the thread. Let me know if anything else is needed. Thanks! |
I am afraid we can't merge until the public key is in your GitHub profile, thanks |
|
Hi @migmartri — I noticed the latest notification (id 25511563947) mentions this PR. It looks like the automated cubic-dev-ai review flagged the Go template field-access concern for hyphenated annotation names in dependency-track integrations. I already addressed this in the proto comment (documenting the template syntax requirement). Is there anything else blocking merge? Thank you! |
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>
4bfed68 to
f8b3e74
Compare
Yes, please add the public key in your GitHub profile so we can verify it, thanks |
|
Hi @chainloop-dev — CI is fully green (DCO ✅, Kusari ✅, cubic AI review ✅). Ready to merge when you get a chance. Thanks! |
|
Hi @migmartri — thank you for approving this PR! It's been approved since yesterday and all checks are green. Could you merge when you have a moment? Thanks! |


Summary
Annotation.nameby widening the validation pattern from^[\w]+$to^[\w-]+$@) are still rejectedMotivation
Annotation names currently only accept word characters (
[a-zA-Z0-9_]), somy_annotationis valid butmy-annotationis rejected. Contract names and material names both allow hyphens, so this is an inconsistency rather than a deliberate restriction. Users coming from either of those naturally reach for a hyphen and get a validation error.Fixes #3405
Changes
app/controlplane/api/workflowcontract/v1/crafting_schema.proto— one-line change to thebuf.validate.fieldpatternapp/controlplane/api/workflowcontract/v1/crafting_schema.pb.go— regeneratedapp/controlplane/api/gen/frontend/workflowcontract/v1/crafting_schema.ts— regeneratedapp/controlplane/api/gen/jsonschema/workflowcontract.v1.Annotation.jsonschema.json— regeneratedapp/controlplane/api/gen/jsonschema/workflowcontract.v1.Annotation.schema.json— regeneratedapp/controlplane/api/workflowcontract/v1/crafting_schema_test.go— updated existing test + added two new casesTest Plan
go test ./app/controlplane/api/workflowcontract/v1/passes (all 9 annotation test cases pass)@) still rejected