Sprint 1: Critical security and correctness fixes#12
Merged
Conversation
- Add config validation at startup (config.py) - Validates all required API keys, channel IDs, and paths - Raises clear ConfigurationError on missing/placeholder values - Exits with error message instead of cryptic runtime failures - Remove API key exposure from URLs (4 files) - steam_family.py: Use params= for wishlist API calls - plugin_admin_actions.py: Use params= for wishlist API calls - admin_commands.py: Use params= for owned games and wishlist API calls - common_game.py: Use params= for owned games API calls - Prevents API keys from leaking in logs, stack traces, or error messages - Task 1.3 (sync I/O wrapping): Already complete - All get_lowest_price calls already use asyncio.to_thread()
Owner
Author
|
Pushed additional fixes for remaining review findings:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements Sprint 1 of the implementation plan, addressing critical security and correctness issues.
Changes
Added ConfigurationError exception class
Added �alidate_config() function that checks:
Discord API key is not empty
Discord admin ID is a non-zero integer
Steamworks API key is not empty
ITAD API key is not empty
Family Steam ID is a non-zero integer
All channel IDs are non-zero integers
Token save path is not empty
Web UI port is valid (1-65535)
Validation runs at import time, exits with clear error message on failure
API keys were being embedded directly in URL strings, risking exposure in logs, stack traces, and error messages. Fixed by using the \params=\ argument in HTTP clients.
Files changed:
\src/familybot/plugins/steam_family.py\ — Wishlist API call
\src/familybot/lib/plugin_admin_actions.py\ — Wishlist API call
\src/familybot/lib/admin_commands.py\ — Owned games and wishlist API calls, added \params\ parameter to \make_request_with_retry()
\src/familybot/plugins/common_game.py\ — Owned games API call
3. Task 1.3: Sync I/O Wrapping
Verified that all \get_lowest_price()\ call sites already use \�syncio.to_thread()\ — no changes needed.
Testing
Config validation will now catch missing/placeholder values at startup
API keys no longer appear in URL strings
All existing functionality preserved
Documentation
Added \doc/IMPLEMENTATION_PLAN.md\ with full sprint plan organized by file