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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fixed staff token can't export DB #16094

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

urish
Copy link

@urish urish commented Jan 10, 2023

Allows staff tokens to make backups of the DB by issuing a GET request to the /db API endpoint. My use case is automatic daily backups (from a GitHub action).

  • There's a clear use-case for this code change, explained below
  • Commit message has a short title & references relevant issues
  • The build will pass (run yarn test:all and yarn lint)

p.s. it might be worth noting that yarn test:all should be run inside ghost/core, it took me a white to figure that out.

Allows staff tokens to make backups of the DB by issuing a GET request to the `/db` API endpoint.
@markstos
Copy link
Contributor

I agree about the note about yarn test:all-- as a fellow ghost user, that tripped me up too.

I can see how supporting DB exports via the API could be convenient for what you describe, but it also brings added risks because it makes it easier to ex-filtrate personally identifiable information (PII), including names and emails.

An alternate way to make daily backups is run a cron job or other daily timer which backups up the MySQL database and uploads that somewhere. Or, if you are using Cloud hosting, you have the option to trigger daily snapshots.

Finally, you can reverse engineer how the web-based backups created by admins are authenticated and use your same kind of pattern by setting those auth headers. It seems the admin cookies may expire after a few months, so if you attempt this you may need some way to refresh the admin cookie periodically.

Because this is rarely requested feature and because it comes with additional data privacy risk, I recommend against merging this PR.

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.

None yet

2 participants