Skip to content

Add integrity hashes for remote scripts and stylesheets #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Mar 17, 2025

Why these changes are being introduced:

It's good practice to validate checksums for external libraries. We've done this in individual apps, but it makes sense to make the change in the theme gem.

Relevant ticket(s):

How this addresses that need:

This adds integrity, crossorigin, and referrerpolicy attributes for remotely hosted scripts and stylesheets.

Side effects of this change:

I'm not totally sure how to exhaustively test these changes. I've confirmed that the scripts/stylesheets load as expected, and checked the changes locally in a few of our apps. That feels like enough, but just signaling the uncertainty here in case the reviewer has additional insight.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

Why these changes are being introduced:

It's good practice to validate checksums for external libraries.
We've done this in individual apps, but it makes sense to make
the change in the theme gem.

Relevant ticket(s):

* [ENGX-290](https://mitlibraries.atlassian.net/browse/ENGX-290)

How this addresses that need:

This adds `integrity`, `crossorigin`, and `referrerpolicy`
attributes for remotely hosted scripts and stylesheets.

Side effects of this change:

I'm not totally sure how to exhaustively test these changes. I've
confirmed that the scripts/stylesheets load as expected, and
checked the changes locally in a few of our apps. That feels like
enough, but just signaling the uncertainty here in case the
reviewer has additional insight.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13910011954

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.372%

Totals Coverage Status
Change from base Build 8440026403: 0.0%
Covered Lines: 38
Relevant Lines: 43

💛 - Coveralls

Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

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

Doh, I missed this PR. Sorry for the delay!

@jazairi
Copy link
Contributor Author

jazairi commented Mar 31, 2025

No worries, thanks for the review!

@jazairi jazairi merged commit f1b5f63 into main Mar 31, 2025
2 checks passed
@jazairi jazairi deleted the add-integrity-hashes branch March 31, 2025 15:15
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.

3 participants