fix(cli): prefer $CHAINLOOP_TOKEN over user credentials when both are set#3216
fix(cli): prefer $CHAINLOOP_TOKEN over user credentials when both are set#3216migmartri wants to merge 1 commit into
Conversation
… set When both user credentials (from auth login) and the $CHAINLOOP_TOKEN environment variable are present, the CLI now defaults to the API token from the environment variable instead of the user session. An explicitly exported $CHAINLOOP_TOKEN is a stronger signal of intent than a possibly stale login session, and API tokens can now perform the same operations as user credentials (including attestations). The warning is flipped to indicate that user credentials are being ignored. Closes #3215 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: f29ba765-4a69-48fe-ab1e-84ba24984ea9
AI Session Analysis
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| created | ai | app/cli/cmd/root_test.go |
+113 / -0 |
| modified | ai | app/cli/cmd/root.go |
+8 / -6 |
Policies (4, 1 failing)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-f29ba7 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-f29ba7 |
- |
ai-config-no-secrets |
ai-coding-session-f29ba7 |
|
|
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-f29ba7 |
- |
Powered by Chainloop and Chainloop Trace
Summary
Flips the precedence between user credentials and
$CHAINLOOP_TOKEN. When both are set, the CLI now defaults to the API token from the environment variable instead of the user login session.An explicitly exported
$CHAINLOOP_TOKENis a stronger signal of intent than a (possibly stale) login session, and API tokens can now perform the same operations as user credentials, including attestations. The warning shown in this situation is reversed accordingly to indicate that user credentials are being ignored.Closes #3215
AI disclosure
This change was produced with the assistance of Claude Code.
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri