Skip to content

Add subresource integrity attribute to Bootstrap CDN link#1

Open
semgrep-code-barry7985[bot] wants to merge 1 commit into
mainfrom
semgrep-autofix/1784134329
Open

Add subresource integrity attribute to Bootstrap CDN link#1
semgrep-code-barry7985[bot] wants to merge 1 commit into
mainfrom
semgrep-autofix/1784134329

Conversation

@semgrep-code-barry7985

Copy link
Copy Markdown

Add subresource integrity (SRI) attribute to the Bootstrap CSS CDN link in the account creation template to prevent potential tampering.

Changes

  • Added integrity attribute with the sha384 hash for bootstrap@5.3.2 CSS to accounts/templates/accounts/creation.html
  • Added crossorigin="anonymous" attribute required for SRI validation on cross-origin resources

Why

Without the integrity attribute, the browser cannot verify that the externally hosted Bootstrap CSS file has not been tampered with. If an attacker compromises the CDN or performs a man-in-the-middle attack, they could inject malicious content leading to XSS or other attacks. The SRI hash ensures the browser only applies the stylesheet if its content matches the expected cryptographic hash.

Semgrep Finding Details

This tag is missing an 'integrity' subresource integrity attribute. The 'integrity' attribute allows for the browser to verify that externally hosted files (for example from a CDN) are delivered without unexpected manipulation. Without this attribute, if an attacker can modify the externally hosted resource, this could lead to XSS and other types of attacks. To prevent this, include the base64-encoded cryptographic hash of the resource (file) you're telling the browser to fetch in the 'integrity' attribute for all externally hosted files.

brry00802@gmail.com requested this Autofix PR for this finding from the detection rule html.security.audit.missing-integrity.missing-integrity.


⚠️ Review carefully before merging. This PR was generated by AI and may cause breaking changes or introduce new vulnerabilities.

Add subresource integrity (SRI) attribute to the Bootstrap CSS CDN link in the account creation template to prevent potential tampering.

## Changes
- Added `integrity` attribute with the sha384 hash for bootstrap@5.3.2 CSS to `accounts/templates/accounts/creation.html`
- Added `crossorigin="anonymous"` attribute required for SRI validation on cross-origin resources

## Why
Without the `integrity` attribute, the browser cannot verify that the externally hosted Bootstrap CSS file has not been tampered with. If an attacker compromises the CDN or performs a man-in-the-middle attack, they could inject malicious content leading to XSS or other attacks. The SRI hash ensures the browser only applies the stylesheet if its content matches the expected cryptographic hash.

## Semgrep Finding Details
This tag is missing an 'integrity' subresource integrity attribute. The 'integrity' attribute allows for the browser to verify that externally hosted files (for example from a CDN) are delivered without unexpected manipulation. Without this attribute, if an attacker can modify the externally hosted resource, this could lead to XSS and other types of attacks. To prevent this, include the base64-encoded cryptographic hash of the resource (file) you're telling the browser to fetch in the 'integrity' attribute for all externally hosted files.

brry00802@gmail.com requested this Autofix PR for [this finding](https://semgrep.dev/orgs/brry00802_personal_org/findings/890338735) from the detection rule [html.security.audit.missing-integrity.missing-integrity](https://semgrep.dev/r/html.security.audit.missing-integrity.missing-integrity).
@Barry7985
Barry7985 marked this pull request as ready for review July 15, 2026 16:55
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.

0 participants