fix(selfhost): trim and redact D1 probe API token in probe errors - #4361
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4361 +/- ##
=======================================
Coverage 93.74% 93.74%
=======================================
Files 387 387
Lines 36398 36400 +2
Branches 13330 13330
=======================================
+ Hits 34120 34122 +2
Misses 1621 1621
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-09 04:46:11 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 4 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Motivation
Description
CLOUDFLARE_D1_MONITOR_API_TOKENand reject config when the token is empty or contains control characters inresolveD1SizeProbeConfig(src/selfhost/d1-size-probe.ts).redactD1ProbeSecretand update the probe error logger to redact the configured token from logged error messages before writing JSON logs, and change the logger to accept the probeconfigso it can accessconfig.apiToken(src/selfhost/d1-size-probe.ts).src/selfhost/d1-size-probe.ts).test/unit/selfhost-d1-size-probe.test.ts).Testing
npx vitest run test/unit/selfhost-d1-size-probe.test.ts, which passed (29 tests).npm run typecheck -- --pretty false, which passed.npm run selfhost:env-reference:check, which passed.npm run test:coverageandnpm run test:ci, but the broader suite coverage run encountered unrelated test/coverage infra issues in the full test suite (existingqueue.test.tsstack overflow and coverage tooling error); these issues are external to the changes in this PR.npm audit --audit-level=moderate, but the registry audit endpoint returned403 Forbiddenin this environment (external issue).Codex Task