

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Managing Secrets
incomplete
2: Injecting Secrets at Runtime
incomplete
3: Protecting Secrets
incomplete
4: Build Artifacts and Deployment Hygiene
incomplete
5: Limiting Build Context
incomplete
6: Source Code and Config Leaks
incomplete
7: Public File Leaks
incomplete
8: Server-Side Request Forgery
incomplete
9: Defending Against SSRF
incomplete
10: Open Redirects
incomplete
11: Risks of Dependencies
incomplete
12: Auditing Dependencies
incomplete
13: Dependency Maintenance
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Moving a secret out of source code is only the first step. Local files that contain injected secrets also need to stay out of version control.
As a general rule, environment files should be ignored by version control.
.env*
!.env.example
That said, a .env.example file is conventionally committed with dummy examples of the values the app expects in .env.
APP_ORIGIN=http://localhost:3000
TICKET_PROVIDER_KEY=replace_with_your_ticket_provider_key
Developers can copy that template into a local .env file and supply their own values.
Node.js 24 can load a file through --env-file-if-exists=.env. Adding that flag to the local dev and start scripts loads .env when it exists without making the file mandatory. Shells and production environments can simply inject the variable directly.
Bearly Secure requires runtime configuration, but its local scripts do not load .env yet. Add a safe local environment-file workflow.
PAWPAL_API_KEY=replace_with_your_pawpal_api_key
DOWNLOAD_SIGNING_KEY=replace_with_64_hex_characters
APP_ORIGIN=http://localhost:3000
--env-file-if-exists=.env
openssl rand -hex 32
git check-ignore .env
npm run dev
Run and submit the CLI tests from the project root.