Skip to content
This repository was archived by the owner on Sep 27, 2022. It is now read-only.

Early sanitization, late escaping - #109

Open
peterwilsoncc wants to merge 7 commits into
justintadlock:masterfrom
humanmade:early-san-late-esc
Open

Early sanitization, late escaping#109
peterwilsoncc wants to merge 7 commits into
justintadlock:masterfrom
humanmade:early-san-late-esc

Conversation

@peterwilsoncc

Copy link
Copy Markdown

I've made some minor changes to escaping and sanitization for use on a client site. At the moment, they're defensive coding rather than to protect against any flaws.

The changes I've made are:

  • unslash and sanitize user (GET, POST, REQUEST) data as read
  • add a few instances of escaping: mainly to stop trusting translations

@justintadlock

Copy link
Copy Markdown
Owner

I'm not going to accept this pull request because there's a lot of stuff I'm seeing that's simply unnecessary. Mostly, this is when something's already been sanitized or escaped at a different point in the flow. Or, times where the code is checking against a whitelist of accepted values.

However, I am going to keep this open because there's some useful items in there that I'd like to use in the next version.

@peterwilsoncc

Copy link
Copy Markdown
Author

That's fair enough. I wanted to get in the hardening in early/late and leave you the gift of removing the other items the flow :)

Core has been caught out by missing the sanitize early, escape late rule in a few recent releases, so it's something I keep in mind these days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants