Challenges
Audit, debug and reason about real code. Every answer explained.
ESAudit dynamic expression evaluation
Review a function that executes an expression supplied by an untrusted caller.
Audit a user-controlled file path
Review a file read that joins an untrusted name to a trusted directory.
Audit a dynamic HTML sink
Identify the injection risk when a user-controlled name is inserted as HTML.
Audit a database query
Identify the injection risk in a query built by concatenating user input.
Audit a post-login redirect
Identify the open-redirect risk in a destination copied directly from a request.
Close a file on every return path
Find why a file handle stays open after the function returns.
Fix an off-by-one loop
Find the loop boundary that can access one item past the end of an array.
Fix parseInt used as a map callback
Debug unexpected NaN values caused by extra callback arguments.
Fix a shared default list
Find why tags from one call unexpectedly appear in a later call.
Fix mixed string and number addition
Find why a numeric calculation returns a string when price comes from a form.
Read an array slice
Apply the inclusive start and exclusive end indexes of Array.slice.
Read a dictionary fallback
Trace a dictionary lookup with a fallback and a string normalization chain.
Read a filtered accumulator
Trace a loop that adds only values meeting a remainder condition.
Read a short-circuit expression
Determine the exact value returned by a short-circuit expression.
Read a list comprehension
Trace a list comprehension that filters blank lines and normalizes the remaining text.
Refactor a filter-and-collect loop
Express a loop's selection and projection as two focused array operations.
Refactor a transformation loop
Replace a loop that builds a transformed array with a direct mapping operation.
Simplify nested conditions
Flatten nested checks while preserving the original access rule.
Refactor repeated subtotal logic
Remove duplicated quantity checks by reusing the subtotal function.
Refactor repeated email normalization
Extract a repeated normalization rule into one reusable function.