LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Reverse engineer a binary packfile
BUILD → VERIFY → EXPLAIN · STEP 5 OF 6

Defend against malformed and corrupted streams

Harden the parser against path traversal, header overlaps, and out-of-bounds entries.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Validate that filenames do not contain path traversal indicators ('../' or slashes).
  2. Enforce that entry offsets do not overlap the header table itself (offset >= headerSize).
  3. Verify that entry offsets and sizes do not extend beyond the total buffer length.
function sanitizeArchive(buffer, header, entries) {
  // Validate path traversal, overlap with header, and stream boundaries.
}
Need a hint?
  • Reject filenames containing '/', '\\', or '..' before extraction.
  • Ensure entry.offset >= header.headerSize to prevent overlapping with metadata tables.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 1 through 6 5

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

How does the 'Zip Slip' vulnerability work, and how does filename sanitization protect extraction boundaries?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep