-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Fix some mako-missing-default xsslint issues in test files. #16709
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| <%page expression_filter="h"/> | ||
| # intentionally left blank |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| <%page expression_filter="h"/> | ||
| # intentionally left blank |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| <%page expression_filter="h"/> | ||
| # intentionally left blank |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| <%page expression_filter="h"/> | ||
| # intentionally left blank |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/courseware/syllabus.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/courseware/test_absolute_path.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| ## mako | ||
| <%page expression_filter="h"/> | ||
| <%namespace name='static' file='/static_content.html'/> | ||
| <div>Microsite absolute path template contents</div> |
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/courseware/test_relative_path.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| ## mako | ||
| <%page expression_filter="h"/> | ||
| <%namespace name='static' file='/static_content.html'/> | ||
| <div>Microsite relative path template contents</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
common/test/test_sites/test_site/templates/register-sidebar.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/static_templates/about.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/static_templates/contact.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/static_templates/copyright.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| <%page expression_filter="h"/> | ||
| This is a copyright page for an Open edX site. |
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/static_templates/faq.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
common/test/test_sites/test_site/templates/static_templates/tos.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| <%page expression_filter="h"/> | ||
| <html> | ||
| <head> | ||
| <title>Payment Error</title> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| <%page expression_filter="h"/> | ||
| <html> | ||
| <head><title>Payment Form</title> | ||
| </head> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jzoldak: I'd be surprised if HTML-escaping wouldn't need to be turned off for
${parent.body()}. I didn't review all these files individually, but just a note that some care needs to go into adding default HTML-escaping, except of course on empty templates like some of these.Additionally, we should really bring down the threshold on this rule once the dust settles, or people may introduce new templates without this page expression, which is what we want to protect against (i.e. new issues).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. In this case this is just a test file, so it should be OK, but we should definitely be following best practices moving forward given this situation we ran into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @UmanShahzad. A couple of additional details:
https://github.com/edx/edx-platform/pull/16723#issuecomment-348235004
He is upping the thresholds in the following PR, but it would have been nice to not have added new issues:
https://github.com/edx/edx-platform/pull/16723
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: You can see the violations for all files you touched here:
https://build.testeng.edx.org/job/edx-platform-quality-pr/43752/artifact/edx-platform/reports/xsscommitlint/xsscommitlint.report/*view*/
Some examples are:
As a separate discussion, we could debate whether
mako-unwanted-html-filtershould break the build or not since strictly speaking it isn't a problem. The problem is simply that if it isn't cleaned up by removing the| h, it makes it difficult to know what files are safe by default and which aren't, and which expressions are safe and which aren't.@efischer19: Maybe you can just fix these on your PR, rather than upping the threshold?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case this isn't fixed as part of @efischer19's PR, the other failure that could be cleaned up is:
We could then adjust the thresholds back down.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is I had no clue I was introducing these violations with this PR. You can tell at a glance for things like pylint or pep8, but it doesn't seem obvious at all (to me and maybe others) with xsslint reporting atm. Reporting should be improved to show the specific errors a particular PR introduces and nothing more, to keep it simple and prevent something like this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UmanShahzad: Agreed. It used to tell you which thresholds were breaking, but now that is hard to see. See this comment and following comments for a discussion of this:
https://github.com/edx/edx-platform/pull/16719#issuecomment-348209133
FYI: @jzoldak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. It seems like @UmanShahzad got "hit" by this because he touched a file to improve it, then the tooling started reporting all the previously un-reported errors that existed in that file. It feels like we're punishing good intentions to some degree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@efischer19: It's a little different from the way you describe it. It's not that you get hit by tooling for touching a file. It is that when you add HTML-escaping by default to the top of a file it affects all expressions in that template, and sometimes new problems appear. So, some care is needed when adding HTML-escaping by default. You can't just drop it in to any template that doesn't have it without this care, or we would have done that to get rid of these violations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay - that does make more sense. Thanks!