fix: remove token value from Bad Token log messages (#35) #45
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#45
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-database-35"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Removes the raw bearer token value from
logger.warning/logging.warningcalls that loggedBad Token: {token}on 401 failures. These explicit log calls bypassed the redaction that@handle_db_errorsprovides.Fix: Converted all f-string log messages to static strings — e.g.,
f'patch_play - Bad Token: {token}'→'patch_play - Bad Token'.Files Changed
22 router files under
app/routers_v3/:stratplay/crud.py,sbaplayers.py,draftlist.py,divisions.py,views.py,decisions.py,stratgame.py,awards.py,standings.py,pitchingstats.py,current.py,battingstats.py,managers.py,transactions.py,keepers.py,schedules.py,injuries.py,custom_commands.py,draftpicks.py,results.py,help_commands.py,draftdata.pyTests
No test suite for this repo — verified by grepping that no remaining
Bad Token.*{token}interpolations exist in any router file.Closes #35
AI Code Review
Files Reviewed
app/routers_v3/awards.py(modified)app/routers_v3/battingstats.py(modified)app/routers_v3/current.py(modified)app/routers_v3/custom_commands.py(modified)app/routers_v3/decisions.py(modified)app/routers_v3/divisions.py(modified)app/routers_v3/draftdata.py(modified)app/routers_v3/draftlist.py(modified)app/routers_v3/draftpicks.py(modified)app/routers_v3/help_commands.py(modified)app/routers_v3/injuries.py(modified)app/routers_v3/keepers.py(modified)app/routers_v3/managers.py(modified)app/routers_v3/pitchingstats.py(modified)app/routers_v3/results.py(modified)app/routers_v3/sbaplayers.py(modified)app/routers_v3/schedules.py(modified)app/routers_v3/standings.py(modified)app/routers_v3/stratgame.py(modified)app/routers_v3/stratplay/crud.py(modified)app/routers_v3/transactions.py(modified)app/routers_v3/views.py(modified)Findings
Correctness
f'... - Bad Token: {token}'are replaced with equivalent static strings. No logic is altered.Bad Token.*{token}interpolation inrouters_v3/appears in this diff — no occurrences were missed.sbaplayers.pyuses the module-levellogging.warning(rather than the locallogger.warningused elsewhere); the fix correctly handles both styles.Security
/tmp/sba-database.log), bypassing any redaction performed by@handle_db_errors. The static-string approach correctly eliminates this exposure with no functional side-effects.Style & Conventions
Suggestions
awards.pylogs'patch_player - Bad Token'inpatch_award/post_award/delete_award;results.pyuses'patch_player - Bad Token'inpost_results;views.pylogs'refresh_season_batting_stats - Bad Token'insiderefresh_season_pitching_stats). These bugs predate this PR and are out of scope here, but worth a follow-up cleanup for easier log triage.Verdict: APPROVED
Security fix is correct, complete, and minimal in scope. All 22 files are covered with no regressions introduced. Note: Gitea prevented a formal approval (cannot self-approve), but this review is a clean pass.
Automated review by Claude PR Reviewer
Checkout
From your project repository, check out a new branch and test the changes.