

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
A web server can expose source code and configuration simply because its static-file boundary is too broad. Imagine a Go app that serves the entire working directory:
fileServer := http.FileServer(http.Dir("."))
mux.Handle("GET /", fileServer)
That might make /web/public/logo.png available, but it can also expose /go.mod, application source, and other project files.
Serve a deliberately curated directory instead:
publicFiles := http.FileServer(http.Dir("web/public"))
mux.Handle("GET /", publicFiles)
A URL prefix does not narrow the filesystem root by itself. Mounting the first handler under /assets/ would still publish files from .; it would only change the URLs used to reach them.