Skip to content

fix(#5551): quick fix#5556

Closed
weilixiong wants to merge 1 commit into
Scottcjn:mainfrom
weilixiong:fix-5551-otc-validation
Closed

fix(#5551): quick fix#5556
weilixiong wants to merge 1 commit into
Scottcjn:mainfrom
weilixiong:fix-5551-otc-validation

Conversation

@weilixiong
Copy link
Copy Markdown
Contributor

Fixes #5551

@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 #5551 (OTC order validation). 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

@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 the quick follow-up. I checked this against head 2a5af2101828ccc0fa105110f267ecea94e736d8.

Validation run:

  • git diff --check origin/main...HEAD -- node/beacon_x402.py node/server_proxy.py otc-bridge/otc_bridge.py
  • python3 -B -m py_compile node/beacon_x402.py node/server_proxy.py otc-bridge/otc_bridge.py
  • Flask test-client probe for POST /api/orders with a temp OTC_DB_PATH after init_db():
    • JSON array body now returns 400 {'error': 'expected JSON object'}.
    • ttl_seconds='abc' still returns a server 500 from ValueError: invalid literal for int() with base 10: 'abc' at ttl = int(data.get("ttl_seconds", ORDER_TTL_DEFAULT)).
    • ttl_seconds=1.5 is accepted with 201 and writes an order.
    • ttl_seconds=True is accepted with 201 and writes an order.

So the non-object body guard is good, but this does not fully close the ttl_seconds validation issue from #5551. The conversion still happens before typed validation, and int(...) both throws on bad strings and silently coerces bools/floats into a valid TTL. For this endpoint I would expect ttl_seconds to be absent or an actual integer value, with strings/floats/bools rejected as 400 before any order is created.

Also worth splitting if this PR is meant only to fix #5551: the same head includes Beacon x402 and server-proxy changes too, which makes the review/merge boundary less clear.

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 #5551 (OTC order validation), but 2 of the 3 changed files are unrelated Beacon x402 / server proxy changes. Those hunks appear to duplicate the #5549/#5554 work and will add merge noise for an OTC-only fix. Please narrow this PR to otc-bridge/otc_bridge.py, or retitle and re-scope it so reviewers know it is intentionally touching three different issues.
  2. The OTC change adds a non-object body guard, but there is no regression test for the reported failure mode ([], scalar JSON, invalid/huge ttl_seconds). Without that test coverage, the PR can still miss the #5551 acceptance path even if the one-line guard is correct.
  3. CI is currently red on the global pytest collection because required test dependencies are missing (aiohttp, flask_cors, matplotlib). That looks repository-wide rather than caused by this patch, but the PR should either document the unrelated failure or re-run once the dependency fix lands.

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
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 and #5555 — same scope-exploded patch on top of #5549. Per Codex forensic audit (2026-05-18); please consolidate work into #5549 rather than re-rolling the same diff.

@Scottcjn Scottcjn closed this 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