fix(rwa): validate --rpc-url scheme in rwa_lookup.py (#968) - #979
fix(rwa): validate --rpc-url scheme in rwa_lookup.py (#968)#979Tiktokaiagent wants to merge 2 commits into
Conversation
|
@andreapn gentle bump — still mergeable, all CI green, ready for review whenever you have time. Thanks! |
andreapn
left a comment
There was a problem hiding this comment.
The rwa_lookup.py change is the right one: urlsplit-based scheme + host validation enforced at both _rpc_batch() and main(), and the three # noqa: S310 comments corrected. Verified locally — reverting only rwa_lookup.py fails 30 of the 39 new tests, so they are genuinely coupled to the fix.
One blocker, in CHANGELOG.md:
-
The entry is malformed. Both lines lost their code spans, so the sentence has no subject:
- now validates the --rpc-url scheme via _validate_rpc_url and rejects any URL outside {http, https}, preventing local file reads (#968). -
It does not land under
[Unreleased]. The branch was cut before the 2026.9.4 release. A trial merge into currentmainplaces these lines atCHANGELOG.md:204— inside the already-shipped## [2026.9.3]section.
Please rebase onto main and either rewrite the entry under [Unreleased] → ### Security with the subject restored, or drop CHANGELOG.md from the PR (several recent bundled-skill fixes shipped without one). The source and test changes need no further work.
a21db43 to
76412e5
Compare
|
Fixed as requested:
Please take another look when you have time. |
Summary
The lookup script passed
--rpc-urlstraight intourllib.request.urlopenwithout scheme validation, allowing file:// and other non-http(s) schemes to read arbitrary local files when invoked from an agent context.Fix
_validate_rpc_url()usingurlsplitthat rejects any scheme outside {http, https}_rpc_batch()(line 222) andmain()before any network use# noqa: S310comments to document the validated endpointCloses #968
Testing
39 deterministic regression tests:
test_url_valveTestRpcBatch_rpc_batchvalidates at call siteTestMainClimain()validation via CLI exit code 2TestEdgeCasesTestS310Suppression# noqa: S310has documented endpointQuality gate
ruff check src tests— passeduv run pytest tests/test_skills/test_rwa_lookup_rpc_url.py -v --tb=short— 39 passeduv build --wheel— passed