Skip to content

feat(controlplane): filter the API token list by product scope - #3832

Merged
javirln merged 1 commit into
mainfrom
javirln/api-token-list-product-scope
Nov 19, 2026
Merged

javirln merged 1 commit into
mainfrom
javirln/api-token-list-product-scope

Conversation

@javirln

@javirln javirln commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The scope filter of the API token list has two values: SCOPE_PROJECT and SCOPE_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_PRODUCT to APITokenServiceListRequest.Scope. The repository already filters by the product scope kind, so the service maps the new value to it.

Behavior

Scope Tokens in the result
SCOPE_UNSPECIFIED No scope filter
SCOPE_GLOBAL Organization-wide tokens: no project, and no product scope
SCOPE_PROJECT Project-scoped tokens
SCOPE_PRODUCT (new) Product-scoped tokens
  • An organization or instance API token still gets only project tokens, also when it asks for SCOPE_PRODUCT.
  • A user that RBAC limits to some projects gets no product tokens, as before. A product token has no project ID.
  • The CLI accepts the new value: chainloop organization api-token list --scope product.

AI disclosure: Claude Code helped to write this change. I reviewed and tested it.

View guided diff

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
@chainloop-platform

chainloop-platform Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 1 failing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
⚠️ Failed 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]+\\]"]

View attestation ↗

AI Session Checks — 🟡 90% · ⚠️ 1 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟡 90% 1 ⚠️ 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)

View session details ↗

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% Human

Status 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-allowed ai-coding-session-127dc0 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-127dc0 -
⚠️ Failed ai-config-no-secrets ai-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-allowed ai-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

View attestation ↗


Powered by Chainloop and Chainloop Trace

@javirln
javirln marked this pull request as ready for review November 18, 2026 15:26

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 10 files

View guided diff | Re-trigger cubic

@javirln
javirln merged commit 0bc7d95 into main Nov 19, 2026
15 of 17 checks passed
@javirln
javirln deleted the javirln/api-token-list-product-scope branch November 19, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants