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

/-/metadata and so on should respect view-instance permission #833

Closed
simonw opened this issue Jun 11, 2020 · 4 comments
Closed

/-/metadata and so on should respect view-instance permission #833

simonw opened this issue Jun 11, 2020 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Jun 11, 2020

The only URLs that should be available without authentication at all times are the /-/static/ prefix, to allow for HTTP caching.

@simonw
Copy link
Owner Author

simonw commented Jun 11, 2020

A live demo running the datasette-auth-github plugin will help demonstrate this.

@simonw
Copy link
Owner Author

simonw commented Jun 11, 2020

I'm tempted to add a view-instance check before routing any URLs, but that wouldn't be compatible with the idea in #832 that having view-table should be enough to view a table even if you don't pass view-instance.

@simonw
Copy link
Owner Author

simonw commented Jun 11, 2020

I'll add a new test in test_permissions.py which locks down an instance and then loops through paths as the anonymous user making sure they aren't accessible.

@simonw
Copy link
Owner Author

simonw commented Jun 11, 2020

@pytest.mark.parametrize(
"path",
[
"/",
"/fixtures",
"/fixtures/facetable",
"/-/metadata",
"/-/versions",
"/-/plugins",
"/-/config",
"/-/threads",
"/-/databases",
"/-/actor",
"/-/permissions",
"/-/messages",
"/-/patterns",
],
)
def test_view_instance(path, view_instance_client):
assert 403 == view_instance_client.get(path).status
if path not in ("/-/permissions", "/-/messages", "/-/patterns"):
assert 403 == view_instance_client.get(path + ".json").status

simonw added a commit that referenced this issue Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant