Description
src/__test__/logRedact.test.ts only asserts that G... Stellar public keys are masked by src/utils/logRedact.ts, plus a couple of nesting and debug-flag cases. Because the redactor is the last line of defense before secrets reach stdout (it is invoked by src/services/horizonListener.ts and src/routes/webhook.ts), its branch coverage matters. This issue broadens the test matrix so regressions in the masking rules are caught, and is a good companion to the security hardening of logRedact.
Requirements and context
- Add tests for
redactLogValue and redactLogArgs (not just redactLogString) covering arrays of mixed types, deeply nested plain objects, circular references (the redactor guards these with a WeakSet), and Error objects whose message and stack contain a Stellar address.
- Assert that the
LOG_REDACTION_DEBUG bypass via isLogRedactionDebugEnabled returns inputs verbatim, including the '1' and 'true' truthy variants already handled in the source.
- Assert non-string, non-object primitives (numbers, booleans,
null, undefined) pass through unchanged.
- If issue "Harden secret handling" merges first, extend these tests to the new
S.../M.../email patterns; otherwise scope to the current G... behavior and the structural traversal branches.
- Non-functional: tests must not mutate global
process.env without restoring it, and must be deterministic.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b testing/logredact-matrix.
2. Implement changes — no production-code change required; extend the existing test file only.
3. Write/extend tests — Vitest + Supertest; extend src/__test__/logRedact.test.ts following its current structure.
4. Test and commit —
npm run lint
npm run typecheck
npm test
npm run test:coverage
npm run build
Example commit message
test(logredact): broaden redaction coverage for nested and edge inputs
Guidelines
CI enforces a 95% coverage threshold (vitest.config.ts, via npm run test:coverage) — aim to push logRedact.ts branch coverage toward 100%. Update docs/utils.md. Timeframe: 96 hours.
Description
src/__test__/logRedact.test.tsonly asserts thatG...Stellar public keys are masked bysrc/utils/logRedact.ts, plus a couple of nesting and debug-flag cases. Because the redactor is the last line of defense before secrets reach stdout (it is invoked bysrc/services/horizonListener.tsandsrc/routes/webhook.ts), its branch coverage matters. This issue broadens the test matrix so regressions in the masking rules are caught, and is a good companion to the security hardening oflogRedact.Requirements and context
redactLogValueandredactLogArgs(not justredactLogString) covering arrays of mixed types, deeply nested plain objects, circular references (the redactor guards these with aWeakSet), andErrorobjects whosemessageandstackcontain a Stellar address.LOG_REDACTION_DEBUGbypass viaisLogRedactionDebugEnabledreturns inputs verbatim, including the'1'and'true'truthy variants already handled in the source.null,undefined) pass through unchanged.S.../M.../email patterns; otherwise scope to the currentG...behavior and the structural traversal branches.process.envwithout restoring it, and must be deterministic.Acceptance criteria
redactLogValueandredactLogArgsare covered for arrays, nested objects, and circular references.Errormessageandstackredaction is asserted.LOG_REDACTION_DEBUGbypass is asserted for'1'and'true'.number/boolean/null/undefined) is asserted.process.envis restored after each test that toggles the debug flag.docs/utils.mdreferences the redactor's tested behaviors.Suggested execution
1. Fork the repo and create a branch —
git checkout -b testing/logredact-matrix.2. Implement changes — no production-code change required; extend the existing test file only.
3. Write/extend tests — Vitest + Supertest; extend
src/__test__/logRedact.test.tsfollowing its current structure.4. Test and commit —
npm run lint npm run typecheck npm test npm run test:coverage npm run buildExample commit message
Guidelines
CI enforces a 95% coverage threshold (
vitest.config.ts, vianpm run test:coverage) — aim to pushlogRedact.tsbranch coverage toward 100%. Updatedocs/utils.md. Timeframe: 96 hours.