---
title: "Detecting malicious pull requests at scale with LLMs"
description: "Datadog's SDLC Security team built BewAIre, an LLM-based reviewer that classifies the diff of every merged PR (nearly 10,000 a week) as benign or malicious, with a written rationale emitted as a security signal for real-time triage."
url: "https://swe.quest/articles/detecting-malicious-pull-requests-at-scale-with-llms-18b7d45442154d44"
canonical: "https://www.datadoghq.com/blog/engineering/malicious-pull-requests/"
source: "Datadog Engineering"
published: "2025-10-21"
difficulty: "medium"
kind: "Case study"
reading_minutes: 12
tags: ["supply-chain-security","threat-detection","llms","code-review","evals"]
---

# Detecting malicious pull requests at scale with LLMs

A post on [Datadog Engineering](https://swe.quest/sources/datadog.md), published 2025-10-21, 12 min read, Case study. Original: [https://www.datadoghq.com/blog/engineering/malicious-pull-requests/](https://www.datadoghq.com/blog/engineering/malicious-pull-requests/)

## Summary

Datadog's SDLC Security team built BewAIre, an LLM-based reviewer that classifies the diff of every merged PR (nearly 10,000 a week) as benign or malicious, with a written rationale emitted as a security signal for real-time triage. Large diffs are recursively chunked at file markers, then newlines, then midpoints, and the most severe chunk verdict wins, with depth and chunk limits to bound cost. A hand-curated, weekly-updated dataset of real and simulated attacks, prompt-level false-positive exclusions, balanced accuracy as the metric, shadow-mode triage and red teaming cut false positives from over 10% to 0.03%. On the curated set it reached over 99.3% accuracy and caught the tj-actions and Nx s1ngularity malicious commits.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Supply chain security](https://swe.quest/tags/supply-chain-security.md) (Security)
- [Threat detection](https://swe.quest/tags/threat-detection.md) (Security)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Code review](https://swe.quest/tags/code-review.md) (Engineering practices)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)

## Prerequisites

- LLM prompting basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- GitHub pull requests and Actions
- software supply chain attacks ([easy posts on Supply chain security](https://swe.quest/tags/supply-chain-security.md?difficulty=easy))

## Keywords

BewAIre, Datadog, tj-actions/changed-files, Nx s1ngularity, GitHub Actions, npm

## Related posts

- [From single pull requests to full software packages: Detecting malicious code at scale](https://swe.quest/articles/from-single-pull-requests-to-full-software-packages-detecting-malicious-code-at-717a58a001a046a1.md): Datadog Engineering · 2026-06-02 · Medium · 12 min read · Supply chain security, Threat detection, AI agents, LLMs, Cost optimization
  Datadog extended BewAIre, its LLM-based malicious code detector, from pull requests to full dependency packages by stacking a cheap filter model in front of an agentic investigation model.
- [Finding leaked passwords with AI: How we built Copilot secret scanning](https://swe.quest/articles/finding-leaked-passwords-with-ai-how-we-built-copilot-secret-scanning-26ede51a550b66b2.md): GitHub Engineering · 2025-03-04 · Medium · 8 min read · LLMs, Evaluation, Security, Capacity planning
  GitHub replaced regex-based detection of generic passwords with an LLM prompt that judges candidate secrets from their file context.
- [Leveraging AI for efficient incident response](https://swe.quest/articles/leveraging-ai-for-efficient-incident-response-c0ed9d554ec34552.md): Meta Engineering · 2024-06-24 · Medium · 5 min read · Incidents & postmortems, LLMs, Model training, Debugging
  Meta's AI-assisted root cause analysis system narrows suspect code changes in its web monorepo by combining a heuristic retriever with a fine-tuned Llama 2 (7B) ranker.
- [When an AI agent came knocking: Catching malicious contributions in Datadog’s open source repos](https://swe.quest/articles/when-an-ai-agent-came-knocking-catching-malicious-contributions-in-datadog-s-efd5d1e84be0c443.md): Datadog Engineering · 2026-03-09 · Medium · 16 min read · Supply chain security, CI/CD, Threat detection, AI agents, Open source
  An AI agent called hackerbot-claw targeted Datadog's public repositories in late February 2026.
- [How Dropbox uses MCP and Dash to close the design-to-code security gap](https://swe.quest/articles/how-dropbox-uses-mcp-and-dash-to-close-the-design-to-code-security-gap-d84e01af101676b6.md): Dropbox Tech · 2026-06-12 · Easy · 9 min read · AI agents, Application security, Code review, LLMs, RAG & retrieval
  Dropbox built a code-review agent that uses Dash's MCP server to retrieve relevant threat models and has a foundational LLM check whether a pull request actually implements the security requirements agreed during design review.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
