Skip to content

fix(#5550): quick fix#5555

Closed
weilixiong wants to merge 1 commit into
Scottcjn:mainfrom
weilixiong:fix-5550-server-proxy
Closed

fix(#5550): quick fix#5555
weilixiong wants to merge 1 commit into
Scottcjn:mainfrom
weilixiong:fix-5550-server-proxy

Conversation

@weilixiong
Copy link
Copy Markdown
Contributor

Fixes #5550

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/S PR: 11-50 lines labels May 17, 2026
Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@508704820
Copy link
Copy Markdown
Contributor

Security Review ✅

Quick fix follow-up to #5550 (server proxy error masking). Minor correction.

Reviewed by Xeophon - Solana: Lt9nERv6VHsojw15LpFeiaabuphAggzfLF9sM9UXRrZ

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the contribution.

Copy link
Copy Markdown
Contributor

@kekehanshujun kekehanshujun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this as part of the #73 code review bounty.

Findings:

  1. Scope mismatch: the PR says Fixes #5550 (server proxy redaction), but it also changes node/beacon_x402.py and otc-bridge/otc_bridge.py. Those hunks are unrelated to the server proxy issue and overlap with the #5549/#5554/#5556 changes, so this PR is likely to create avoidable conflicts and an unclear review surface. Please keep this PR to node/server_proxy.py or split the unrelated changes.
  2. The server proxy redaction itself needs a focused regression test. A small test can monkeypatch requests.get to raise an exception containing an internal URL/path and assert /proxy/... returns Local server unavailable without echoing the exception text.
  3. The new logging call keeps useful diagnostics, but if upstream exceptions can include full URLs with query strings, logs may still capture secrets. Consider logging exception type plus route/path separately, or sanitizing query strings before writing the message.

I received RTC compensation for this review.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work on this PR. 🚀

Copy link
Copy Markdown

@TJCurnutte TJCurnutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tightening these follow-up paths. I can verify the proxy redaction, missing-contracts fallback, and OTC non-object guard, but I cannot approve this yet because the beacon relay wallet fallback still throws on sqlite3.Row.

Validation run on head 2a5af2101828ccc0fa105110f267ecea94e736d8:

  • git diff --check origin/main...HEAD -- node/beacon_x402.py node/server_proxy.py otc-bridge/otc_bridge.py
  • /private/tmp/rustchain-review-5555-venv/bin/python -B -m py_compile node/beacon_x402.py node/server_proxy.py otc-bridge/otc_bridge.py
  • PYTHONPATH=. /private/tmp/rustchain-review-5555-venv/bin/python -B -m pytest -q -o addopts='' --noconftest tests/test_beacon_x402_wallet.py tests/test_otc_bridge_query_validation.py --tb=short12 passed in 0.23s
  • Temp Flask/SQLite probes:
    • /api/premium/contracts/export with no contracts table returned 200 and {'total': 0, 'contracts': []}.
    • node.server_proxy with requests.get raising RuntimeError('SECRET_UPSTREAM_DETAIL_SHOULD_NOT_LEAK') returned 502 and {'error': 'Local server unavailable'}.
    • POST /api/orders with a top-level JSON array returned 400 and {'error': 'expected JSON object'} after init_db().
    • GET /api/agents/relay1/wallet with a relay_agents row still returned 500.

Blocking issue:
node/beacon_x402.py:257 still does relay.get("coinbase_address"), but the app opens SQLite with conn.row_factory = sqlite3.Row, and sqlite3.Row has no .get(). The runtime probe hit:

AttributeError: 'sqlite3.Row' object has no attribute 'get'
  File "node/beacon_x402.py", line 257, in get_agent_wallet
    if relay and relay.get("coinbase_address"):

Please convert the relay row before checking it (relay_dict = dict(relay)) or index it like the native-wallet path, and add a regression for /api/agents/<id>/wallet resolving a wallet from relay_agents. That fallback is still a 500 for a valid relay wallet row, so I am requesting changes.

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@weilixiong
Copy link
Copy Markdown
Contributor Author

Hi @TJCurnutte, could you take a look at this PR when you have a moment? Thanks!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Copy Markdown
Contributor

@HCIE2054 HCIE2054 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Scottcjn
Copy link
Copy Markdown
Owner

Identical duplicate of PR #5554, both shadow-copy #5549 with the same scope-exploded baggage (node/server_proxy.py:64 + otc-bridge/otc_bridge.py:434). Closing per Codex forensic audit (2026-05-18); #5549 is the canonical first-poster.

@Scottcjn Scottcjn closed this May 18, 2026
@Scottcjn Scottcjn mentioned this pull request May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) node Node server related size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants