fix: redact bot_access_tokens from the debug logs of socket mode#1519
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1519 +/- ##
=======================================
Coverage 84.89% 84.89%
=======================================
Files 112 113 +1
Lines 12473 12480 +7
=======================================
+ Hits 10589 10595 +6
- Misses 1884 1885 +1 ☔ View full report in Codecov by Sentry. |
seratch
left a comment
There was a problem hiding this comment.
Thanks for working on this! The change looks good to me but here is a minor suggestion on naming
| import re | ||
|
|
||
|
|
||
| def debug_message_redact(message: str) -> str: |
There was a problem hiding this comment.
It seems that you followed this file and method naming: https://github.com/slackapi/bolt-python/blob/main/slack_bolt/logger/messages.py The format is more of "{log_level}_{log meaning}", thus "debug_redacted_message_string" or something like that would be even better. What do you think?
| def debug_message_redact(message: str) -> str: | |
| def debug_redacted_message_string(message: str) -> str: |
There was a problem hiding this comment.
Agreed 👍 I like debug_redacted_message_string
Summary
This PR modified the behavior of
socket modein order to redactbot_access_tokensout of thedebuglogsSince the raw payload message is printed, I implemented a
regexbased solution, this feels less then idea for maintainability purposes, let me know if there are other better alternatives to thisCategory (place an
xin each of the[ ])/docs-src(Documents, have you run./scripts/docs.sh?)/docs-src-v2(Documents, have you run./scripts/docs-v2.sh?)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements (place an
xin each[ ])python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.