Design Context-Aware Secrets Detection Across Code and Documents

Last updated: November 29, 2026

Quick Overview

Design an ML system that finds API keys, passwords, private keys and tokens in source repositories, wikis, chat exports and office documents, with far fewer false positives than regex and entropy scanners.

Concentric Ai
ML System Design
Machine Learning Engineer
Concentric Ai
November 29, 2026
Machine Learning Engineer
System Design Round
ML System Design
Hard

0

0

0 solved


Design an ML system that finds API keys, passwords, private keys and tokens in source repositories, wikis, chat exports and office documents, with far fewer false positives than regex and entropy scanners.

Concentric AI has announced deep-learning based detection of secrets and keys inside enterprise data, a space where pure regex tools drown teams in test fixtures and placeholders. The interviewer wants a candidate-generation plus context-model architecture, a labeling strategy for rare positives, and a safe way to handle the secret values themselves.

What the Interviewer Expects
  • Split the problem into high-recall candidate generation and a precision model
  • Use context around the token, not only the token string
  • Plan labeling and synthetic data for very rare positives
  • Never log or store raw secret values
  • Pick metrics per secret type at a fixed alert budget
  • Add verification and remediation hooks
Key Topics to Cover
Candidate generation
Context models
Class imbalance
Precision at budget
Data handling
How to Approach This
  1. Start by mapping the business objective to a concrete ML objective and metric.
  2. Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
  3. Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
  4. Address the serving latency budget and whether batch or real-time inference is needed.
  5. Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
  • How would you safely verify that a detected AWS key is live?
  • A customer says every finding in their test folder is noise; how do you adapt per tenant?
  • How do you evaluate recall when you cannot know the secrets you missed?
  • Would you use an LLM for this, and where?
Sharpen Your Skills on Codemia

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

Practice ML System Design Problems
Sample Answer
Requirements

Input: text extracted from files and messages, billions of documents, mostly re-scans of unchanged data. Output: findings with secret type, location, confidence, masked preview and owner. Targets: rec...

High-Level Design

Stage 1, candidates: provider patterns (AWS AKIA prefixes, GitHub tokens, PEM headers, JWT shape), high-entropy substrings via Shannon entropy over base64/hex alphabets, and assignment patterns like...


Submit Your Answer
Markdown supported

Related Questions