Zero Bytes Accepted
An upload endpoint validates through a chain.
class Handler:
def __init__(self, nxt=None): self.nxt = nxt
def handle(self, req):
rejection = self.check(req) # a Response, or None
if rejection is not None:
return rejection
return self.nxt.handle(req) if self.nxt else None
chain = SizeCheck(TypeCheck(VirusScan()))
def upload(req):
rejection = chain.handle(req)
return rejection if rejection else accept(req)
Four requests, and the response each one actually gets:
| # | size | extension | virus signature | response |
|---|---|---|---|---|
| 1 | 12 MB | .png |
none | 413 |
| 2 | 2 MB | .gif |
none | 415 |
| 3 | 2 MB | .png |
matched | 422 |
| 4 | 0 bytes | .png |
none | 202 |
Three of those rows are a handler doing its job. Which row exposes a flaw in the chain itself, and what is the flaw?
Sign in to answer questions and track your progress
Sign In