Skip to content

fix(server): apply credential redactor to tenant-registry wire-projected reasons (#1330) - #1336

Merged
bokelley merged 1 commit into
mainfrom
bokelley/tenant-registry-redactor
May 2, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/tenant-registry-redactor

Conversation

@bokelley

@bokelley bokelley commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1330. Phase 1 Stage 4 of #1269 introduced redactCredentialPatterns and applied it to the dispatcher's err.message → details.reason projections. Code-reviewer flagged additional sites in tenant-registry.ts that bypass the redactor — TenantStatus.reason flows to the wire via the admin router (GET /tenants/:id, POST /tenants/:id/recheck), and three sites projected upstream err.message into the reason without scrubbing.

What's fixed

Four sites:

  • src/lib/server/decisioning/tenant-registry.ts:399 — JWKS fetch failure. Network errors can echo basic-auth-bearing URLs (https://user:pass@vendor/...) or upstream-library diagnostics that include credential bytes.
  • src/lib/server/decisioning/tenant-registry.ts:416 — JSON parse failure on JWKS body. Body fragments could include credential strings.
  • src/lib/server/decisioning/tenant-registry.ts:834 — adopter validator throw. Custom validators may include credential bytes in their error messages (e.g., a wrapped HTTP-fetch library that echoes the request URL).
  • src/lib/server/decisioning/admin-router.ts:94 — recheck route's catch-all 500 handler. Same posture as the validator throws.

Idempotent propagation

The redactor returns already-redacted strings unchanged, so propagation paths that concatenate upstream reasons (tenant-registry.ts:850, 856) are automatically safe once the upstream sites redact. No additional changes needed at those sites.

Test plan

  • npm run typecheck clean.
  • test/server-decisioning-tenant-registry-redaction.test.js — 4/4 pass:
    • Validator throw with Bearer <token> → token redacted.
    • Validator throw with token=value → labeled credential redacted.
    • Validator throw with URL-embedded credential → password stripped, scheme + user preserved.
    • Benign error message passes through unchanged.
  • test/server-decisioning-tenant-registry.test.js (existing) — 75/75 pass with redaction in place.
  • npm run format:check clean.
  • Full suite: 7449 pass, 0 fail.

Cross-links

🤖 Generated with Claude Code

…ted reasons (closes #1330)

Stage 4 of #1269 introduced redactCredentialPatterns and applied it to
the dispatcher's `err.message → details.reason` projections.
Code-reviewer flagged additional sites in tenant-registry.ts that
bypass the redactor — TenantStatus.reason flows to the wire via the
admin router (GET /tenants/:id, POST /tenants/:id/recheck), and three
sites projected upstream err.message into the reason without scrubbing.

Fixes four sites:
- src/lib/server/decisioning/tenant-registry.ts:399 — JWKS fetch failure
- src/lib/server/decisioning/tenant-registry.ts:416 — JSON parse failure
- src/lib/server/decisioning/tenant-registry.ts:834 — validator throw
- src/lib/server/decisioning/admin-router.ts:94 — recheck route 500

The redactor is idempotent, so propagation paths that concatenate
upstream reasons (tenant-registry.ts:850, 856) are automatically safe
once the upstream sites redact.

4 new tests at test/server-decisioning-tenant-registry-redaction.test.js:
Bearer redaction, labeled-credential redaction, URL-embedded credential
redaction (password stripped, scheme + user preserved), benign-error
pass-through.

Full suite: 7449 pass, 0 fail.

Closes #1330.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented May 2, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
32420086 Triggered Generic High Entropy Secret 1e783d5 test/server-decisioning-tenant-registry-redaction.test.js View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@bokelley
bokelley merged commit 2cb70d6 into main May 2, 2026
8 of 9 checks passed
@bokelley
bokelley deleted the bokelley/tenant-registry-redactor branch May 2, 2026 20:19
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.

harden: tenant-registry err.message → reason projections bypass redactor

1 participant