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

Don't allow writable API to edit the _memory database #1917

Closed
simonw opened this issue Nov 30, 2022 · 2 comments
Closed

Don't allow writable API to edit the _memory database #1917

simonw opened this issue Nov 30, 2022 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Nov 30, 2022

It shows up on https://latest.datasette.io/-/api (once you are signed in as root) - but there's no point in creating tables in it because they likely won't persist from one request to the next, as it's not a shared named database.

image

@simonw simonw added this to the Datasette 1.0a1 milestone Nov 30, 2022
@simonw
Copy link
Owner Author

simonw commented Nov 30, 2022

The problem might actually be here:

datasette/datasette/app.py

Lines 280 to 281 in 9f5321f

if memory or crossdb or not self.files:
self.add_database(Database(self, is_memory=True), name="_memory")

is_mutable defaults to True, so this line should probably be:

     self.add_database(Database(self, is_mutable=False, is_memory=True), name="_memory")

@simonw
Copy link
Owner Author

simonw commented Nov 30, 2022

Yeah it looks like I introduced this bug here:

fb7e70d

@simonw simonw closed this as completed in 6b47734 Nov 30, 2022
simonw added a commit that referenced this issue Dec 1, 2022
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