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

wpcom.js: Remove problematic "whitelist" langauge #43395 #43641

Conversation

sarayourfriend
Copy link
Contributor

@sarayourfriend sarayourfriend commented Jun 24, 2020

Changes proposed in this Pull Request

  • Rename wpcom.js/test-whitelist to wpcom.js/test-allow-deny-lists`

Testing instructions

  • Ensure wpcom.js unit tests pass

Addresses part of #43395

@matticbot
Copy link
Contributor

@sarayourfriend sarayourfriend mentioned this pull request Jun 24, 2020
21 tasks
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@sarayourfriend sarayourfriend changed the title wpcom.js: Remove problematic "whitelist" langauge #43302 wpcom.js: Remove problematic "whitelist" langauge #43395 Jun 24, 2020
@sarayourfriend
Copy link
Contributor Author

Linting errors are pre-existing and out of scope for this PR.

@sarayourfriend sarayourfriend added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jun 24, 2020
@sarayourfriend sarayourfriend requested review from ice9js, retrofox and jsnajdr and removed request for ice9js June 29, 2020 16:31
@sarayourfriend
Copy link
Contributor Author

@retrofox It looks like you were the original author of these files, so just pinging you for a quick review if you have a chance. Thanks!

@jsnajdr pinging you as you originally committed but I know you're pressed for time so no worries about reviewing or not.

@@ -13,7 +13,7 @@ SOURCE_FILES = $(shell find $(ROOT) -name "*.js")
COMPILED_FILES = $(addprefix $(BUILDDIR)/, $(SOURCE_FILES))

JS_FILES := $(SOURCE_FILES) $(wildcard test/*.js)
JS_TESTING_FILES := $(wildcard test/test*.js test-whitelist/test*.js)
JS_TESTING_FILES := $(wildcard test/test*.js test-allow-deny-lists/test*.js)
Copy link
Member

Choose a reason for hiding this comment

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

The test-whitelist name was not very self-explaining, and unfortunately this rename further obfuscates it.

Some sensitive API endpoints (e.g., /me/settings) can be called only from certain allowed domains which are controlled by a8c: wordpress.com, a8c.com, widgets.wp.com... The REST proxy frame and the server handlers check the Origin header and deny the request if doesn't come from a trusted one.

Not every random site can load the REST proxy iframe and send any kind of request, even authenticated. E.g., anyone can list posts on a public site, Jetpack sites (not controlled by a8c) can send a limited subset, Atomic and Simple sites are further limited, and only handful of origins have full access.

The tests in test-whitelist test these limited APIs and therefore need to be run from an allowed origin.

Good name would be test-need-complete-access-origin or something like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, thank you! I was struggling to figure out an appropriate alternative. I'll make the updates 😊

@sarayourfriend sarayourfriend force-pushed the update/remove-problematic-language-whitelist-blacklist-wpcomjs branch from 2377cea to ba99f40 Compare June 30, 2020 14:06
Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

👍

@sarayourfriend sarayourfriend merged commit 67cb077 into master Jul 1, 2020
@sarayourfriend sarayourfriend deleted the update/remove-problematic-language-whitelist-blacklist-wpcomjs branch July 1, 2020 17:23
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 1, 2020
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.

None yet

3 participants