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

core models: sanitize user input #155

Merged
merged 5 commits into from
Oct 7, 2019
Merged

core models: sanitize user input #155

merged 5 commits into from
Oct 7, 2019

Conversation

milesbxf
Copy link
Contributor

Currently the API (and Slack app) allows users to enter any text they like for various fields - this has security implications if we end up rendering that text in a UI page down the line. Django UI templating handles this case automatically, but other types of UI consuming the API won't - here we sanitize input (using https://pypi.org/project/bleach/) before it gets saved to the DB.

@@ -23,6 +24,11 @@ class TimelineEvent(models.Model):
help_text="Additional fields that can be added by other event types", null=True
)

def save(self, *args, **kwargs):
print(type(self.text))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally left in?

setup.py Outdated
@@ -8,6 +8,7 @@
INSTALL_REQUIRES = [
"Django>=2.2",
"bleach==3.1.0",
"bleach-whitelist>=0.0.11",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo? I can only see 0.0.10 on pypi https://pypi.org/project/bleach-whitelist/

@ChrisAnn ChrisAnn merged commit ba9643d into master Oct 7, 2019
@ChrisAnn ChrisAnn deleted the sanitize-user-input branch October 7, 2019 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants