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

Adds scoped permissions #386

Merged
merged 8 commits into from
Feb 20, 2018
Merged

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented Feb 19, 2018

🎥 https://youtu.be/v6wuFRDKVBU

This PR introduces scope based permissions - following a similar implementation as service worker registration scopes.

This means that allowing access to:
https://ipfs.io/ipfs/QmQxeMcbqW9npq5h5kyE2iPECR9jxJF4j5x4bSRQ2phLY4/

will allow access to:
https://ipfs.io/ipfs/QmQxeMcbqW9npq5h5kyE2iPECR9jxJF4j5x4bSRQ2phLY4/path/to/something

...but not:
https://ipfs.io/ipfs/QmWfVY9y3xjsixTgbd9AorQxH7VtMpzfx2HaWtsoUYecaX

or other hashes.

resolves #375


Scopes

Permissions are scoped to the origin and path (and sub-paths) of the file from which the permission was requested.

Scoped permissions in window.ipfs work similarly to how they work for service worker registrations except that the user cannot control the scope, and it is set to the origin and path from which the permission was requested.

Scope based permissions allow applications running on an IPFS gateway to be granted different permissions. Consider the following two web sites running on the ipfs.io gateway:

With same-origin policy these two applications would be granted the same permissions. With scoped permissions, these applications will be given a different set of permissions.

e.g.

  • Allow files.add to https://domain.com/
    • ...will allow files.add to:
      • https://domain.com/file
      • https://domain.com/file2.html
      • https://domain.com/sub/paths
      • https://domain.com/sub/paths/files
      • etc.
  • Allow files.add to https://domain.com/feature
    • ...will allow files.add to:
      • https://domain.com/feature/file
      • https://domain.com/feature/file2.html
      • https://domain.com/feature/sub/paths
      • https://domain.com/feature/sub/paths/files
      • https://domain.com/featuresearch/sub/paths/files (note substring)
      • https://domain.com/features.html (note substring)
      • etc.
    • ...will cause additional prompt for files.add to:
      • https://domain.com/
      • https://domain.com/files
      • etc.

@lidel lidel added this to the 2018-Q1 milestone Feb 19, 2018
@alanshaw alanshaw changed the title [WIP] Adds scoped permissions Adds scoped permissions Feb 19, 2018
Bundled page loaded using browser.windows.create
won't show contents unless resized.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1402110
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

👍 from me (added small fix for FF in inf9b60ff )

@lidel
Copy link
Member

lidel commented Feb 20, 2018

While I was at it, I made ACL dialog work on Android too ✨

8fekisdl png

@lidel lidel merged commit a5061d3 into ipfs:master Feb 20, 2018
@alanshaw alanshaw deleted the feat/scoped-permissions branch February 20, 2018 14:14
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.

Isolate ACL for window.ipfs on IPFS paths (assume HTTP gateway)
2 participants