🛡️ Application Security — interview questions
12 questions. Filter by what the role asks for; open one for the six layers of the answer. The course is where the answers come from.
12 of 12
01An endpoint is behind a login, uses `@PathVariable Long id`, and looks up the order by that id alone. A pen test flags it as broken. The endpoint clearly requires authentication — so what's actually broken, and why does the fix belong in the query rather than after it?Authorizationeasy0-2y02A teammate proposes fixing a SQL injection finding by escaping single quotes in the input before building the query string. Why isn't that the same fix as switching to a PreparedStatement, even if it happens to stop the specific payload the scanner flagged?Injectioneasy0-2y03A junior engineer proposes storing `SHA-256(password)` for a new signup flow, reasoning that SHA-256 is a secure, one-way hash. What's wrong with that reasoning, and what does the fix actually add?Password storagemedium0-2y04A team is deciding between server-side sessions and JWTs for a new service that will eventually be called by several other internal services. What's the actual trade-off, and what does the JWT side give up that a naive "JWTs are stateless and therefore better" pitch misses?Sessions and tokensmedium3-5y05`@PostMapping("/users") public User create(@RequestBody User user) { return users.save(user); }` — the `User` entity has a `role` field with a public setter, because Hibernate's mapping needs one. What's the actual vulnerability here, and why does switching to a request DTO with only `name` and `email` fix more than just the `role` field?OWASP Top 10medium3-5y06A token was committed, noticed the next day, and removed in a follow-up commit — the working tree is clean and `git log` shows a commit titled "Move the token to an environment variable." Is this incident closed? Walk through what you'd actually do.Secretshard3-5y07`npm audit` reports four high-severity advisories in a project's dependency tree, and the team has marked them accepted rather than fixed. A new reviewer flags this as unresolved. Walk through how you'd actually evaluate whether that's the right call, and separately, what a committed lockfile is protecting against that `npm audit` doesn't touch.Dependenciesmedium3-5y08`PATCH /expenses/{id}/approve` has two rules: only users with role `MANAGER` may call it, and a manager may not approve their own expense. Why can the first rule be enforced with a method-level annotation before the method body runs, while the second structurally cannot — and what does that force about where the second check lives in the code?Authorizationhard5-8y09A team's JWT verifier reads the `alg` field from the token's own header to decide how to verify it. Why is that a real, historically exploited flaw, and what does pinning the expected algorithm in server-side configuration actually change about the verification process?Sessions and tokenshard5-8y10A service accepts a URL from the client and fetches it to generate a link preview. A teammate proposes blocking requests to URLs containing `169.254.169.254` or `localhost`. Why is that an incomplete defense against SSRF, and what would a defense-in-depth version actually look like?OWASP Top 10hard5-8y11A service issues JWT access tokens signed with `secret-A`, each valid for 15 minutes, with no server-side record of issued tokens. At 10:00 the team deploys `secret-B` and updates the verifier to accept both secrets. What is the earliest moment it's safe to make the verifier stop accepting `secret-A`, and why is that moment forced rather than a judgment call?Secretssenior8+y12A team currently uses bcrypt and is evaluating a move to scrypt or Argon2id, reasoning that "they're all slow, adjustable password hashes, so it's a lateral move." What's actually different about scrypt's memory-hardness compared to bcrypt's CPU cost, and why does that distinction matter for what an attacker can practically do?Password storagesenior8+y