Skip to content

fix: replace innerHTML with textContent to prevent DOM XSS [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]#8036

Merged
Scottcjn merged 1 commit into
Scottcjn:mainfrom
waterWang:fix/faucet-xss
Jul 25, 2026
Merged

fix: replace innerHTML with textContent to prevent DOM XSS [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]#8036
Scottcjn merged 1 commit into
Scottcjn:mainfrom
waterWang:fix/faucet-xss

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Replaces all 4 occurrences of result.innerHTML = "" with result.textContent = "" in faucet_service.py.

Problem

The faucet service JavaScript code uses result.innerHTML = "" to clear a <div> before appending new DOM nodes. While the actual dynamic content is safely set via textContent and createTextNode (which are not vulnerable to XSS), using innerHTML for the reset is inconsistent with the security pattern used elsewhere and could be a maintenance risk if future code adds user-controlled content to the innerHTML assignment.

Fix

Replaced all 4 occurrences of result.innerHTML = "" with result.textContent = "" (lines 1598, 1614, 1630, 1643). This is more consistent with the rest of the codebase which already uses secure DOM manipulation methods (textContent, createTextNode, appendChild).

Closes #7160

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

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!

@github-actions github-actions Bot added BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/XS PR: 1-10 lines labels Jul 21, 2026
@waterWang waterWang changed the title fix: replace innerHTML with textContent to prevent DOM XSS fix: replace innerHTML with textContent to prevent DOM XSS [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] Jul 25, 2026
@Scottcjn
Scottcjn merged commit 8cd8388 into Scottcjn:main Jul 25, 2026
12 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

RTC Reward

This merged PR earned 5 RTC — sent to waterWang.

RustChain Bounty Program

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) size/XS PR: 1-10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden faucet service result rendering

2 participants