Skip to content
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

Remove inline scripts from scraped articles #2111

Merged
merged 2 commits into from
Dec 15, 2024
Merged

Conversation

audiodude
Copy link
Member

Fixes #2096

Simply find and remove all script tags from scraped HTML when rendering the article. This doesn't affect "module dependencies", because they are calculated before and re-added later.

@audiodude audiodude requested a review from Jaifroid December 5, 2024 01:30
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.26%. Comparing base (5388d72) to head (ba5e4e1).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2111      +/-   ##
==========================================
+ Coverage   75.24%   75.26%   +0.02%     
==========================================
  Files          41       41              
  Lines        3195     3198       +3     
  Branches      706      706              
==========================================
+ Hits         2404     2407       +3     
  Misses        674      674              
  Partials      117      117              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kelson42 kelson42 force-pushed the remove-inline-script branch from e8aef14 to 7276d45 Compare December 10, 2024 19:13
@audiodude audiodude force-pushed the remove-inline-script branch from 7276d45 to 15a9e0a Compare December 14, 2024 16:20
Copy link
Collaborator

@Jaifroid Jaifroid left a comment

Choose a reason for hiding this comment

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

Other than the caveat mentioned, and if the risk is acceptable, the code looks fine to me!

src/renderers/abstract.renderer.ts Show resolved Hide resolved
@audiodude audiodude merged commit 126f486 into main Dec 15, 2024
6 checks passed
@audiodude audiodude deleted the remove-inline-script branch December 15, 2024 01:17
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.

REGRESSION: Remove new inline JS from ZIMs produced by dev (at least 1.14.0) to comply with restrictive CSPs
2 participants