Repository navigation
feat(controlplane): filter the API token list by product scope - #3832
Conversation
Add SCOPE_PRODUCT to APITokenServiceListRequest.Scope. A list request with this scope returns only the tokens that are confined to the projects of a product. The CLI accepts it as `--scope product`. Assisted-by: Claude Code Signed-off-by: Javier Rodriguez <javier@chainloop.dev> Chainloop-Trace-Sessions: 127dc03c-8bcb-4505-be85-e2f46e7ba75e
PR validation —
|
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | pr-min-approvals |
pr-info |
- |
| ✅ Passed | pr-description-required |
pr-info |
- |
pr-user-story-linked |
pr-info |
PR/MR #3832 does not reference a user story or issue in title, description, or branch 'feat(controlplane): filter the API token list by product scope'. Expected patterns: ["(?i)[A-Z]+-[0-9]+", "#[0-9]+", "(?i)gh-[0-9]+", "(?i)\\[[A-Z]+-[0-9]+\\]"] |
AI Session Checks — 🟡 90% · ⚠️ 1 failing
| Avg score | Sessions | Failing policies | Attribution | Files | Lines | Total Duration |
|---|---|---|---|---|---|---|
| 🟡 90% | 1 | 100% AI / 0% Human | 6 | +20 / -1 | 34m6s |
🟡 90% — 100% AI — ⚠️ 1 policies failing
-
Nov 18, 2026 15:12 UTC · 34m6s · $28.56 · 730 in / 282.3k out · claude-code 2.1.327 (claude-opus-5-5)
Change Summary
-
Adds product-scope filtering to the API token list and CLI, regenerates related bindings and schemas, and extends service regression coverage while preserving existing scope restrictions.
AI Session Overall Score
-
🟡 90% — Focused, tested product filtering recovered from an initial architectural detour requiring user intervention.
AI Session Analysis Breakdown
-
🟢 96% · scope-discipline
-
No notes.
🟢 94% · solution-quality
-
🟢 The service maps the new public scope to the existing product resource type instead of filtering client-side. · High Impact
🟢 92% · alignment
-
No notes.
🟢 92% · verification
-
🟢 Named product-scope cases passed for mapping, authorized listing, and organization-token narrowing through the actual service logic. · High Impact
🟢 The agent checked suspiciously fast integration output and confirmed both named product-filtering integration tests ran and passed. · High Impact
🟡 The CLI product mapping has no new dedicated regression case, although both CLI packages passed their existing tests. · Low Severity
🟡 75% · context-and-planning
-
🟠 The initial backend-versus-client decision was not shared before editing, prompting a user interruption and approach correction. · Medium Severity
💡 Before editing, state where filtering belongs and outline the API, client, and validation steps.
🟡 75% · user-trust-signal
-
No notes.
-
File Attribution
████████████████████100% AI / 0% HumanStatus Attribution File Lines modified ai app/controlplane/internal/service/apitoken_test.go+12 / -0 modified ai app/cli/documentation/cli-reference.md+1 / -1 modified ai app/cli/pkg/action/apitoken_list.go+2 / -0 modified ai app/controlplane/api/controlplane/v1/api_token.proto+2 / -0 modified ai app/controlplane/internal/service/apitoken.go+2 / -0 modified ai app/cli/cmd/organization_apitoken_list.go+1 / -0
Policies (4, 1 failing)
Status Policy Material Messages ✅ Passed ai-config-ai-agents-allowedai-coding-session-127dc0- ✅ Passed ai-config-no-dangerous-commandsai-coding-session-127dc0- ⚠️ Failedai-config-no-secretsai-coding-session-127dc0- Secret (generic-password) detected in session content [turn=1438, source=tool_result, line=34]: 64: "Quoted API key/password":
[CHAINLOOP_TRACE_REDACTED:generic-password], - Secret (generic-password) detected in session content [turn=1455, source=tool_result, line=9]: "Quoted API key/password":
[CHAINLOOP_TRACE_REDACTED:generic-password], - Secret (jwt) detected in session content [turn=182, source=tool_result, line=21]: deel_pto: "https://api.deel.com/apps/webhooks/calendars/[CHAINLOOP_TRACE_REDACTED:jwt]"
✅ Passed ai-config-mcp-servers-allowedai-coding-session-127dc0- -
Security Checks — ✅ 6 passing
✅ secret-scan
| 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
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | iac-misconfiguration |
- |
Scans not applied (2)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
Powered by Chainloop and Chainloop Trace
The scope filter of the API token list has two values:
SCOPE_PROJECTandSCOPE_GLOBAL. A client cannot ask for only the tokens that are confined to the projects of a product. A request without a scope returns these tokens together with all other tokens.This change adds
SCOPE_PRODUCTtoAPITokenServiceListRequest.Scope. The repository already filters by the product scope kind, so the service maps the new value to it.Behavior
SCOPE_UNSPECIFIEDSCOPE_GLOBALSCOPE_PROJECTSCOPE_PRODUCT(new)SCOPE_PRODUCT.chainloop organization api-token list --scope product.AI disclosure: Claude Code helped to write this change. I reviewed and tested it.