Skip to content

feat(cli): download an artifact with a ready CAS credential - #3848

Closed
javirln wants to merge 1 commit into
mainfrom
cli-artifact-download-cas-credential
Closed

javirln wants to merge 1 commit into
mainfrom
cli-artifact-download-cas-credential

Conversation

@javirln

@javirln javirln commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

chainloop artifact download can now use a CAS credential that the client got before.

  • Set it with the CHAINLOOP_ARTIFACT_CAS_TOKEN environment variable (preferred) or the --artifact-cas-token flag.
  • With a credential, the command connects to the CAS API directly, and needs no API token and no control plane call.
  • The credential has precedence over an API token. Without one, the command works as before.
  • When the CAS does not accept the credential, the error now says so instead of "artifact not found".

An AI assistant (Claude Code) helped write this change.

View guided diff

`chainloop artifact download` can use a CAS credential that the client
obtained before. Set it with the CHAINLOOP_ARTIFACT_CAS_TOKEN environment
variable or with the --artifact-cas-token flag. The command then connects
to the CAS API with this credential, and it needs no API token and no
control plane call. The CAS credential has precedence over the API token.
Without a CAS credential, the command gets one from the control plane as
before.

When the CAS does not accept the credential, the command now reports
that, instead of "artifact not found".

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Assisted-by: Claude Code

Chainloop-Trace-Sessions: 5aac1986-3c81-429d-a6e2-ba72c55819b9
@chainloop-platform

chainloop-platform Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ⚠️ 2 failing

Status Policy Material Messages
⚠️ Failed pr-min-approvals pr-info PR/MR #3848 has 0 approving reviews, 1 required.
✅ Passed pr-description-required pr-info -
⚠️ Failed pr-user-story-linked pr-info PR/MR #3848 does not reference a user story or issue in title, description, or branch 'feat(cli): download an artifact with a ready CAS credential'. Expected patterns: ["(?i)[A-Z]+-[0-9]+", "#[0-9]+", "(?i)gh-[0-9]+", "(?i)\\[[A-Z]+-[0-9]+\\]"]

View attestation ↗

AI Session Checks — 🟡 85% · ⚠️ 2 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟡 85% 1 ⚠️ 2 98% AI / 2% Human 6 +417 / -27 315h48m53s

🟡 85% — 98% AI — ⚠️ 2 policies failing

Nov 10, 2026 08:24 UTC · 315h48m53s · $1800.52 · 29.4k in / 15.1M out · claude-code 2.1.321 (claude-opus-5-5)

View session details ↗

Change Summary

Adds artifact downloads using a previously obtained CAS credential from an environment variable or flag. Preserves the API-token fallback and reports credential rejection explicitly, with CLI tests and updated reference documentation.

AI Session Overall Score

🟡 85% — Focused CLI implementation and meaningful tests, with captured execution evidence still missing.

AI Session Analysis Breakdown

🟢 95% · context-and-planning

🟢 The CLI brief specified precedence, fallback, command isolation, documentation, and expected tests before implementation. · High Impact

🟢 94% · scope-discipline

No notes.

🟢 92% · alignment

No notes.

🟢 91% · solution-quality

🟢 The command defers control-plane initialization and restores it only for the fallback, addressing the actual connection dependency. · High Impact

🟡 The AI added an unexplained lint suppression to an environment-variable name; its scope is limited to that constant. · Low Severity

🟡 78% · user-trust-signal

🟡 The user firmly clarified that public repositories must not disclose security considerations or bugs. · Low Severity

🟡 68% · verification

🟢 Tests execute the real command, check downloaded bytes, credential precedence, fallback requests, malformed input, and rejection. · High Impact

🟠 The captured CLI phase contains no test-run output or user confirmation of the new download behavior. · Medium Severity

💡 Capture the CLI test command and its result before publishing the change.


File Attribution

███████████████████░ 98% AI / 2% Human

Status Attribution File Lines
created ai app/cli/cmd/artifact_download_test.go +327 / -0
modified ai app/cli/cmd/artifact_download.go +54 / -12
modified ai app/cli/cmd/artifact.go +24 / -10
modified ai app/cli/documentation/cli-reference.md +5 / -4
modified ai app/cli/pkg/action/artifact_download.go +6 / -0
modified ai app/cli/cmd/artifact_upload.go +1 / -1

Policies (4, 2 failing)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-5aac19 -
⚠️ Failed ai-config-no-dangerous-commands ai-coding-session-5aac19 Forbidden bash pattern /curl[^|\n]\|\s(?:bash|sh)\b/ matched command: cd /home/javi/orca/workspaces/platform/ai-assisted-manual-evidence/e2e && export TMPDIR=$HOME/.cache/pfm-7910-build/tmp && (yarn install --immutable 2>&1 | tail...
⚠️ Failed ai-config-no-secrets ai-coding-session-5aac19
  • Secret (generic-password) detected in session content [turn=101, source=tool_result, line=4]: license_key: "[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:jwt]"
  • Secret (generic-password) detected in session content [turn=12318, source=tool_result, line=2]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-5aac19](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • Secret (generic-password) detected in session content [turn=15820, source=tool_result, line=8]: INF commit record saved sha=[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key]
  • Secret (generic-password) detected in session content [turn=16428, source=tool_result, line=1]: {"headRefName":"javirln/pfm-7910-reconcile-system-tokens","headRefOid":"[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key]","isDraft":false,"reviewDecision":"CHANGES_REQUEST...
  • Secret (generic-password) detected in session content [turn=16584, source=tool_result, line=45]: Reviews (5) · Last reviewed commit: ["docs(apitokens): say that a system produ..."](https://github.com/chainloop-dev/platform/commit/[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:g...
  • Secret (generic-password) detected in session content [turn=16902, source=tool_result, line=4]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-5aac19](https://app.chainloop.dev/u/chainloop/projects/chainloop-platf...
  • Secret (generic-password) detected in session content [turn=16941, source=assistant-text, line=4]: - ai-config-no-secrets (#7252, #7254) checks the record of this AI coding session, not the code. It flagged lines where the tracer had already replaced the values with [CHAINLOOP_TRACE_REDACTED...</li><li>Secret (generic-password) detected in session content [turn=175, source=tool_result, line=32]: license_key: "[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:jwt]"</li><li>Secret (generic-password) detected in session content [turn=18992, source=tool_result, line=1]: git -C ~/.cache/pfm-7910-build/split/b1 push --force-with-lease=javirln/pfm-7910-reconcile-system-tokens:[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key] origin javirln/pf...</li><li>Secret (generic-password) detected in session content [turn=18996, source=assistant-text, line=12]: git -C ~/.cache/pfm-7910-build/split/b1 push --force-with-lease=javirln/pfm-7910-reconcile-system-tokens:[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key] origin javirln/pf...</li><li>Secret (generic-password) detected in session content [turn=19104, source=assistant-tool_use:Bash, line=1]: cd ~/.cache/pfm-7910-build/split && git -C b1 push --force-with-lease=javirln/pfm-7910-reconcile-system-tokens:[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key] origin javi...</li><li>Secret (generic-password) detected in session content [turn=31966, source=tool_result, line=19]: (More exist: pass page_token"[CHAINLOOP_TRACE_[CHAINLOOP_TRACE_REDACTED:generic-password]:generic-api-key]" with the samescope` to list the next ones.)
  • Secret (generic-password) detected in session content [turn=482, source=tool_result, line=11]: 65 api_key: "[CHAINLOOP_TRACE_REDACTED:generic-password]"
  • Secret (generic-password) detected in session content [turn=482, source=tool_result, line=19]: 73 token: "[CHAINLOOP_TRACE_REDACTED:generic-password]"
  • Secret (generic-password) detected in session content [turn=6888, source=tool_result, line=7]: # user: [CHAINLOOP_TRACE_REDACTED:generic-password]
  • Secret (generic-password) detected in session content [turn=6888, source=tool_result, line=8]: # password: [CHAINLOOP_TRACE_REDACTED:generic-password]
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-5aac19 -

Security Checks — ✅ 6 passing

✅ AI Security Analysis

Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.

View in Chainloop ↗ · How this works ↗

✅ 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 -
Scans not applied (3)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗


Powered by Chainloop and Chainloop Trace

@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 6 files

View guided diff | Re-trigger cubic

@javirln javirln closed this Nov 23, 2026
@javirln
javirln deleted the cli-artifact-download-cas-credential branch November 23, 2026 13:40
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.

1 participant