-
Notifications
You must be signed in to change notification settings - Fork 384
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
Experimental: Add sandboxing levels #6546
Merged
Merged
Changes from 56 commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
fb612c2
Add initial sandboxing levels
westonruter 73869b6
Opt-in to new script sanitizer and allowing post forms even in level 3
westonruter c1f6a7e
Prevent service from running during unit tests (for now)
westonruter 847b432
Fix AMP_Script_Sanitizer arg key
westonruter d615b57
Discontinue overloading data-ampdevmode in favor of specific flags fo…
westonruter 7aa81d6
Default sandboxing to off, requiring filter to enable instead of WP_D…
westonruter e988c54
Set order for sanitizers to run in
westonruter bb3d682
Prefer bento from script sanitizer when custom scripts kept
westonruter a9bab8a
Move logic to set unvalidated attrs to base removal methods
westonruter cfcd5d8
Dynamically switch to Bento when non-valid document and when Bento co…
westonruter e4e2301
Remove bento as automatically triggering dev mode
westonruter a163249
Add todos to revisit in future
westonruter a840c88
Conditionally add document.write override only if amp-live-list is in…
westonruter 7aa7d09
Introduce native_video_used arg for AMP_Video_Sanitizer
westonruter 12da9c7
Introduce native_audio_used arg for AMP_Audio_Sanitizer
westonruter 5570f16
Use native audio/video elements when custom scripts are kept
westonruter a6f2647
Indicate sandboxing level in AMP meta generator
westonruter 793beb4
Use native iframes when custom scripts are kept
westonruter 4fc05bc
Add test to ensure that the script sanitizer sets prefer_bento
westonruter f45aec6
Reduce code duplication
westonruter de4d94a
Initial success with comment reply links
westonruter d250f6f
Simplify state
westonruter bdc94ab
Focus on comment textarea when clicking on reply
westonruter e8f66e5
Remove commented-out code and add deprecations
westonruter 6245411
Update comment
westonruter 5d42136
Mark script output from wp_comment_form_unfiltered_html_nonce() as be…
westonruter 758c53a
Run core theme sanitizer before script sanitizer
westonruter 99893db
Greatly simplify thread_comments handling in comment sanitizer
westonruter 0295046
Only unwrap noscripts when no PX-verified scripts present either
westonruter ca10637
Prevent removal of PX-validated custom tags
westonruter 015bf10
Remove amp attribute from pages containing PX-verified attrs
westonruter f91fa9d
Rework form sanitizer to always leave POST forms alone or convert
westonruter cf2272b
Test keeping non-AMP custom elements and prevent double reporting
westonruter ade01cf
Remove completed todos
westonruter dad92a8
Fix typo in comments_live_list
westonruter a294249
Introduce ValidationExemption class to centralize AMP-unvalidated and…
westonruter 80fb303
Invert logic
westonruter da5a3ff
Improve test coverage of sanitizers and theme-support
westonruter b035e62
Add tests for remove_invalid_attribute
westonruter a5e94b0
Rewrite comments sanitizer tests
westonruter 8349c56
Add tests for AMP_Script_Sanitizer
westonruter b512764
Add coverage for replace_node_with_children_validation_errors
westonruter 26d8606
Eliminate nodes_to_keep in favor of using data-amp-unvalidated-tag at…
westonruter 8a1d3b5
Add tests for SandboxingLevels minus the add_hooks method
westonruter 669da7e
Add tests for SandboxingLevels::add_hooks()
westonruter 346867c
Add tests for ValidationExemption
westonruter 13ad904
Fix test failures
westonruter 0a24032
Remove obsolete arg from test
westonruter 925cbe7
Improve conditionality of including comment-reply
westonruter 8aab322
Tidy up script and comments sanitier changes
westonruter 74b49a0
Update testing logic for changes in AMP_Comments_Sanitizer
westonruter 6bf5c78
Remove dead code and improve structure of comments sanitizer
westonruter 54f57b9
Only normalize form targets on non-native forms; fix form tests
westonruter 2ac066c
Use native forms when PX-verified scripts are found as well as AMP-un…
westonruter fc63b82
Fix SandboxingLevelsTest and Test_AMP_Theme_Support
westonruter 8be564f
Fix test_add_amp_live_list_comment_attributes for WP<5.2
westonruter 4a81cc8
Merge branch 'develop' of github.com:ampproject/amp-wp into add/sandb…
westonruter a75b23d
Improve conditions for DOM objects
westonruter 96a4c11
Optimize conditionals in ValidationExemption
westonruter 826a564
Add note about temporalness of filter
westonruter 8e137db
Rename SandboxingLevels to just Sandboxing
westonruter a561a2c
Remove redundant SANDBOXING prefix
westonruter dc2f88f
Annotate native markup as PX-verified not AMP-unvalidated
westonruter 989af80
Merge branch 'develop' of github.com:ampproject/amp-wp into add/sandb…
westonruter 19c3c12
Add PX-verified and AMP-unvalidated attributes based on !important qu…
westonruter 98025a7
Fix covers tag
westonruter a73b84a
Remove needless looping over sanitizers
westonruter f99c56b
Bump parsed stylesheet cache group
westonruter 5961514
Add allow_excessive_css argument to AMP_Style_Sanitizer
westonruter 78684ae
Remove make_http_url_schemeless dead code
westonruter d651b45
Reset changes before calling tearDown
westonruter e1c7570
Merge branch 'develop' of github.com:ampproject/amp-wp into add/sandb…
westonruter fd32008
Use xpath instead of getElementById
westonruter 4e5e4fd
Add covers phpdoc tag to test_ampify_threaded_comments
westonruter 6c22fcd
Improve test coverage for AMP_Script_Sanitizer
westonruter 7ac935a
Fix sanitization of keyframes outside of style[amp-keyframes]
westonruter d604e28
Improve test coverage for ValidationExemption
westonruter 219c4f7
Merge branch 'develop' of github.com:ampproject/amp-wp into add/sandb…
westonruter 9fbb876
Add test coverage for allowlisted properties in CSS declaration block
westonruter 1a0454b
Add test coverage for invalid at-rule inside keyframes
westonruter 85ace0f
Work around coverage decrease by adding covers tags for private metho…
westonruter 707550a
Remove empty style attributes add style sanitizer test coverage
westonruter e1c81c2
Add additional covers tags for private methods in audio, iframe, and …
westonruter 5b60903
Add test coverage for AMP_Validation_Error_Taxonomy::get_error_title_…
westonruter 9b304e1
Add yet more covers tags for private methods in style sanitizer
westonruter c1dde99
Opt to disable stylesheet processing when in level 1
westonruter bd54a6f
Make ValidationExemption more DRY and performant
westonruter 4cdaabb
Add effective sandboxing level to meta generator and admin bar
westonruter 502873c
Fix grammar typos in comment
westonruter faaf295
Merge branch 'develop' of github.com:ampproject/amp-wp into add/sandb…
westonruter 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 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 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 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
Oops, something went wrong.
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.
Maybe the template mode option drawer should initially be open if Standard mode is selected? Otherwise it might be hard for the user to find where these "Sandboxing Levels" are.