{"slug": "how-we-built-a-security-harness-that-finds-real-vulnerabilities", "title": "How We Built a Security Harness That Finds Real Vulnerabilities", "summary": "CodeRabbit detailed a security harness that divides a repository into context-window-sized assignments, records which code was actually inspected, and hands unresolved areas to fresh investigators, addressing the problem that a coding agent can exhaust its context window and budget on one security lead and leave parts of a repository unexplored. The harness cites specific code for each completed assignment, flags gaps even when no finding is reported, and routes findings to an independent verifier model that can accept, reject with a reason, or send a specific question back to the investigator. CodeRabbit cited Google Cloud's Security 2027 forecast in arguing that security agents will enter everyday software delivery by 2027.", "body_md": "A coding agent can use up its context window and budget following one security lead, leaving parts of a repository unexplored.\n\nThe unexplored parts matter more as teams ship more code. Every line still belongs to someone who has to maintain it, secure it, and answer for what happens when it fails. We think 2027 will bring security agents into everyday software delivery, and [Google Cloud's Security 2027 forecast](https://blog.google/innovation-and-ai/infrastructure-and-cloud/google-cloud/cybersecurity-2027/) makes a similar case.\n\nAt CodeRabbit, we approach security scanning as a mapping and search problem. The harness decides where to look, records what got inspected, and sets the standard of evidence for a finding.\n\n## How do you know what the scan covered?\n\nDivide the repository into sections an investigator can understand within one context window. A service or subsystem is a good starting point, as long as the investigator can also see the surrounding code it needs.\n\nKeep track of what the scan was supposed to cover and what it actually inspected. For each completed assignment, cite the relevant code and note any gaps, even if no finding was reported. Compare the evidence with the original scope. If only part of the assignment is covered, leave the rest open for another pass.\n\nSuppose a scan was assigned to review a service and its background jobs, but its notes cite only the service. Leaving the jobs open tells the next investigator where to start and shows the team what was covered.\n\n```\nassignment: billing-service-and-jobs\nscope:\n  - services/billing/ # request handlers and invoice logic\n  - jobs/billing/ # background jobs for the same service\nstatus: partial\n\ninspected:\n  - area: services/billing/\n    result: no finding\n    evidence:\n      - services/billing/handlers/refund.ts:41-118 # ownership check before a refund\n      - services/billing/invoice/totals.ts:12-67 # amount validation\n\nopen:\n  - area: jobs/billing/\n    reason: in scope, but no code from this area is cited\n    next: assign to another pass\n```\n\n## When the answer is in another repository\n\nInvestigations typically begin with a map. As agents gather evidence, new questions come up. The orchestrator that assigns the work can pass a focused follow-up question and the evidence gathered so far to another investigator. That investigator gets fresh context to work on the question while the harness keeps track of the rest of the scan.\n\nThe answer may be in a [shared library or a deployment repository](https://www.coderabbit.ai/blog/multi-repository-security-analysis-with-coderabbit-secure). Let’s say a service relies on a library to make an access decision. The service code points to where the decision is made, the library shows which policy it applies, and the deployment configuration establishes which version is in use. Looking across those sources lets an investigator narrow a finding or gather enough evidence to close it.\n\n## Give each finding an independent review\n\nA finding starts as a hypothesis, so ask an independent model to check the cited code for evidence that could change the conclusion:\n\n- Can the code be reached?\n- What could happen if it is?\n- Are there safeguards?\n- What is still unknown?\n\nGive the verifier clear criteria and let it disagree. It can accept a finding if the evidence supports it, reject it with a reason, or send a specific question back to the investigator. A second pass is worth the effort when the answer could change the verdict.\n\nIf a question about configuration is still open, the verifier can explain what evidence is missing and how it could affect the finding. The investigator then knows what to check next and when the follow-up is complete, and the developer sees which part of the conclusion still depends on an assumption.\n\n## Match the model to the job\n\nMapping a repository, investigating a candidate, and verifying a finding ask different things of a model. A fast model may be enough to build an inventory, while an investigation that crosses several trust boundaries may call for a stronger reasoning model. A verifier from a different model family can surface assumptions the investigator carried forward.\n\nDefine what evidence each stage receives and what it must return so you can swap a model without rebuilding the workflow. Evaluate the full pipeline against [known vulnerable revisions and their patched counterparts](https://www.coderabbit.ai/blog/security-agent-benchmarks). Track what the search misses, what the verifier incorrectly dismisses, and which false positives reach the report. A model that scores well on its own can still make the overall scan worse.\n\n## What can you confirm in a running deployment?\n\nThe code tells you what an application can do. The deployed version and its configuration determine which paths are exposed and which controls apply. Ingress rules, service identities, and feature flags can all affect a finding. When exposure is uncertain, record your assumption alongside the severity.\n\nFor findings that can be tested, an [isolated runtime check](https://www.coderabbit.ai/blog/runtime-verification-in-coderabbit-secure) can provide more evidence. The result should show whether the application was ready, the intended code ran, and the test could observe the behavior. If any of those conditions is unclear, the result is inconclusive. An application that never finished starting, for example, leaves the question open even if the test recorded an error, and the result should say so plainly so reviewers can judge what it supports.\n\n## What changes should trigger a rescan?\n\nStart with a full scan to establish a baseline, then review new changes for issues, looking beyond the diff. A small change to a shared authorization check can affect every caller that uses it. Once the change lands, revisit findings that may rely on outdated evidence.\n\nChanges to the deployment or the model can also invalidate earlier conclusions. A configuration change might expose a path that was previously unreachable, and a model update might improve discovery while making verification less reliable. Keep evidence tied to the code revision, environment, and scan that produced it so you know what needs another look.\n\nThat evidence also helps teams decide where to focus the next scan. If a shared library changes, revisit the findings that relied on it and check which services use the changed version. If deployment settings change, revisit conclusions that depended on those settings. The baseline gives you a point of comparison as the system changes.\n\n## Try Deep Scan in CodeRabbit Secure\n\nWe built [Deep Scan](https://docs.coderabbit.ai/security/deep-scan) to investigate code you’ve already shipped. It maps the primary repository, can consult linked repositories for evidence, and verifies candidate findings before reporting them. For supported findings, Runtime Verification can help you test the suspected behavior in an isolated environment and inspect the evidence.\n\n[Run your Deep Scan](https://app.coderabbit.ai/login) on a repository that owns a critical workflow today.", "url": "https://wpnews.pro/news/how-we-built-a-security-harness-that-finds-real-vulnerabilities", "canonical_source": "https://coderabbit.ai/blog/how-we-build-a-security-harness-that-finds-real-vulnerabilities", "published_at": "2026-11-24 12:00:00+00:00", "updated_at": "2026-11-24 16:45:26.889357+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-tools", "developer-tools"], "entities": ["CodeRabbit", "Google Cloud"], "also_reported_by": [], "takeaway": "Scope each security scan to a service or subsystem that fits one context window, record cited code and open gaps per assignment, and send findings to an independent verifier model that can accept, reject with a reason, or return a specific follow-up question.", "recommendation": {"advice": "Split repository scans into context-window-sized assignments with explicit scope, cite inspected code and leave uncovered areas open for another pass, and route each finding to an independent verifier that can reject it or ask a specific follow-up question.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/how-we-built-a-security-harness-that-finds-real-vulnerabilities", "markdown": "https://wpnews.pro/news/how-we-built-a-security-harness-that-finds-real-vulnerabilities.md", "text": "https://wpnews.pro/news/how-we-built-a-security-harness-that-finds-real-vulnerabilities.txt", "jsonld": "https://wpnews.pro/news/how-we-built-a-security-harness-that-finds-real-vulnerabilities.jsonld"}}