This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
update: headers for CORS #133
Open
sylvainlb
wants to merge
2
commits into
read-write-web:dev
Choose a base branch
from
Open-Initiative:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LDP spec requires the Allow. See ¶ 4.2.8.2 of the LDP spec. So it can't be replaced the way it is done here.
The Access-Control-Allow-Methods is part of the CORS standard and has a different meaning. The reason for its existence has to be looked at in a lot greater detail to understand what the dangers associated with it are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I hadn't found that. I'm wondering why they didn't use the same header. Can there be cases where the two headers have different values?
Otherwise I'm just going to duplicate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is that the
Allow
header is saying: you can use these methods as you are authenticated now. TheAccess-Control-Allow-Methods
field is saying what you can do if a JS script is holding a gun to your head and telling you exactly what to do. There are certain JS scripts that are allowed to take over your brain perhaps with theOrigin
header, but not all.So in the case that the RDF is completely public then the two should be the same. What is really needed is in the WebID profile of the user who is authenticated, for him to specify the JS origins he accepts ( As long as an arbitrary JS can't just edit that file. )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok! Not sure to get the gun metaphore, but I'll add both.
I agree with you for the list in the webId. I guess the server could have its own black list as well. I'm wondering how we can ask the user if the origin should be added to the trusted ones. I guess we could do a redirection to the server holding the WebId. Not sure if it can be done on an OPTIONS request though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have written up a fuller explanation of what I think is actually needed on the Web Access Control wiki page.
https://www.w3.org/wiki/WebAccessControl#Cors_User_Agents
I'll see if I get some feedback on this from the larger community. But let me see what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a pretty good solution. One remark, the CORS problem is not limited to Write operations. Even giving access to a script to private data may be a real issue, as that script can then send that data somewhere else.
Another detail, I'm not sure to understand why the term class is used to specify the origin in the example ACL.