Skip to content

Fix DOM XSS vulnerabilities in control-detail.html#14760

Merged
jan-cerny merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:fix-14758
Jun 4, 2026
Merged

Fix DOM XSS vulnerabilities in control-detail.html#14760
jan-cerny merged 1 commit into
ComplianceAsCode:masterfrom
ggbecker:fix-14758

Conversation

@ggbecker
Copy link
Copy Markdown
Member

@ggbecker ggbecker commented Jun 3, 2026

Description:

  • Fix DOM XSS vulnerabilities in control-detail.html
    • Replace innerHTML string interpolation with DOM API calls to prevent unsanitized URL parameters and localStorage data from executing as HTML.

Rationale:

Review Hints:

Testing the NIST Control Viewer

The OSCAL catalog data is already present under utils/nist_sync/data/.

Generate the HTML files
cd /path/to/content
python3 utils/nist_sync/generate_nist_viewer.py \
    --output-dir /tmp/nist-viewer \
    --products rhel9
Open in a browser
open /tmp/nist-viewer/rhel9/index.html

Or navigate directly to a control:

file:///tmp/nist-viewer/rhel9/control-detail.html?id=ac-1
Verify the XSS fix

####### URL parameter injection

Navigate to the following URL and confirm the payload renders as plain text, with no alert dialog:

file:///tmp/nist-viewer/rhel9/control-detail.html?id=<img src=x onerror=alert(1)>

Expected: the "not found" message displays the literal string <img src=x onerror=alert(1)>.

Todo input injection
  1. Open a valid control page, e.g. ?id=ac-1.

  2. Add a todo item with the following text:

    <img src=x onerror=alert(1)>
    
  3. Confirm the item appears as plain text in the list with no script execution.

Replace innerHTML string interpolation with DOM API calls to prevent
unsanitized URL parameters and localStorage data from executing as HTML.
@ggbecker ggbecker added this to the 0.1.82 milestone Jun 3, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 3, 2026

@ggbecker: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-platform-compliance 64982f2 link true /test e2e-aws-openshift-platform-compliance
ci/prow/e2e-aws-openshift-node-compliance 64982f2 link true /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jan-cerny jan-cerny self-assigned this Jun 4, 2026
Copy link
Copy Markdown
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

I reproduced the vulnerabilities, then, I checked out this PRs branch and I verified that the vulnerabilities stopped occurring.

@jan-cerny jan-cerny merged commit 0db6841 into ComplianceAsCode:master Jun 4, 2026
64 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTML controls viewer uses unsanitized input

2 participants