This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 447
fixing vulnerability: XXE #679
Open
marcosptf
wants to merge
8
commits into
quokkaproject:master
Choose a base branch
from
marcosptf:hotfix/issue676
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
470997a
WIP: fixing XSS vulnerability
marcosptf 0239d7d
WIP: fixing vulnerability
marcosptf 538b074
fixing pep8
marcosptf 3791017
Merge branch 'hotfix/issue675' into hotfix/issue676
marcosptf 4d07b17
fixing pep8
marcosptf 1e065a2
add fixing XXE
marcosptf 24bd94b
fixing pytests
marcosptf c8e47e8
removing comments unused;
marcosptf 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
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ def app(): | |
"""Flask Pytest uses it""" | ||
os.chdir('quokka/project_template/') | ||
return create_app() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import pytest | ||
from flask import request | ||
from urllib.parse import urljoin | ||
from slugify.main import Slugify | ||
from quokka.utils.text import ( | ||
abbreviate, normalize_var, | ||
make_social_link, make_social_link, | ||
make_social_name, cdata, | ||
make_external_url, split_all_category_roots, | ||
remove_tags_from_string | ||
) | ||
|
||
################################ | ||
#pytest - fixtures - setUp(); # | ||
################################ | ||
slugify = Slugify() | ||
slugify.to_lower = True | ||
slugify_category = Slugify() | ||
slugify_category.to_lower = True | ||
slugify_category.safe_chars = '/' | ||
abbrev = abbreviate("pytest-mock") | ||
norma = normalize_var("http://yahoo.com") | ||
make_link = make_social_link(network="twitter", txt="http://twitter.com/python") | ||
make_name = make_social_name('http://twitter.com/python') | ||
data = cdata("py-cdata") | ||
split = split_all_category_roots(cat="categoria1/categoria2/categoria3") | ||
|
||
|
||
################################## | ||
#pytest - Quokka - test_text.py # | ||
################################## | ||
def test_abbreviate(): | ||
debugger = abbreviate("pytest-mock") | ||
assert abbrev == 'pytest-mock' | ||
|
||
def test_normalize_var(): | ||
assert norma == "http:__yahoo.com" | ||
|
||
|
||
def test_make_social_link(): | ||
assert make_link == 'http://twitter.com/python' | ||
|
||
|
||
def test_make_social_name(): | ||
assert make_name == 'python' | ||
|
||
def test_cdata(): | ||
assert data == '<![CDATA[\npy-cdata\n]]>' | ||
|
||
def test_make_external_url(): | ||
with pytest.raises(RuntimeError) as err: | ||
make_external_url("http://it.yahoo.com") | ||
assert "Working outside of application context." in str(err.value) | ||
|
||
def test_split_all_category_roots(): | ||
assert split[0] == 'categoria1/categoria2/categoria3' | ||
assert split[1] == 'categoria1/categoria2' | ||
assert split[2] == 'categoria1' | ||
|
||
def test_remove_tags_from_string(): | ||
assert remove_tags_from_string('<script>alert("python-quokka");</script>') == 'alertpython-quokka' | ||
assert remove_tags_from_string('<script>console.log("python-quokka");</script>') == 'console.logpython-quokka' | ||
assert remove_tags_from_string('<b>python-quokka</b>') == 'python-quokka' | ||
assert remove_tags_from_string('<style>position:relative;top:10px;float:left;</style>') == 'position:relativetop:10pxfloat:left' | ||
|
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.
If it will not be used in the future, consider removing these comments
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.
done in another pr => #680