

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
An open redirect sends a user to a destination supplied by the requester. Unlike SSRF, the server isn't fetching the destination itself. The app is lending its trusted domain to an attacker-controlled redirect.
Imagine a conference site that carries a returnTo value through login and redirects to it afterward:
returnTo := request.FormValue("returnTo")
http.Redirect(responseWriter, request, returnTo, http.StatusFound)
If an attacker puts an external URL in a legitimate conference login link, the victim sees the trusted domain, signs in, and is immediately sent to a phishing site.
A shared helper can return a requested path only when it is explicitly allowlisted:
var allowedPaths = map[string]struct{}{
"/": {},
"/account": {},
"/schedule": {},
}
func Safe(value string) string {
if _, allowed := allowedPaths[value]; allowed {
return value
}
return "/"
}
A check such as strings.HasPrefix(value, "/") isn't enough. A scheme-relative URL like //evil.example begins with a slash but still sends the browser to another host. Exact matching also rejects crafted prefixes and internal destinations the flow doesn't need.
Bearly Secure already has an exact return-path allowlist, but its login handlers don't use it. Apply the shared redirect policy to every login flow.
With Bearly Secure still running, run and submit the CLI tests from the project root.