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

Adding rudimentary whitelist support in lieu of globally available ge… #49

Merged
merged 4 commits into from
Jul 8, 2019

Conversation

pbrown-d2l
Copy link
Contributor

…neric whitelist

@pbrown-d2l
Copy link
Contributor Author

@omsmith - Here is the PR for what we talked about earlier

@pbrown-d2l
Copy link
Contributor Author

If I run npm test locally on Master, it is also failing at the same place... any advice there would be helpful too.

@ChrisKraljevicD2L
Copy link

Code looks good but failing tests look not fun. Perhaps dummy URLs are being used somewhere and are now being rejected? I'll check

@ChrisKraljevicD2L
Copy link

Yup looks like it. Those domains can probably be changed to ones from the whitelist.

@awikkerink awikkerink merged commit 9bc765a into Brightspace:master Jul 8, 2019
@@ -126,6 +127,9 @@ window.D2L.Siren.EntityStore = {
if (!entityId) {
return Promise.reject(new Error('Cannot fetch undefined entityId'));
}
if (!window.D2L.Siren.WhitelistBehavior.isWhitelisted(entityId)) {
return Promise.reject(new Error('Invalid request url; must be a valid whitelisted domain.'));
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't the approach we've taken generally. It might be fine, but it also might not be. Other libraries we've made have opted to just not add the Authorization header, as opposed to making the library only work at all for d2l urls.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pbrown-d2l @awikkerink Are we sure this is the approach we want to release?

Copy link

Choose a reason for hiding this comment

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

This was sort of a breaking change for my repo. Tests began failing. I'm guessing the recommended way is to setup test mode during setup? Let me know if there is a different suggestion. Related PR is https://github.com/BrightspaceHypermediaComponents/activities/pull/243

Copy link
Contributor

Choose a reason for hiding this comment

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

This has broken a lot of demos and tests :/ on most of the BHC org.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are making calls to sites not on the whitelist in your tests and demos it is very easy to switch it off as Miles mentioned. Luckily, now your users tokens aren't at risk,

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

6 participants