Open KyGost opened 3 years ago
I think CORS would be a great place to start for this.
If a drive can set this header it can configure how it can be interacted with.
Beaker uses a .csp
field in the index.json
. Maybe we could take a similar approach? https://docs.beakerbrowser.com/developers/index.json-manifest#csp
To enable that, we'd want to see if index.json
exists, then fetch the csp
field from it after parsing it as JSON and set that as the (Content-Securty-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) header. https://github.com/RangerMauve/dat-fetch/blob/master/index.js#L110
An extension could be useful here too.
Maybe the first time an origin tries to do a PUT or DELETE into a drive, the extension will prompt the user to allow it via a popup.
We could use window.open
to create the window and window.postMessage
to communicate the users's choice from it.
After discussing me and @RangerMauve have decided: An extension that does:
If drive has negative perms in index.json:
Permission for a higher capacity also grants lower capacities
Perms are per drive + site pair
Perms stored in the extension's indexedDB
Need to use WebRequest API, changing fetch won't affect enough!
Requests will occur at: https://github.com/AgregoreWeb/extension-agregore-permissions-fetch Agregore-side, we need:
Mind elaborating a bit more on what negative permissions in index.json would look like? :o
Seems you were thinking CSP. If not that, perhaps (GET is the only assumed positive permissions for now):
permissions: {
GET: {
'hyper://MYSITE'
}
}
Not sure if the list would be sites that can access it or can't access it.
Ah yeah, the CSP thing I was thinking of would be to implement the same function that Beaker has: https://docs.beakerbrowser.com/developers/index.json-manifest#csp
That makes sense. Can it be used to prevent connections? Browsed over it quickly and it seemed to be specifying what it can connect to?
Yeah, it can restrict domains from doing requests to the particular hyperdrive.
Hey, I think I could pick this issue up with some support. Could someone help break down the task into more manageable chunks?
@jolindroth Thanks for offering to help!
One approach would be via a web extension extension that would do something like the following:
hyper://
URL it has access tohyper
(and ipfs
?) URLs
PUT
/ POST
and DELETE
for now?tabs.createWindow()
in the extension and having it send back a message upon confirm/deny?This should be a good first step to see how permissions could work and leaves room for more fine-grained permissions and fetching permission info from naifests within the site itself down the line.
Does that feel like something you'd be comfortable taking on? Is there more detail that you'd need to get started?
In the future it might be cool if we could dynamically change the CORS header on webistes with a permission prompt too. But that's probably a separate issue. 😁
Thanks, @RangerMauve. I'll give it a shot. Could I reach out to you on discord if I need to ask something?
Thanks, @RangerMauve. I'll give it a shot. Could I reach out to you on discord if I need to ask something?
Yes! Feel free to chat about it on https://discord.gg/QMthd4Y or https://matrix.to/#/#agregore:mauve.moe I'm usually most active on weekdays and sometimes Sundays. 😁
An additional bit would be the ability to bypass CORS for general sites.
Here's how one could go about doing this:
fetch()
API to make a CORS request that would typically breaknavigator.requestCORSBypass(urlpattern)
Thanks, @RangerMauve. I'll give it a shot. Could I reach out to you on discord if I need to ask something?
Yes! Feel free to chat about it on https://discord.gg/QMthd4Y or https://matrix.to/#/#agregore:mauve.moe I'm usually most active on weekdays and sometimes Sundays. 😁
Add Contact to https://rvlt.gg/
Unless if I'm mistaken, there is a lot of room for abuse with
PUT
andDELETE
. We should make a permissions pop up eventually.Perhaps approve permissions by URL, with temporary and permanent options?