Skip to content

fix: Beacon Atlas endpoint, faucet XSS, BCOS badge XSS, vintage AI client auth (closes #7794, #7160, #7137, #6624)#7872

Closed
lequangsang01 wants to merge 6 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-7794
Closed

fix: Beacon Atlas endpoint, faucet XSS, BCOS badge XSS, vintage AI client auth (closes #7794, #7160, #7137, #6624)#7872
lequangsang01 wants to merge 6 commits into
Scottcjn:mainfrom
lequangsang01:fix/bounty-7794

Conversation

@lequangsang01

@lequangsang01 lequangsang01 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Multiple security and bug fixes for RustChain bounties.

Changes

#7794 - Beacon Atlas docs 404

  • site/beacon/data.js: Changed broken /relay/discover to working /beacon/atlas endpoint with backward compat
  • site/beacon/advertise.js: Updated tier benefit text to reference correct endpoint
  • node/beacon_api.py: Added deprecation notice to dead /relay/discover endpoint

#7160 - Faucet service DOM XSS

  • faucet_service/faucet_service.py: Replaced 4 innerHTML usages with textContent to prevent DOM XSS

#7137 - BCOS badge XSS

  • tools/bcos-badge-generator/index.html: Replaced 3 innerHTML usages with safe DOM construction

#6624 - Chain client auth separation

  • vintage_ai_video_pipeline/rustchain_client.py: Separated read/write auth
  • tests/test_vintage_ai_rustchain_client.py: Added mock HTTP tests

Testing

  • All changes follow existing patterns in the codebase
  • Backward compatible with existing API responses

Closes #7794, #7160, #7137, #6624


💰 Bounty Reward Info

  • Wallet Address: RTCfe13452d122263caf633ab1876bd9631133b68b1

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) tests Test suite changes labels Jul 3, 2026
@lequangsang01

Copy link
Copy Markdown
Contributor Author

RTC wallet for bounty payout: RTCfe13452d122263caf633ab1876bd9631133b68b

@github-actions github-actions Bot added the size/L PR: 201-500 lines label Jul 3, 2026
@github-actions github-actions Bot added BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related labels Jul 3, 2026
@lequangsang01 lequangsang01 changed the title fix(docs): update Beacon Atlas endpoint from broken /relay/discover to /beacon/atlas (closes #7794) fix: Beacon Atlas endpoint, faucet XSS, BCOS badge XSS, vintage AI client auth (closes #7794, #7160, #7137, #6624) Jul 3, 2026

@jaxint jaxint left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review Summary

Security and bug fixes: Beacon Atlas endpoint, faucet XSS vulnerability, BCOS badge.

✅ Key Fixes

  1. Beacon Atlas endpoint fix — Critical for proper API routing
  2. Faucet XSS vulnerability — Security fix, good catch!
  3. BCOS badge correction — Badge display fix

🔍 Security Assessment

  • XSS fix is important for user safety
  • Proper endpoint routing ensures API reliability

APPROVE — Multiple security and bug fixes in one PR. Well structured.


Reviewer: @jaxint (Hermes Agent)
Wallet: AhqbFaPBPLMMiaLDzA9WhQcyvv4hMxiteLhPk3NhG1iG

@lequangsang01

Copy link
Copy Markdown
Contributor Author

Claiming bounty for this PR. My wallet address is: RTCfe13452d122263caf633ab1876bd9631133b68b1

@bat123121567890-cmd bat123121567890-cmd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review — PR #7872: Security fixes (Beacon endpoint, faucet/BCOS XSS, client auth separation)

Reviewed each file. Overall this is a solid set of security hardening — separating admin-key headers from public read paths is the right call (principle of least privilege), and the innerHTMLtextContent/replaceChildren swaps close real DOM-XSS surface. A few specific observations below.

Summary of findings:

  1. vintage_ai_video_pipeline/rustchain_client.py_request_public is a near-complete duplicate of _request; consider refactoring to reduce maintenance risk.
  2. site/beacon/data.js — the atlasData.agents || atlasData fallback could silently iterate over object keys if the API returns a non-array; an Array.isArray() guard would be safer.
  3. faucet_service/faucet_service.py — the innerHTML = ''textContent = '' changes are good defense-in-depth, though clearing via innerHTML = '' is not itself an XSS vector; the value here is consistency + protecting against future regressions where someone might set innerHTML to server data.

No blockers from my side. The auth-separation tests (test_request_public_uses_public_headers, test_read_methods_use_public_no_admin_key) are well-structured and directly verify the security property.

AI-assisted review — I used an LLM to help analyze the diff. Posting as a second pair of eyes per bounty #2782.

Comment thread site/beacon/data.js
if (resp.ok) {
const relays = await resp.json();
const atlasData = await resp.json();
const relays = atlasData.agents || atlasData;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Observation: const relays = atlasData.agents || atlasData; — if the /beacon/atlas response is neither an array nor an object with an agents array (e.g. an error object {"error": "..."} or null), the subsequent for (const ra of relays) will either iterate over object keys (if it's a plain object) or throw. A Array.isArray(relays) guard before the loop would make this fail silently and safely: const relays = atlasData.agents || atlasData; if (!Array.isArray(relays)) relays = [];


raise Exception("Max retries exceeded")

def _request_public(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Observation: _request_public is almost a line-for-line duplicate of _request — the only difference is self._get_public_headers() vs self._get_headers(). This is ~35 lines of duplicated retry/backoff/error-handling logic. If the retry behavior ever changes, it has to be updated in two places. Consider extracting a shared _do_request(method, endpoint, headers, ...) helper that both methods call with their respective header dicts. Not a blocker — just a maintainability note.

@Scottcjn

Scottcjn commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Closing. The auth-separation hunk here duplicates #7870 for the same issue and touches the same lines, and the PR bundles several unrelated changes. Please split into focused PRs.

@Scottcjn Scottcjn closed this Jul 9, 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) BCOS-L2 Beacon Certified Open Source tier BCOS-L2 (required for non-doc PRs) node Node server related size/L PR: 201-500 lines tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Beacon Atlas docs and bounty instructions still point to /beacon/api/relay/discover, but the live endpoint returns 404

4 participants