Repository navigation
Security notice: hard-coded API key and session secret in ApostropheCMS starter kits #5680
BoDonkey
announced in
Announcements
Replies: 1 comment
|
Just a quick note that the code in question would go in |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We have discovered a hardcoded API key and hardcoded session secret in our Astro starter kit projects, astro-public-demo and astro-public-demo-multisite, and one additional non-Astro starter kit, public-demo-multisite.
If you created a project after February 1st, with our CLI or by cloning one of these repositories, you should immediately check your project for the string
myapikeyand remove that API key configuration from your code and redeploy your project, if it is in production. Also update the session secret to a new random string if it is hard-coded to:e45faf16a3e6f86aThis was a code example that was never intended to ship in our starter kits. We apologize for the lapse and recognize the impact it could have on projects downstream.
To be clear, there was no vulnerability in
apostropheitself. Only projects cloned from our starter kits are affected.To safely read both from environment variables, we recommend the code below. Note that in this example the API key is optional: if you don't want a REST API key with admin privileges, don't set the environment variable, or leave out that part of the code entirely.
In a local development environment,
APOS_SESSION_SECRETdoes not have to be set. (You should always setNODE_ENV=productionin production and similar environments.)In production the app now refuses to start without
APOS_SESSION_SECRET, while local dev still works with no setup. The API key stays optional everywhere, since running without one is a valid configuration. If you don't have a need for it, don't set it.You can use any secure password generator to generate keys and secrets, or use:
openssl rand -hex 32To prevent a recurrence, we will add linter rules that forbid hardcoded API keys and session secrets in the source code.
All reactions