Skip to content

fix(trace): keep SSH key fingerprints in redacted sessions - #3712

Merged
migmartri merged 2 commits into
chainloop-dev:mainfrom
migmartri:fix/trace-redact-ssh-key-fingerprints
Oct 26, 2026
Merged

migmartri merged 2 commits into
chainloop-dev:mainfrom
migmartri:fix/trace-redact-ssh-key-fingerprints

Conversation

@migmartri

Copy link
Copy Markdown
Member

Chainloop Trace redacted the SHA256 fingerprint that git prints when it checks an SSH commit signature, for example in the output of git log --show-signature. The betterleaks generic-api-key rule matches it, so the session showed a redaction placeholder and the ai-config-no-secrets policy reported a secret. A fingerprint is a hash of a public key, not a credential.

This adds an allowlist to the redaction ruleset for an OpenSSH SHA256 fingerprint: SHA256: followed by exactly 43 base64 characters at the end of the match. A longer value after the same prefix, and other secrets in the same text, are still redacted.

AI disclosure: this change was produced with assistance from Claude Code.

The generic-api-key rule matched the SHA256 fingerprint that git prints
when it checks an SSH commit signature, for example the output of
git log --show-signature. A fingerprint is a hash of a public key, not a
credential, so the redaction replaced it and the no-secrets policy
reported a false positive.

Add an allowlist for an OpenSSH SHA256 fingerprint: SHA256: and exactly
43 base64 characters at the end of the match. A longer value after the
same prefix is still redacted.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 34d67f3d-296c-4dce-b668-3a73637e6a43
@chainloop-platform

chainloop-platform Bot commented Oct 24, 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 #3712 does not reference a user story or issue in title, description, or branch 'fix(trace): keep SSH key fingerprints in redacted sessions'. Expected patterns: ["(?i)[A-Z]+-[0-9]+", "#[0-9]+", "(?i)gh-[0-9]+", "(?i)\\[[A-Z]+-[0-9]+\\]"]

View attestation ↗

AI Session Checks — 🟢 88% · ⚠️ 1 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 88% 1 ⚠️ 1 100% AI / 0% Human 20 +648 / -35 54h52m38s

🟢 88% — 100% AI — ⚠️ 1 policies failing

Oct 24, 2026 12:56 UTC · 54h52m38s · $38.76 · 1.2k in / 435.5k out · claude-code 2.1.310 (claude-opus-5-5)

View session details ↗

Change Summary

  • Adds an SSH fingerprint allowlist to internal/redaction/betterleaks.toml.
  • Adds regression cases that keep commit-signature fingerprints while still redacting longer or continued secrets.
  • Keeps the PR confined to the redaction config and its tests.

AI Session Overall Score

🟢 88% — Clean, well-scoped trace-redaction fix with added regression coverage and no flagged lanes.

AI Session Analysis Breakdown

🟢 92% · scope-discipline

No notes.

🟢 90% · alignment

🟢 After the gitleaks report, AI pivoted to a separate trace-redaction PR. · High Impact

🟢 88% · solution-quality

🟢 The anchored regex fixes the suffix hole while preserving real secret redaction. · High Impact

🟢 87% · verification

🟢 A new guard test failed first, then passed after the regex change. · High Impact

🟢 86% · context-and-planning

No notes.

🟢 84% · user-trust-signal

No notes.


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
created ai app/cli/pkg/action/artifact_upload_test.go +138 / -0
modified ai app/artifact-cas/internal/service/bytestream_test.go +88 / -0
modified ai internal/robotaccount/cas/robotaccount_test.go +77 / -0
modified ai app/controlplane/internal/service/casredirect_integration_test.go +66 / -0
modified ai app/artifact-cas/internal/service/download_test.go +58 / -0
modified ai app/artifact-cas/internal/service/resource_test.go +50 / -2
modified ai internal/robotaccount/cas/robotaccount.go +52 / -0
modified ai app/cli/cmd/artifact_upload.go +28 / -7
modified ai pkg/casclient/uploader.go +19 / -11
modified ai app/cli/pkg/action/artifact_upload.go +7 / -10
modified ai app/artifact-cas/internal/service/bytestream.go +11 / -0
modified ai app/artifact-cas/internal/service/resource.go +10 / -0
modified ai app/controlplane/pkg/biz/cascredentials.go +10 / -0
modified ai app/controlplane/internal/service/cascredential.go +9 / -0
modified ai app/controlplane/internal/service/casredirect.go +7 / -0
modified ai app/artifact-cas/internal/service/download.go +6 / -0
modified ai app/controlplane/api/controlplane/v1/cas_credentials.proto +4 / -1
modified ai app/cli/cmd/artifact.go +3 / -1
modified ai app/controlplane/api/controlplane/v1/cas_redirect.proto +3 / -1
modified ai app/controlplane/pkg/biz/casclient.go +2 / -2

Policies (4, 1 failing)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-34d67f -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-34d67f -
⚠️ Failed ai-config-no-secrets ai-coding-session-34d67f
  • Secret (generic-api-key) detected in session content [turn=1003, source=tool_result, line=59]: | ⚠️ Failed | ai-config-no-secrets | [ai-coding-session-34d67f](https://app.chainloop.dev/u/chainloop/projects/chainloop/versi...
  • Secret (generic-api-key) detected in session content [turn=1049, source=user-message, line=1]: see Secret (generic-api-key) detected in session content [turn=927, source=tool_result, line=2]: Good "git" signature for miguel@chainloop.dev with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic...
  • Secret (generic-api-key) detected in session content [turn=1075, source=assistant-text, line=10]: Good "git" signature for miguel@chainloop.dev with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]
  • Secret (generic-api-key) detected in session content [turn=1173, source=tool_result, line=31]: "password: [CHAINLOOP_TRACE_REDACTED:generic-password]\napi_key: [CHAINLOOP_TRACE_REDACTED:generic-api-key]\n",
  • Secret (generic-api-key) detected in session content [turn=1224, source=tool_result, line=11]: actual : "Good \"git\" signature for sarah@chainloop.local with RSA key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1224, source=tool_result, line=16]: Error: "Good \"git\" signature with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\napi_key: [CHAINLOOP_TRACE_REDACTED:generic-api-key]\n" does not contain "SHA256:q3Rk8vLm2+Zx7Pw...
  • Secret (generic-api-key) detected in session content [turn=1224, source=tool_result, line=5]: actual : "Good \"git\" signature for sarah@chainloop.local with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1308, source=tool_result, line=11]: DEF: "with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1308, source=tool_result, line=5]: DEF: "key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1308, source=tool_result, line=6]: OUR: "key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1308, source=tool_result, line=8]: DEF: "with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1308, source=tool_result, line=9]: OUR: "with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]\n"
  • Secret (generic-api-key) detected in session content [turn=1596, source=user-message, line=11]: - The user asked about the secret-scanner false positive ("Secret (generic-api-key) detected ... ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]") and asked "waht secret tdid you try to ...
  • Secret (generic-api-key) detected in session content [turn=1596, source=user-message, line=132]: - "see Secret (generic-api-key) detected in session content [turn=927, source=tool_result, line=2]: Good "git" signature for miguel@chainloop.dev with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:gene...
  • Secret (generic-api-key) detected in session content [turn=927, source=tool_result, line=2]: Good "git" signature for miguel@chainloop.dev with ED25519 key SHA256:[CHAINLOOP_TRACE_REDACTED:generic-api-key]
  • Secret (generic-password) detected in session content [turn=1109, source=tool_result, line=105]: text: text: "host: localhost\\nuser: admin\\npassword: [CHAINLOOP_TRACE_REDACTED:generic-password]\\nport: 5432\\n", + "\n",
  • Secret (generic-password) detected in session content [turn=1124, source=tool_result, line=1]: text: text: "host: localhost\\nuser: admin\\npassword: [CHAINLOOP_TRACE_REDACTED:generic-password]\\nport: 5432\\n", + "\n",
  • Secret (generic-password) detected in session content [turn=1124, source=tool_result, line=64]: text := "const AUTH0 = {\n email: 'input[name=\"login\"]',\n password: '[CHAINLOOP_TRACE_REDACTED:generic-password]',\n};\n"
  • Secret (generic-password) detected in session content [turn=1173, source=tool_result, line=30]: "| ai-config-no-secrets | fail | Secret (generic-password) detected [CHAINLOOP_TRACE_REDACTED:generic-password] |\n",
  • Secret (generic-password) detected in session content [turn=1173, source=tool_result, line=31]: "password: [CHAINLOOP_TRACE_REDACTED:generic-password]\napi_key: [CHAINLOOP_TRACE_REDACTED:generic-api-key]\n",
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-34d67f -

Security Checks — ✅ 5 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 -
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 ↗

Security context

✅ Nothing this change touches has a recorded security-fix history.

View in Chainloop ↗ · How this works ↗


Powered by Chainloop and Chainloop Trace

@migmartri
migmartri requested a review from a team October 24, 2026 13:24

@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.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread internal/redaction/betterleaks.toml Outdated
A key that went on after the 43 fingerprint characters with a - . or _
was kept, because any non-base64 character counted as the end. Only the
terminator the generic-api-key rule adds to its match can now follow.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 34d67f3d-296c-4dce-b668-3a73637e6a43
@migmartri
migmartri merged commit 9f8be24 into chainloop-dev:main Oct 26, 2026
15 of 17 checks passed
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