Skip to content

Late-escaping of output, removal of $_REQUEST - #4

Closed
stevegrunwell wants to merge 20 commits into
WordPress:masterfrom
10up:fix/additional-escaping
Closed

stevegrunwell wants to merge 20 commits into
WordPress:masterfrom
10up:fix/additional-escaping

Conversation

@stevegrunwell

Copy link
Copy Markdown
Contributor

We're looking to use this on a platform that champions "escape all the things!", so I've gone through and added late-escaping wherever it was missing, following the WordPress VIP standards (as they tend to know a thing or two about securing WordPress 😉).

This PR also replaces instances of $_REQUEST with $_POST or $_GET, based on how the data is being received.

Thank you for putting this together!

@stevegrunwell

Copy link
Copy Markdown
Contributor Author

Hmm, seem to be encountering an infinite login loop when I hit mysite.com/wp-login.php directly; will troubleshoot and have a patch shortly, as it may be connected to my $_REQUEST adjustments.

@stevegrunwell

Copy link
Copy Markdown
Contributor Author

That's exactly what it was, the 'redirect_to' value was getting lost, resulting in an infinite login loop.

Comment thread providers/class.two-factor-email.php Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This I had intentionally left as $_REQUEST in case we later modify the emails to include a link they can follow with the $_GET argument pre-filled.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good catch. I don't know if it will ever be useful in practice, as the content will only ever be a substr of a md5 hash, but it's still a good practice to be in.

Comment thread class.application-passwords.php Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Depending on how the AJAX processing endpoints are written, this may be better left as $_REQUEST to let one endpoint do both. Maybe. I'd need to see it built out first.

@georgestephanis

Copy link
Copy Markdown
Collaborator

I skipped a few remarks at the end between $_REQUEST and $_POST -- but I'd prefer if for the moment anyways, we could leave all of those as $_REQUEST until I get the backup methods branch sorted.

…t's not necessary to use verbose placeholders like %2$s"

This reverts commit 04be14a.
…ant them to be clean), use wp_strip_all_tags() instead of esc_html() in get_columns()
…esc_html() isn't really the ideal escaping method for email content
…epending on how they are being used"

This reverts commit fa8e5a9 at the request of @georgestephanis while he works on some of the fallback code (see #4)

Conflicts:
	class.two-factor-core.php
	providers/class.two-factor-email.php
@stevegrunwell

Copy link
Copy Markdown
Contributor Author

@georgestephanis I've gone through and addressed your feedback on the PR, thank you for being so thorough! I've also reverted the $_REQUEST-related changes, but opened #6 so it doesn't get lost in the historical shuffle.

Comment thread class.two-factor-core.php Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@stevegrunwell

Copy link
Copy Markdown
Contributor Author

Can you tell I've been burned by under-escaping before? ;)

@georgestephanis

Copy link
Copy Markdown
Collaborator

👍

@valendesigns

Copy link
Copy Markdown
Collaborator

I'm not sure if this PR is still needed anymore. There are aspects of it that made it into Master already. @stevegrunwell would you like to fix the merge conflicts so we can see what's different, or should we close the PR?

Conflicts:
	class.application-passwords-list-table.php
	class.application-passwords.php
	class.two-factor-core.php
	providers/class.two-factor-email.php
	providers/class.two-factor-provider.php
@stevegrunwell

Copy link
Copy Markdown
Contributor Author

@valendesigns It looks like the only thing left in the PR that hasn't been merged is converting the two-factor-input-code input from type="tel" to type="text", as George and I discussed earlier in the thread. I'd say it's safe to close the PR :)

@stevenkword

Copy link
Copy Markdown
Contributor

We'll want to make sure to include the backup codes provider if we take another look at $_REQUEST.

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.

4 participants