fix(feed_routes): add input validation, config logging, and exception handling (M7)#6309
Open
waefrebeorn wants to merge 36 commits into
Open
fix(feed_routes): add input validation, config logging, and exception handling (M7)#6309waefrebeorn wants to merge 36 commits into
waefrebeorn wants to merge 36 commits into
Conversation
Adds max_length parameter to _clean_string_field and caps all user input fields in POST route handlers: - /lock: sender_wallet(128), target_wallet(128), tx_hash(128), receipt_signature(256) - /confirm: proof_ref(256), notes(1024) - /release: release_tx(128), notes(1024) Prevents storage of arbitrarily large strings in bridge_ledger DB.
…s + Row M error handling + Row T test gaps + Row E infrastructure
…rawals (M6) M6 - MED: payout_worker.py: cleanup_old_withdrawals file descriptor leak on archive - Archive file now uses proper path (archives/ dir next to DB) instead of CWD-relative - Uses .jsonl extension for append-log format - f.flush() after each row ensures data is persisted before DB deletion - OSError catch on file write prevents data loss: aborts without deleting DB - Separate error handling for DB prune so inconsistency is logged but graceful - Explicit column selection instead of SELECT * for maintainability
… handling (M7) Three error handling gaps in bottube_feed_routes.py: 1. _parse_feed_limit: int(raw_limit) crashes with 500 on non-integer input like ?limit=abc. Wrapped in try/except ValueError/TypeError — returns default on invalid input. 2. _get_db_connection: returns None silently when DB_PATH is missing. Added logger.warning to make misconfiguration discoverable. 3. feed_index route: missing try/except around _fetch_videos() call. rss_feed and atom_feed endpoints were protected by their outer try/except blocks, but feed_index only wrapped _parse_feed_limit.
jaxint
approved these changes
May 25, 2026
Contributor
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Great work on this PR. 🚀
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
M7 — MED: bottube_feed_routes.py has 3 error handling gaps
Fix 1:
_parse_feed_limitcrashes on non-integer inputint(raw_limit)raised ValueError on?limit=abc, crashing the endpoint with 500. Wrapped in try/except — returns default on invalid input./api/feed?limit=abc→ HTTP 500/api/feed?limit=abc→ uses default limit=20Fix 2:
_get_db_connectionsilent misconfigurationReturns None when DB_PATH is not configured, causing silent fallback to mock data. Added logger.warning so operators can detect the issue.
Fix 3:
feed_indexroute missing exception handlingrss_feed()andatom_feed()had outer try/except blocks, but the auto-detectfeed_index()route only wrapped_parse_feed_limit—_fetch_videos()could crash unhandled. Added proper try/except with logging and 500 response.Testing
RTC Wallet for bounty:
RTC17c0d21f04f6f65c1a85c0aeb5d4a305d57531096