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

CmsKit - PreventXSS Enhancement #17681

Merged
merged 5 commits into from
Sep 21, 2023
Merged

CmsKit - PreventXSS Enhancement #17681

merged 5 commits into from
Sep 21, 2023

Conversation

enisn
Copy link
Member

@enisn enisn commented Sep 20, 2023

Description

Resolves #17677

PreventXSS feature was enabled by default for all contents. It's a problem while adding javascript to the CMS Application and trying to call any function from that javascript.

Now, it doesn't work everywhere by default. It'll work on the following conditions after this PR:

  • Pages: Disabled by default.
  • Blogs: Enabled by default. (Configurable per Blog)
  • Comments: Enabled by default

preventxss

Checklist

  • I fully tested it as developer / designer and created unit / integration tests
  • I documented it (or no need to document or I will create a separate documentation issue)

How to test it?

  1. Add the following script by using Global Resources
function sayHello(){
  alert('Hello');
}
  1. Create a Page or BlogPost with the following button
 <button class="btn btn-primary" onclick="sayHello()">Click me</button>

Page should work by default, BlogPost shouldn't work until you disable PreventXSS feature for blog.

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #17681 (3d8fda7) into dev (4818c55) will decrease coverage by 0.02%.
The diff coverage is 72.72%.

@@            Coverage Diff             @@
##              dev   #17681      +/-   ##
==========================================
- Coverage   53.51%   53.49%   -0.02%     
==========================================
  Files        3037     3037              
  Lines       94913    94917       +4     
==========================================
- Hits        50795    50779      -16     
- Misses      44118    44138      +20     
Files Changed Coverage Δ
...ontracts/Volo/CmsKit/Contents/DefaultContentDto.cs 0.00% <0.00%> (ø)
...sKit.Domain.Shared/Volo/CmsKit/Blogs/BlogConsts.cs 100.00% <ø> (ø)
...msKit/GlobalFeatures/BlogPostScrollIndexFeature.cs 100.00% <ø> (ø)
...in/Volo/CmsKit/Blogs/DefaultBlogFeatureProvider.cs 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@EngincanV EngincanV merged commit 54fb416 into dev Sep 21, 2023
3 of 4 checks passed
@EngincanV EngincanV deleted the cmskit-content-rendering branch September 21, 2023 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CmsKit - Use PreventXSS only for comments
2 participants