Detect Bulk Download Bursts in Enterprise Audit Logs

Last updated: November 29, 2026

Quick Overview

Given audit events of (user, timestamp, action, file_id), return each user who downloaded at least N distinct files within any sliding window of W seconds, with the first window where it happened.

Box
Data Manipulation (SQL/Python)
Data Scientist
Box
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given audit events of (user, timestamp, action, file_id), return each user who downloaded at least N distinct files within any sliding window of W seconds, with the first window where it happened.

Mass downloading before an employee leaves is a classic insider-risk signal that Box Shield style anomaly detection looks for. The screen checks a correct sliding window over distinct items, sensible filtering of event types, and judgement about thresholds and false positives.

What the Interviewer Expects
  • Filters to download actions only
  • Groups by user and sorts by time
  • Maintains a sliding window with a counter so repeated downloads of one file count once
  • Reports the first qualifying window, not just a boolean
  • Talks about per-user baselines rather than one global threshold
Key Topics to Cover
Sliding windows
Counters
Sorting by time
Insider threat signals
False positive control
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you set N and W per enterprise or per role?
  • How would you run this continuously on a stream instead of a batch file?
  • Which legitimate behaviours (Box Drive sync, backup tools, service accounts) would trigger it, and how do you exclude them?
  • How would you rank flagged users for a security analyst with limited time?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Each row is (user, ts in seconds, action, file_id). Actions include preview, download, upload. I would confirm whether Box Drive sync and API service accounts generate download rows, since they can ...

Approach

Per user, sort downloads by time and slide a window of width W. Keep a deque of events in the window and a Counter of file ids so the distinct count is len(counter). When the count reaches N, record...


Submit Your Answer
Markdown supported

Related Questions