New York-headquartered Datadog expanded its internal BewAIre malicious-code detection system from pull-request diff reviews to continuous software supply-chain package scanning across internal dependencies and upstream npm and PyPI registries, raising evaluation accuracy from 97.4% to 99.86% across a representative sample of 690 test diffs by cutting false positives from 17 to 0, while detecting the real-world May node-ipc supply-chain compromise within 5 minutes of publication and publishing a customer security advisory less than 50 minutes later.
"BewAIre has grown far beyond its initial scope, evolving from an assistant code reviewer into a fundamental part of how we improve the security of our systems as the landscape continues to change," Datadog's Security Engineering team wrote.
Originally built as a single-pass LLM-as-judge diff analyzer, BewAIre hit accuracy, cost, and context-window ceilings as more capable reasoning models grew expensive and dependency upgrades introduced massive code diffs. At the same time, supply-chain compromises across ecosystems such as axios, LiteLLM, and Mistral required Datadog to inspect full upstream packages in addition to internal pull requests.
To overcome single-pass limits, Datadog re-architected BewAIre into a two-stage filter-and-investigation pipeline paired with a static domain preprocessor that flags typosquatting variants of legitimate Datadog domains. After evaluating three context-management strategies on large packages, the team adopted Strategy 3 (codemap plus on-demand file reads), lifting end-to-end package evaluation accuracy to 95.2% compared with 94.1% for the unchunked baseline, 93.7% for reused chunking, and 94.9% for parallel agent-phase chunking, before partnering with Datadog's Security Research team to launch continuous upstream registry monitoring.
In Stage 1, a fast, low-cost LLM screens chunked diffs with a binary suspicious-or-benign check, allowing 95% of benign changes to exit early. Flagged items escalate to Stage 2, a higher-reasoning investigation agent equipped with GitHub APIs to inspect commit histories, reverted commits, and contributor account age, alongside osv.dev, Datadog Software Composition Analysis (SCA), a structural codemap, and a ReadFile tool for targeted file inspection. For upstream registries, a crawler polls npm's CouchDB endpoint and PyPI's RSS feeds every 10 minutes, persisting npm sequence numbers and PyPI timestamps, resolving prior versions via semver-first or timestamp ordering, checking an S3 artifact cache and hash-keyed verdict store to evaluate only newly introduced version diffs, and routing flagged packages to Security Research analysts whose verified verdicts feed back into the training corpus.
Projected across the token-size distribution of the top 10,000 npm packages at a 95% Stage 1 gating rate, total evaluation cost averages $0.025 per package at p50 (5K tokens, with $0.016 filter cost) and $0.072 per package at p90 (87K tokens, with $0.038 filter cost), while achieving a 95.5% detection rate on Datadog's curated dataset of confirmed malicious packages.
Datadog's security teams are continuing to expand BewAIre's detection coverage and response speed to verify agent-generated code, skills files, and shared plan files before they enter critical environments.
Details
- City
- New York
- Organization
- Datadog
- Continent
- North America
- Country
- United States
- Category
- Software
- Type
- Deployment
- Id
- 05a348d7-5703-4136-860b-718f7197cb00
- Created At
- 27 Nov 2026