

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
Imagine a recipe app that correctly limits static serving to public/, but leaves public/internal-config.json inside that directory. Derp.
You could blacklist that one URL:
app.use(
express.static("public", {
index: false,
dotfiles: "ignore",
setHeaders: (res, path) => {
if (path.endsWith("internal-config.json")) {
res.status(404).end();
}
},
}),
);
But now you're relying on some logic someone might forget about to make your /public directory secure. Just remove private data from public/ entirely. It's simpler, and simpler is easier to keep secure.
An obscure filename or unlinked URL doesn't make a public file private. If server-side code needs the file, store it outside public/.
Bearly Secure publishes operational details from public/internal-config.json.
With Bearly Secure still running, run and submit the CLI tests from the project root.