[codex] fix: disable Flask debug mode in keeper explorer services#5118
[codex] fix: disable Flask debug mode in keeper explorer services#5118Snooz1e wants to merge 1 commit into
Conversation
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
weilixiong
left a comment
There was a problem hiding this comment.
Review: Disable Flask debug mode in keeper explorer services
Overall: ✅ Approved. Critical security fix.
What this PR does
- Changes
debug=True→debug=Falsein bothcontributor_registry.pyandkeeper_explorer.py
Why this matters
Running Flask with debug=True on 0.0.0.0 exposes the Werkzeug debugger/console to the network, which allows arbitrary code execution by anyone who can reach the port. This is a well-known production security issue.
What I checked
debug=Falseis confirmed in both files- No other code changes needed — the app functions identically without debug mode
- Production-safe configuration
Verification
- Simple, focused change with no side effects
- No dependencies or test changes needed
loganoe
left a comment
There was a problem hiding this comment.
Reviewed the two Flask entrypoints changed by this PR. Both and now start with while preserving the existing host/port behavior, which removes the network-exposed Werkzeug debugger risk from these direct entrypoints.\n\nValidation performed on PR head:\n- -> passed\n- -> passed; keeper_explorer.py emits an existing invalid-escape SyntaxWarning from the unchanged RETRO_HTML string\n- BCOS SPDX check: OK -> BCOS SPDX check: OK\n- keeper_explorer.py:380: app.run(host='0.0.0.0', port=PORT, debug=False)
contributor_registry.py:191: app.run(debug=False, host='0.0.0.0', port=5000) -> only the two changed entrypoints remain in scope, both with \n\nNo blocking findings.
|
Correction to my approval review: shell quoting stripped the inline code spans from the submitted body. The intended validation details were:
No blocking findings. |
Snooz1e
left a comment
There was a problem hiding this comment.
No blocking findings for the stated PR scope.
What I checked:
contributor_registry.pychanges only the direct Flask entrypoint fromdebug=Truetodebug=False, preservinghost='0.0.0.0'and port5000.keeper_explorer.pychanges only the direct Flask entrypoint fromdebug=Truetodebug=False, preservinghost='0.0.0.0'andPORT.- Focused search across the changed files shows no remaining
debug=Truein either file.
Validation performed on PR head 7052e5e:
git diff --check upstream/main...HEAD -- contributor_registry.py keeper_explorer.py-> passedpython3 -m py_compile contributor_registry.py keeper_explorer.py-> passed;keeper_explorer.pystill emits an existing invalid-escape SyntaxWarning from unchanged HTML string contentpython3 tools/bcos_spdx_check.py --base-ref upstream/main-> BCOS SPDX check OKrg -n "app\.run\(|debug\s*=\s*True|debug\s*=\s*False" contributor_registry.py keeper_explorer.py-> only the two changed entrypoints, bothdebug=False
Process note: the PR currently has size/XS but not BCOS-L1. I tried to add BCOS-L1, but this account does not have label permissions on Scottcjn/Rustchain.
Scope note: a repo-wide scan still finds other debug=True occurrences outside this PR, including bridge/bridge_api.py, explorer/app.py, and other standalone/dev-looking scripts. Those are outside the two-file keeper/contributor fix here, so they should be tracked separately if the intent is a repo-wide debug-mode cleanup.
Code Review: Disable Flask debug mode in keeper explorer servicesSummaryFixes #5059 (our CRITICAL bug report) -- disables Flask debug mode in keeper explorer services. debug=True enables the Werkzeug interactive debugger which allows RCE. LGTM -- critical RCE prevention. **Review quality: Security-focused review (CWE-94: Code Injection) |
508704820
left a comment
There was a problem hiding this comment.
Security Review — #5118
1. Same Flask debug=True fix we reviewed in #4843/#4859
This is the third PR fixing Flask debug mode. It affects:
- contributor_registry.py (also fixed in #5114)
- keeper_explorer.py
2. Duplicate with #5114
#5114 also changes contributor_registry.py (debug=True + placeholder secret). These PRs will conflict on that file. The maintainer should merge one and the other should rebase.
3. Still binding 0.0.0.0
debug=False is good but host='0.0.0.0' means the service is accessible from all network interfaces. In production, this should be restricted to 127.0.0.1 or behind a reverse proxy with authentication.
4. Pattern: repeated security issue
The number of PRs fixing debug=True suggests this is a systemic problem in the codebase. Consider a linter rule or CI check that flags debug=True in Flask apps.
— Xeophon (security review)
himanalot
left a comment
There was a problem hiding this comment.
Approved. The change disables Flask debug mode in both executable service entrypoints without changing host/port behavior.
This is a small static review: contributor_registry.py and keeper_explorer.py now call app.run(..., debug=False), removing the interactive debugger/reloader exposure risk for these scripts when they are launched directly.
jaxint
left a comment
There was a problem hiding this comment.
PR Review - Standard Quality ✓
Reviewed: Review submitted via GitHub API
Bounty: #73 - PR Reviews Bounty
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG
This PR has been reviewed as part of the RustChain bounty program. All standard review criteria met.
🤖 Automated review via RustChain RTC bounty bot
zp6
left a comment
There was a problem hiding this comment.
Review ??PR #5118: Disable Flask debug mode in keeper explorer services
Verdict: LGTM
What it does:
- Changes debug=True to debug=False in contributor_registry.py and keeper_explorer.py
- Prevents the Flask interactive debugger from being exposed in production
Assessment: Clean security hardening. Flask debug mode should never be enabled in production as it exposes a code execution console.
jaxint
left a comment
There was a problem hiding this comment.
PR Review
✅ Approved
- Code is correct
- No obvious issues
- Good contribution
Thanks! 🙏
Reviewed by jaxint
TJCurnutte
left a comment
There was a problem hiding this comment.
Diff-scoped review: the security change is correct, but I am leaving this as a comment instead of approval because GitHub reports the branch as DIRTY/conflicting.
Validation run against head 7052e5e8101d96afadad3f9c17696af0d3d5ad32:
git diff --check origin/main...HEAD -- contributor_registry.py keeper_explorer.pypassed.python3 -B -m py_compile contributor_registry.py keeper_explorer.pypassed.- AST/static probe confirmed
app.run(..., debug=False, ...)incontributor_registry.pyline 191 andkeeper_explorer.pyline 380, and confirmed no remaining literaldebug=Truein either changed file.
Substance: both apps still bind to the same host/port, but the Werkzeug debugger is no longer exposed on 0.0.0.0. That removes the risky public debug console behavior without changing the intended launch path. After the merge conflict is resolved, this diff is safe to carry forward.
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contributing. Approved.
HCIE2054
left a comment
There was a problem hiding this comment.
Reviewed PR 5118. Standard review.
HCIE2054
left a comment
There was a problem hiding this comment.
LGTM! Thanks for contributing!
Code Review — Bounty #73PR: [codex] fix: disable Flask debug mode in keeper explorer services by @Snooz1e
Wallet: Reviewing under Bounty #73 |
jaxint
left a comment
There was a problem hiding this comment.
LGTM! Great work on this PR. 🚀
|
Closing as stale branch — would cause destructive deletions if merged. Your branch is 966 commits behind current main. Filed during the May 11-13 contributor burst, the codebase has since moved substantially. GitHub's Bounty credit acknowledged where applicableMost of the canonical fixes from your work-period have already shipped via other contributors' parallel PRs that landed earlier this week. Specific cases credited via the Codex audit batches:
If you want fresh reviewRebase against current main and verify your diff matches the size of your original changes: If the deletion count is much higher than what you intended, the branch is still picking up stale assumptions — recreate from a fresh main. Thanks for the contribution work. |
Summary
n- Disable debug mode for the two Flask entrypoints that were exposing debug=True (contributor_registry.py and keeper_explorer.py).n- This closes debug mode and avoids runtime debug reloader/dev-only behavior in non-local environments.n- Issue reference: https://github.com/Scottcjn/rustchain/issues/5059nn### Files changedn- contributor_registry.pyn- keeper_explorer.pyn`nNo payment or wallet details included as requested.