diff --git a/lib/.shards.info b/lib/.shards.info index b15cf54122a0..7f03bb906410 100644 --- a/lib/.shards.info +++ b/lib/.shards.info @@ -7,6 +7,3 @@ shards: reply: git: https://github.com/i3oris/reply.git version: 0.3.1+git.commit.90a7eb5a76048884d5d56bf6b9369f1e67fdbcd7 - sanitize: - git: https://github.com/straight-shoota/sanitize.git - version: 0.1.0+git.commit.75c141b619c77956e88f557149566cd28876398b diff --git a/lib/sanitize/.circleci/config.yml b/lib/sanitize/.circleci/config.yml deleted file mode 100644 index df9b752af31d..000000000000 --- a/lib/sanitize/.circleci/config.yml +++ /dev/null @@ -1,94 +0,0 @@ -version: 2 - -dry: - restore_shards_cache: &restore_shards_cache - keys: - - shards-cache-v1-{{ .Branch }}-{{ checksum "shard.yml" }} - - shards-cache-v1-{{ .Branch }} - - shards-cache-v1 - - save_shards_cache: &save_shards_cache - key: shards-cache-v1-{{ .Branch }}-{{ checksum "shard.yml" }} - paths: - - ./shards-cache - -jobs: - test: - docker: - - image: crystallang/crystal:latest - environment: - SHARDS_CACHE_PATH: ./shards-cache - steps: - - run: crystal --version - - - checkout - - - restore_cache: *restore_shards_cache - - run: shards - - save_cache: *save_shards_cache - - - run: make test - - - run: crystal tool format --check spec src - - deploy-docs: - docker: - - image: crystallang/crystal:latest - environment: - SHARDS_CACHE_PATH: ./shards-cache - steps: - - run: crystal --version - - - checkout - - - run: scripts/generate-docs.sh - - - run: apt update && apt install -y curl rsync - - run: - command: curl https://raw.githubusercontent.com/straight-shoota/autodeploy-docs/master/autodeploy-docs.sh | bash - environment: - GIT_COMMITTER_NAME: cirlceci - GIT_COMMITTER_EMAIL: circle@circleci.com - - test-on-nightly: - docker: - - image: crystallang/crystal:nightly - environment: - SHARDS_CACHE_PATH: ./shards-cache - steps: - - run: crystal --version - - - checkout - - - restore_cache: *restore_shards_cache - - run: shards - - - run: make test - - - run: crystal tool format --check spec src - -workflows: - version: 2 - # Run tests on every single commit - ci: - jobs: - - test - # Build and depoy docs only on master branch - - deploy-docs: - requires: - - test - filters: &master-only - branches: - only: - - master - # Run tests every night using crystal nightly - nightly: - triggers: - - schedule: - cron: "0 4 * * *" - filters: - branches: - only: - - master - jobs: - - test-on-nightly diff --git a/lib/sanitize/.editorconfig b/lib/sanitize/.editorconfig deleted file mode 100644 index 163eb75c8525..000000000000 --- a/lib/sanitize/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*.cr] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true diff --git a/lib/sanitize/.gitignore b/lib/sanitize/.gitignore deleted file mode 100644 index 0bbd4a9f41e1..000000000000 --- a/lib/sanitize/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/docs/ -/lib/ -/bin/ -/.shards/ -*.dwarf - -# Libraries don't need dependency lock -# Dependencies will be locked in applications that use them -/shard.lock diff --git a/lib/sanitize/LICENSE b/lib/sanitize/LICENSE deleted file mode 100644 index d64569567334..000000000000 --- a/lib/sanitize/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/sanitize/Makefile b/lib/sanitize/Makefile deleted file mode 100644 index 980fc7a52014..000000000000 --- a/lib/sanitize/Makefile +++ /dev/null @@ -1,54 +0,0 @@ --include Makefile.local # for optional local options - -BUILD_TARGET ::= bin/app - -# The shards command to use -SHARDS ?= shards -# The crystal command to use -CRYSTAL ?= crystal - -SRC_SOURCES ::= $(shell find src -name '*.cr' 2>/dev/null) -LIB_SOURCES ::= $(shell find lib -name '*.cr' 2>/dev/null) -SPEC_SOURCES ::= $(shell find spec -name '*.cr' 2>/dev/null) - -.PHONY: test -test: ## Run the test suite -test: lib - $(CRYSTAL) spec - -.PHONY: format -format: ## Apply source code formatting -format: $(SRC_SOURCES) $(SPEC_SOURCES) - $(CRYSTAL) tool format src spec - -docs: ## Generate API docs -docs: $(SRC_SOURCES) lib - $(CRYSTAL) docs -o docs - -lib: shard.lock - $(SHARDS) install - -shard.lock: shard.yml - $(SHARDS) update - -.PHONY: clean -clean: ## Remove application binary -clean: - @rm -f $(BUILD_TARGET) - -.PHONY: help -help: ## Show this help - @echo - @printf '\033[34mtargets:\033[0m\n' - @grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\ - sort |\ - awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' - @echo - @printf '\033[34moptional variables:\033[0m\n' - @grep -hE '^[a-zA-Z_-]+ \?=.*?## .*$$' $(MAKEFILE_LIST) |\ - sort |\ - awk 'BEGIN {FS = " \\?=.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' - @echo - @printf '\033[34mrecipes:\033[0m\n' - @grep -hE '^##.*$$' $(MAKEFILE_LIST) |\ - awk 'BEGIN {FS = "## "}; /^## [a-zA-Z_-]/ {printf " \033[36m%s\033[0m\n", $$2}; /^## / {printf " %s\n", $$2}' diff --git a/lib/sanitize/README.md b/lib/sanitize/README.md deleted file mode 100644 index fdca90db33a1..000000000000 --- a/lib/sanitize/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# sanitize - -`sanitize` is a Crystal library for transforming HTML/XML trees. It's primarily -used to sanitize HTML from untrusted sources in order to prevent -[XSS attacks](http://en.wikipedia.org/wiki/Cross-site_scripting) and other -adversities. - -It builds on stdlib's [`XML`](https://crystal-lang.org/api/XML.html) module to -parse HTML/XML. Based on [libxml2](http://xmlsoft.org/) it's a solid parser and -turns malformed and malicious input into valid and safe markup. - -* Code: [https://github.com/straight-shoota/sanitize](https://github.com/straight-shoota/sanitize) -* API docs: [https://straight-shoota.github.io/sanitize/api/latest/](https://straight-shoota.github.io/sanitize/api/latest/) -* Issue tracker: [https://github.com/straight-shoota/sanitize/issues](https://github.com/straight-shoota/sanitize/issues) -* Shardbox: [https://shardbox.org/shards/sanitize](https://shardbox.org/shards/sanitize) - -## Installation - -1. Add the dependency to your `shard.yml`: - - ```yaml - dependencies: - sanitize: - github: straight-shoota/sanitize - ``` - -2. Run `shards install` - -## Sanitization Features - -The `Sanitize::Policy::HTMLSanitizer` policy applies the following sanitization steps. Except -for the first one (which is essential to the entire process), all can be disabled -or configured. - -* Turns malformed and malicious HTML into valid and safe markup. -* Strips HTML elements and attributes not included in the safe list. -* Sanitizes URL attributes (like `href` or `src`) with customizable sanitization - policy. -* Adds `rel="nofollow"` to all links and `rel="noopener"` to links with `target`. -* Validates values of accepted attributes `align`, `width` and `height`. -* Filters `class` attributes based on a whitelist (by default all classes are - rejected). - -## Usage - -Transformation is based on rules defined by `Sanitize::Policy` implementations. - -The recommended standard policy for HTML sanitization is `Sanitize::Policy::HTMLSanitizer.common` -which represents good defaults for most use cases. -It sanitizes user input against a known safe list of accepted elements and their -attributes. - -```crystal -require "sanitize" - -sanitizer = Sanitize::Policy::HTMLSanitizer.common -sanitizer.process(%(foo)) # => %(foo) -sanitizer.process(%(
)) # => %() -sanitizer.process(%()) # => %() -sanitizer.process(%(foo | bar |
foo | bar |
Sanitization with https://shardbox.org/shards/sanitize is not that -difficult.
-puts "Hello World!"
-
-Hello world!
-``` - -## Limitations - -Sanitizing CSS is not supported. Thus `style` attributes can't be accepted in a -safe way. -CSS sanitization features may be added when a CSS parsing library is available. - -## Security - -If you want to privately disclose security-issues, please contact -[straightshoota](https://keybase.io/straightshoota) on Keybase or -[straightshoota@gmail.com](mailto:straightshoota@gmail.com) (PGP: `DF2D C9E9 FFB9 6AE0 2070 D5BC F0F3 4963 7AC5 087A`). - -## Contributing - -1. Fork it ([https://github.com/straight-shoota/sanitize/fork](https://github.com/straight-shoota/sanitize/fork)) -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create a new Pull Request - -## Contributors - -- [Johannes Müller](https://github.com/straight-shoota) - creator and maintainer diff --git a/lib/sanitize/lib b/lib/sanitize/lib deleted file mode 120000 index a96aa0ea9d8c..000000000000 --- a/lib/sanitize/lib +++ /dev/null @@ -1 +0,0 @@ -.. \ No newline at end of file diff --git a/lib/sanitize/scripts/generate-docs.sh b/lib/sanitize/scripts/generate-docs.sh deleted file mode 100755 index 5dbaf344c48d..000000000000 --- a/lib/sanitize/scripts/generate-docs.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/env bash - -set -e - -GENERATED_DOCS_DIR="./docs" - -echo -e "Building docs into ${GENERATED_DOCS_DIR}" -echo -e "Clearing ${GENERATED_DOCS_DIR} directory" -rm -rf "${GENERATED_DOCS_DIR}" - -echo -e "Running \`make docs\`..." -make docs - -echo -e "Copying README.md" - -# "{{" and "{%"" need to be escaped, otherwise Jekyll might interpret the expressions (on Github Pages) -ESCAPE_TEMPLATE='s/{{/{{"{{"}}/g; s/{\%/{{"{%"}}/g;' -sed "${ESCAPE_TEMPLATE}" README.md > "${GENERATED_DOCS_DIR}/README.md" diff --git a/lib/sanitize/shard.yml b/lib/sanitize/shard.yml deleted file mode 100644 index eb9158fc58e4..000000000000 --- a/lib/sanitize/shard.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: sanitize -version: 0.1.0 - -authors: - - Johannes Müllerbar
bazzquux-<===> invalid/common.html -foo
bar
bazzquux-<===> - - - -<===> invalid-div/fragment.html -
bar
bazzbar
bazz quux -<===> - - -<===> basic/fragment.html -Lorem ipsum dolor sitbar
bazzbar
bazzFoo BOLD
Foo BOLD
-<===> - - -<===> entities/fragment.html -foo bar
-<===> - - -<===> align/fragment.html -foo
-<===> - - -<===> align-empty/fragment.html -foo
-<===> align-empty/common.html -foo
-<===> - - -<===> align-invalid/fragment.html -foo
-<===> align-invalid/common.html -foo
-<===> diff --git a/lib/sanitize/spec/html_sanitizer/html_sanitizer_spec.cr b/lib/sanitize/spec/html_sanitizer/html_sanitizer_spec.cr deleted file mode 100644 index f70a965345fa..000000000000 --- a/lib/sanitize/spec/html_sanitizer/html_sanitizer_spec.cr +++ /dev/null @@ -1,102 +0,0 @@ -require "../support/hrx" -require "../../src/policy/html_sanitizer" - -describe Sanitize::Policy::HTMLSanitizer do - it "removes invalid element" do - Sanitize::Policy::HTMLSanitizer.common.process("foo
foobar
" - end - - it "inserts whitespace for removed block tag" do - Sanitize::Policy::HTMLSanitizer.common.process("foo
foo bar baz
" - end - - it "strips tag with invalid URL attribute" do - Sanitize::Policy::HTMLSanitizer.common.process(%()).should eq %() - Sanitize::Policy::HTMLSanitizer.common.process(%(foo)).should eq "foo" - end - - it "escapes URL attribute" do - Sanitize::Policy::HTMLSanitizer.common.process(%()).should eq %() - end - - it %(adds rel="noopener" on target="_blank") do - policy = Sanitize::Policy::HTMLSanitizer.common - policy.process(%(foo)).should eq(%(foo)) - policy.accepted_attributes["a"] << "target" - policy.process(%(foo)).should eq(%(foo)) - end - - it "doesn't leak configuration" do - policy = Sanitize::Policy::HTMLSanitizer.common - policy.accepted_attributes["p"] << "invalid" - policy.process(%(bar
)).should eq(%(bar
)) - Sanitize::Policy::HTMLSanitizer.common.process(%(bar
)).should eq(%(bar
)) - end - - describe "html scaffold" do - it "fragment" do - Sanitize::Policy::HTMLSanitizer.common.process("BAR
").should eq "FOOBAR
" - end - - it "document" do - sanitizer = Sanitize::Policy::HTMLSanitizer.common - sanitizer.accept_tag("html") - sanitizer.accept_tag("head") - sanitizer.accept_tag("body") - sanitizer.process_document("BAR
").should eq "FOOBAR
\n" - end - end - - describe "#transform_classes" do - it "strips classes by default" do - policy = Sanitize::Policy::HTMLSanitizer.inline - orig_attributes = {"class" => "foo bar baz"} - attributes = orig_attributes.clone - policy.transform_classes("div", attributes) - attributes.should eq Hash(String, String).new - end - - it "accepts classes" do - policy = Sanitize::Policy::HTMLSanitizer.inline - orig_attributes = {"class" => "foo bar baz"} - attributes = orig_attributes.clone - - policy.valid_classes << /fo*/ - policy.valid_classes << "bar" - policy.transform_classes("div", attributes) - attributes.should eq({"class" => "foo bar"}) - end - - it "only matches full class name" do - policy = Sanitize::Policy::HTMLSanitizer.inline - orig_attributes = {"class" => "foobar barfoo barfoobaz foo fom"} - attributes = orig_attributes.clone - - policy.valid_classes << /fo./ - policy.transform_classes("div", attributes) - attributes.should eq({"class" => "foo fom"}) - end - end - - run_hrx_samples Path["basic.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - } - run_hrx_samples Path["protocol_javascript.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - } - run_hrx_samples Path["links.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - } - run_hrx_samples Path["xss.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - } - run_hrx_samples Path["img.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - } - run_hrx_samples Path["class.hrx"], { - "common" => Sanitize::Policy::HTMLSanitizer.common, - "allow-prefix" => Sanitize::Policy::HTMLSanitizer.common.tap { |sanitizer| - sanitizer.valid_classes = Set{/allowed-.+/, "explicitly-allowed"} - }, - } -end diff --git a/lib/sanitize/spec/html_sanitizer/img.hrx b/lib/sanitize/spec/html_sanitizer/img.hrx deleted file mode 100644 index 1fd81d00d687..000000000000 --- a/lib/sanitize/spec/html_sanitizer/img.hrx +++ /dev/null @@ -1,46 +0,0 @@ -<===> img/fragment.html - -<===> - - -<===> img with width/fragment.html - -<===> - - -<===> img with height/fragment.html - -<===> - - -<===> img with width and height/fragment.html - -<===> - - -<===> img invalid height/fragment.html - -<===> img invalid height/common.html - -<===> - - -<===> img invalid width/fragment.html - -<===> img invalid width/common.html - -<===> - - - -<===> img invalid width and height/fragment.html - -<===> img invalid width and height/common.html - -<===> - - - -<===> img percent width and height/fragment.html - -<===> diff --git a/lib/sanitize/spec/html_sanitizer/links.hrx b/lib/sanitize/spec/html_sanitizer/links.hrx deleted file mode 100644 index 104740825fab..000000000000 --- a/lib/sanitize/spec/html_sanitizer/links.hrx +++ /dev/null @@ -1,89 +0,0 @@ -<===> links/1/fragment.html - -<===> links/1/common.html - -<===> - - -<===> links/2/fragment.html - -<===> links/2/common.html - -<===> - - -<===> links/3/fragment.html - -<===> links/3/common.html - -<===> - - -<===> links/4/fragment.html - -<===> links/4/common.html - -<===> - - -<===> links/5/fragment.html - -<===> links/5/common.html - -<===> - - -<===> links/6/fragment.html - -<===> links/6/common.html - -<===> - - -<===> links/7/fragment.html - -<===> links/7/common.html - -<===> - - -<===> links/8/fragment.html - -<===> links/8/common.html - -<===> - - -<===> links/9/fragment.html - -<===> links/9/common.html - -<===> - - -<===> links/10/fragment.html - -<===> links/10/common.html - -<===> - - -<===> links/11/fragment.html - -<===> links/11/common.html - -<===> - - -<===> links/12/fragment.html - -<===> links/12/common.html - -<===> - - -<===> links/13/fragment.html - -<===> links/13/common.html - -<===> diff --git a/lib/sanitize/spec/html_sanitizer/protocol-based-javascript.hrx b/lib/sanitize/spec/html_sanitizer/protocol-based-javascript.hrx deleted file mode 100644 index 16576ea78f80..000000000000 --- a/lib/sanitize/spec/html_sanitizer/protocol-based-javascript.hrx +++ /dev/null @@ -1,160 +0,0 @@ - -<===> simple, no spaces/fragment.html -foo -<===> simple, no spaces/common.html -foo -<===> simple, no spaces/restricted.html -foo -<===> simple, no spaces/basic.html -foo -<===> simple, no spaces/relaxed.html -foo - -<===> simple, spaces before/fragment.html -foo -<===> simple, spaces before/common.html -foo -<===> simple, spaces before/restricted.html -foo -<===> simple, spaces before/basic.html -foo -<===> simple, spaces before/relaxed.html -foo - -<===> simple, spaces after/fragment.html -foo -<===> simple, spaces after/common.html -foo -<===> simple, spaces after/restricted.html -foo -<===> simple, spaces after/basic.html -foo -<===> simple, spaces after/relaxed.html -foo - -<===> simple, spaces before and after/fragment.html -foo -<===> simple, spaces before and after/common.html -foo -<===> simple, spaces before and after/restricted.html -foo -<===> simple, spaces before and after/basic.html -foo -<===> simple, spaces before and after/relaxed.html -foo - -<===> preceding colon/fragment.html -foo -<===> preceding colon/common.html -foo -<===> preceding colon/restricted.html -foo -<===> preceding colon/basic.html -foo -<===> preceding colon/relaxed.html -foo - -<===> UTF-8 encoding/fragment.html -foo -<===> UTF-8 encoding/common.html -foo -<===> UTF-8 encoding/restricted.html -foo -<===> UTF-8 encoding/basic.html -foo -<===> UTF-8 encoding/relaxed.html -foo - -<===> long UTF-8 encoding/fragment.html -foo -<===> long UTF-8 encoding/common.html -foo -<===> long UTF-8 encoding/restricted.html -foo -<===> long UTF-8 encoding/basic.html -foo -<===> long UTF-8 encoding/relaxed.html -foo - -<===> long UTF-8 encoding without semicolons/fragment.html -foo -<===> long UTF-8 encoding without semicolons/common.html -foo -<===> long UTF-8 encoding without semicolons/restricted.html -foo -<===> long UTF-8 encoding without semicolons/basic.html -foo -<===> long UTF-8 encoding without semicolons/relaxed.html -foo - -<===> hex encoding/fragment.html -foo -<===> hex encoding/common.html -foo -<===> hex encoding/restricted.html -foo -<===> hex encoding/basic.html -foo -<===> hex encoding/relaxed.html -foo - -<===> long hex encoding/fragment.html -foo -<===> long hex encoding/common.html -foo -<===> long hex encoding/restricted.html -foo -<===> long hex encoding/basic.html -foo -<===> long hex encoding/relaxed.html -foo - -<===> hex encoding without semicolons/fragment.html -foo -<===> hex encoding without semicolons/common.html -foo -<===> hex encoding without semicolons/restricted.html -foo -<===> hex encoding without semicolons/basic.html -foo -<===> hex encoding without semicolons/relaxed.html -foo - -<===> null char/fragment.html - -<===> null char/common.html -<===> null char/restricted.html -<===> null char/basic.html -<===> null char/relaxed.html -<===> invalid URL char/fragment.html - -<===> invalid URL char/common.html - -<===> invalid URL char/restricted.html - -<===> invalid URL char/basic.html - -<===> invalid URL char/relaxed.html - - -<===> spaces and entities/fragment.html - -<===> spaces and entities/common.html - -<===> spaces and entities/restricted.html - -<===> spaces and entities/basic.html - -<===> spaces and entities/relaxed.html - - -<===> protocol whitespace/fragment.html - -<===> protocol whitespace/common.html - -<===> protocol whitespace/restricted.html - -<===> protocol whitespace/basic.html - -<===> protocol whitespace/relaxed.html - diff --git a/lib/sanitize/spec/html_sanitizer/protocol_javascript.hrx b/lib/sanitize/spec/html_sanitizer/protocol_javascript.hrx deleted file mode 100644 index fc4b86c50d29..000000000000 --- a/lib/sanitize/spec/html_sanitizer/protocol_javascript.hrx +++ /dev/null @@ -1,67 +0,0 @@ -<===> simple, no spaces/fragment.html -foo -<===> simple, no spaces/common.html -foo -<===> simple, spaces before/fragment.html -foo -<===> -# TODO: Maybe this should strip the a tag -<===> simple, spaces before/common.html -foo -<===> simple, spaces after/fragment.html -foo -<===> simple, spaces after/common.html -foo -<===> simple, spaces before and after/fragment.html -foo -<===> -# TODO: Maybe this should strip the a tag -<===> simple, spaces before and after/common.html -foo -<===> preceding colon/fragment.html -foo -<===> -# TODO: Maybe this should strip the a tag -<===> preceding colon/common.html -foo -<===> UTF-8 encoding/fragment.html -foo -<===> UTF-8 encoding/common.html -foo -<===> long UTF-8 encoding/fragment.html -foo -<===> long UTF-8 encoding/common.html -foo -<===> long UTF-8 encoding without semicolons/fragment.html -foo -<===> long UTF-8 encoding without semicolons/common.html -foo -<===> hex encoding/fragment.html -foo -<===> hex encoding/common.html -foo -<===> long hex encoding/fragment.html -foo -<===> long hex encoding/common.html -foo -<===> hex encoding without semicolons/fragment.html -foo -<===> hex encoding without semicolons/common.html -foo -<===> null char/fragment.html - -<===> -# TODO: Maybe this should strip the a tag -<===> null char/common.html - -<===> invalid URL char/fragment.html - -<===> -# TODO: Maybe this should strip the a tag -<===> invalid URL char/common.html - -<===> spaces and entities/fragment.html - -<===> spaces and entities/common.html - -<===> diff --git a/lib/sanitize/spec/html_sanitizer/url_spec.cr b/lib/sanitize/spec/html_sanitizer/url_spec.cr deleted file mode 100644 index 5e1aade7ae90..000000000000 --- a/lib/sanitize/spec/html_sanitizer/url_spec.cr +++ /dev/null @@ -1,8 +0,0 @@ -require "../support/hrx" -require "../../src/policy/html_sanitizer" - -describe "Sanitize::Policy::HTMLSanitizer" do - it "escapes URL attribute" do - Sanitize::Policy::HTMLSanitizer.common.process(%()).should eq %() - end -end diff --git a/lib/sanitize/spec/html_sanitizer/xss.hrx b/lib/sanitize/spec/html_sanitizer/xss.hrx deleted file mode 100644 index 4f2e238944c7..000000000000 --- a/lib/sanitize/spec/html_sanitizer/xss.hrx +++ /dev/null @@ -1,476 +0,0 @@ -<===> # Basic XSS -<===> fragment.html -test -<===> common.html -test -<===> - - -# Pending because libxml2 behaviour changed in 2.9.13 (https://gitlab.gnome.org/GNOME/libxml2/-/issues/339) -<===> pending:fragment.html -<<<>< -<===> common.html - -<===> - - -<===> fragment.html - -<===> -` -<===> common.html - -<===> - - -<===> fragment.html - -<===> common.html - -<===> - - -<===> fragment.html -