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

Database sharing and access control #281

Open
4 of 8 tasks
marcua opened this issue Jan 19, 2024 · 14 comments
Open
4 of 8 tasks

Database sharing and access control #281

marcua opened this issue Jan 19, 2024 · 14 comments

Comments

@marcua
Copy link
Owner

marcua commented Jan 19, 2024

Rough description

A database owner should be able to allow other users/entities to have following levels of access

  • read-only access
  • read/write access
  • manager (to be able to control sharing with anyone except the owner)

A database owner should also be able to control whether the public can have various forms of read-only access

  • metadata only
  • forking
  • read-only querying

The plan

@sofiaritz
Copy link
Contributor

I think we should combine forking and querying, if someone can fork the database then they can run read-only queries as well :)

@marcua
Copy link
Owner Author

marcua commented Jan 21, 2024

Definitely before we have forking support and support for varying memory/CPU for different databases, I agree. :)

The reason I was thinking someone might want to give fork read-only access but not query read-only access is because queries take up resources on your running database, whereas forking doesn't. So perhaps in the future when you want someone to look at your dataset but don't want them to use up your CPU running queries, you can say "fork my dataset and let me know what you find!" without having to worry about beefing up your own running database.

Definitely not something we have to worry about for a while :).

@marcua marcua moved this to To do in ayb roadmap Jul 14, 2024
@marcua
Copy link
Owner Author

marcua commented Sep 2, 2024

Working on this next! Came up with a rough outline of a plan in the issue description!

@marcua
Copy link
Owner Author

marcua commented Sep 15, 2024

SQLite data models work, and started on Rust data models. For next time

  • Add instructions on setting up postgres for testing to readme. Need createuser -P postgres_user (enter password test), then
    • [ubuntu] sudo -u postgres psql -c "alter user postgres_user createdb;"
    • [macos] createuser -s postgres, psql -U postgres -c "alter user postgres_user createdb;"
  • Add non-linux-specific code to isolation/nsjail path that stderr-warns you nsjail won't work if you have an isolation configuration, but then continues to run
  • on permissions-datamodels branch, fix whatever the postgres issue is after getting installation working
  • continue developing on permissions-rustdatamodels

@marcua
Copy link
Owner Author

marcua commented Sep 22, 2024

@marcua
Copy link
Owner Author

marcua commented Sep 26, 2024

Done

  • permissions-rustdatamodels now has the data models
  • fields on existing database CRUD queries handle public_sharing_level
  • client and server handle public sharing level on database creation

Next

  • Database support for updating public_sharing_level. We already support setting it on creation, so we need an endpoint to update the database.
  • Database support for create/update/remove entity_database_permission

@marcua
Copy link
Owner Author

marcua commented Sep 29, 2024

Reworked plan to be endpoint-focused (e.g., expose public sharing first) rather than layer-focused (e.g., implementing all DB functionality first, but no endpoints are exposed).

First up: Add endpoint to support updates to a database's public sharing level. Make this a generic update_database endpoint. Permissions: must be manager or owner.

@marcua
Copy link
Owner Author

marcua commented Oct 7, 2024

Almost done with endpoint to update public sharing level.

Next

  • Finish update public sharing level
  • Fix issue for update_profile and update_database where no arguments results in a SQL syntax error
  • CRUD support for entity_database_permission

@marcua
Copy link
Owner Author

marcua commented Oct 9, 2024

Server-side support for public sharing level updates done. Started writing end-to-end tests.

Next

  • Add client-side support, merge
  • Finish writing tests for public sharing endpoint and permissions
  • Support listing database
  • Support read-only

@marcua
Copy link
Owner Author

marcua commented Oct 19, 2024

public_sharing_level is now updateable! Introduced read-only mode in SQLite!

Next up:

  • Support read-only mode by 1) determining which mode to run queries in the query endpoint, and 2) updating tests to confirm it worked.
  • Support listing database

@marcua
Copy link
Owner Author

marcua commented Oct 27, 2024

List and query logic and tests are all set (exposed to the query and entity details endpoints, passed through properly to rusqlite). Next

  • Clean up some debugging I did to figure out correct SQLite flags (SQLITE_OPEN_CREATE should only co-exist with SQLITE_OPEN_READ_WRITE)
  • Catch "executing write on read-only query" from rusqlite and pass it to client properly
  • Update tests with appropriate error from previous bullet

@marcua
Copy link
Owner Author

marcua commented Nov 5, 2024

Merged working support for fork/read-only public sharing level!

Next

  • Documentation
  • Version bump
  • CRUD for entity-level access to database

@marcua
Copy link
Owner Author

marcua commented Nov 14, 2024

Wrote up documentation for both public sharing level and entity-level permissions. Next

  • CRUD for entity-level access to database
  • Endpoint to call that CRUD
  • Update permissions logic to look up entity-level permissions

@marcua
Copy link
Owner Author

marcua commented Nov 17, 2024

Database-/endpoint-/CLI-level support for sharing is implemented (but untested) on branch permissions-crud. Next

  • Update permissions logic for read-only/read-write permissions
  • Update permissions logic for managers
  • Add tests (query levels, management permissions, ensure owners are protected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

2 participants