Redact auth token secrets from debug logs#305
Conversation
Assisted-by: Codex:gpt-5.5
📝 WalkthroughWalkthroughSign-in and sign-up token creation debug logs are updated to omit sensitive token UUIDs and verification codes, logging only non-sensitive metadata like accountId and expiration. Tests verify that sensitive properties are excluded from captured log records. ChangesToken Logging Security Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the sign-in and sign-up token creation logic to prevent sensitive data, such as tokens and codes, from being logged in debug statements. It also adds comprehensive test cases to verify that these secrets are omitted from the logs. Two review comments were provided regarding the alphabetical ordering of external imports in the test files to comply with the repository style guide.
Summary
Fixes #245
AI assistance
This pull request and commit were prepared with OpenAI GPT-5.5. I reviewed the issue, policy, code paths, tests, and validation output before submitting.
Validation
docker run --rm -u "$(id -u):$(id -g)" -e DENO_DIR=/workspace/.deno_cache -e DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/hackerspub_test -v "$PWD":/workspace -w /workspace denoland/deno:2.7.13 deno test --allow-all --filter "token debug log omits" models/signin.test.ts models/signup.test.tsfailed before the fix because the expected redacted log records were absent.docker run --rm -u "$(id -u):$(id -g)" -e DENO_DIR=/workspace/.deno_cache -e DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/hackerspub_test -v "$PWD":/workspace -w /workspace denoland/deno:2.7.13 deno test --allow-all --filter "token" models/signin.test.ts models/signup.test.tspassed: 4 passed, 0 failed, 1 filtered.docker run --rm -u "$(id -u):$(id -g)" -e DENO_DIR=/workspace/.deno_cache -v "$PWD":/workspace -w /workspace denoland/deno:2.7.13 deno fmt --check models/signin.ts models/signin.test.ts models/signup.ts models/signup.test.tspassed.docker run --rm -u "$(id -u):$(id -g)" -e DENO_DIR=/workspace/.deno_cache -e DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/hackerspub_test -v "$PWD":/workspace -w /workspace denoland/deno:2.7.13 deno lint models/signin.ts models/signin.test.ts models/signup.ts models/signup.test.tspassed.docker run --rm -u "$(id -u):$(id -g)" -e DENO_DIR=/workspace/.deno_cache -v "$PWD":/workspace -w /workspace denoland/deno:2.7.13 deno check models/signin.test.ts models/signup.test.tspassed.git diff --check -- models/signin.ts models/signin.test.ts models/signup.ts models/signup.test.tspassed.