Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

GitHub Engineering 10 min read Deep dive mediumAdept

Fixing security vulnerabilities with AI

Copilot Autofix turns CodeQL security alerts into LLM-suggested fixes by building a prompt from the query help, the alert message, and code snippets along the data-flow path. The model returns a natural-language explanation, before/after code blocks (chosen over raw diffs because models miscompute line numbers), and a list of needed dependencies. Post-processing then applies fuzzy matching, syntax and semantic checks, and package-registry vetting. An automated harness over 1,400+ JavaScript/TypeScript alerts with test coverage counts a fix as successful only if it clears the alert, adds no new alerts or syntax errors, and leaves test outcomes unchanged; iterating against it tripled the success rate while cutting LLM compute sixfold.

Assumes: static analysis basicsLLM promptingtaint/data-flow analysis

Related posts

  • Using Docker AI Tools for Devs to Provide Context for Better Code Fixes

    Docker mediumAdept

    LLMs fix lint violations far better when given the surrounding code, so Docker Labs built a prompt-driven pipeline where each step runs in a container: Pylint produces a violation report, violations are loaded into SQLite, and Tree-sitter parses the project into an AST whose top-level statement ranges are indexed alongside the source. The LLM then queries this database (writing its own SQL from the schema) to retrieve the enclosing function for a violation before proposing a fix. This sidesteps context-window limits of reading whole files, and the same pattern generalizes to any tool that maps code locations to issues.

  • From single pull requests to full software packages: Detecting malicious code at scale

    Datadog Engineering mediumAdept

    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. The agent uses GitHub APIs, osv.dev and SCA to check context such as author history and reverted commits. On 690 test diffs the two-stage design raised accuracy from 97.4% to 99.86% by cutting false positives from 17 to 0, and static typosquat-domain checks cover gaps in the filter. For large packages, giving the agent a codemap plus an on-demand ReadFile tool beat both forwarding the flagged chunk and rechunking, reaching 95.2% end-to-end accuracy with no runtime errors. Projected costs are about $0.025 per median package and $0.072 at p90, and a crawler polls npm and PyPI every 10 minutes, caching verdicts by hash and diffing against the previous version.

  • Detecting malicious pull requests at scale with LLMs

    Datadog Engineering mediumAdept

    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.

  • Introducing AutoPatchBench: A Benchmark for AI-Powered Security Fixes

    Meta Engineering hardMaster

    AutoPatchBench is a benchmark of 136 fuzzing-found C/C++ vulnerabilities from real projects, curated from the ARVO/OSS-Fuzz dataset, for evaluating AI program repair agents. It is part of Meta's CyberSecEval 4 suite. Samples were kept only if they had reproducible crashes, valid stack traces, building vulnerable and fixed containers, and ground-truth patches that survive further fuzzing. A 113-sample Lite subset covers bugs whose root cause sits in a single function. Generated patches are checked by rebuilding, re-running the crashing input, fuzzing again, and LLDB-based white-box differential testing that compares program state against the ground-truth fix at the lowest common ancestor of the patched call stacks, with heuristics to handle nondeterminism and timeouts.

  • CyberSecEval 2 - A Comprehensive Evaluation Framework for Cybersecurity Risks and Capabilities of Large Language Models

    Hugging Face easyNovice

    CyberSecEval 2 is Meta's open-source benchmark suite measuring LLM cybersecurity risks across five areas: insecure code generation (mapped to CWE), prompt injection susceptibility, compliance with cyber-attack requests versus false refusals of benign prompts, code interpreter abuse, and automated CTF-style exploitation. Average compliance with attack-assistance requests fell from 52% to 28% since the December 2023 version, and code-specialized models are closing the safety gap with general models. Prompt injection remains unsolved, so developers should not trust system prompts to hold against adversarial input. Interpreter abuse calls for extra guardrails, while end-to-end exploitation is still beyond current models.

The quest for software engineering knowledge.

Look:
Layout: