Policy2Rule: Executable Security Rules from Plain-Language JavaScript Policies
A tool that turns written company security policies into automatic rules that block unsafe code commits.
A CI tool that reads a company's written JavaScript security rules (e.g., 'no direct calls to the internal admin API outside checkout'), drafts them as formal analyzer rules with an LLM and human confirmation, and then enforces them automatically on every commit using an open, formally specified analysis framework.
Concept
Policy2Rule turns a security team's written JavaScript policies into CI-enforced checks. A security engineer pastes a plain-language rule — e.g., 'all network requests must go through the approved fetch wrapper' or 'no eval in production bundles' — and an LLM, in the interactive human-in-the-loop style of nl2spec, drafts a formal rule specification. The engineer confirms or corrects the draft in a side-by-side view; the confirmed rule is compiled against SAFE's documented intermediate representations and runs on every commit. Findings come back as ordinary CI comments: file, line, and the exact policy sentence that was violated.
The single wedge: organizations maintain secure-coding standards and review checklists that no tool enforces, because writing custom analyzer rules today means modifying poorly documented or closed tools. Policy2Rule makes the policy document itself executable.
Why now
- SAFE [0] is the first JavaScript analysis framework to ship both a formal specification and an open-source implementation, deliberately designed to be flexible, scalable, and pluggable so new analyses can be added at various compilation phases. Its own motivation states that most existing analyzers are poorly documented or not public — precisely the barrier that keeps enterprise policy rules out of tooling. Custom rules finally have a documented, formally specified target to compile against.
- nl2spec [5] demonstrates that LLMs can interactively translate unstructured natural-language requirements into formal specifications with human-in-the-loop correction, solving the error-prone manual formalization step as the rule-drafting front-end.
- VulInstruct [2] shows that state-of-the-art LLMs fail at vulnerability detection because they lack security specifications — the specifications an organization already writes are exactly the missing input, and Policy2Rule operationalizes them.
- A head-to-head benchmark of SonarQube, CodeQL, Snyk Code and LLMs [4] shows every off-the-shelf analyzer misses real vulnerabilities; none can know a company's internal API boundaries, which is what custom policy rules add.
- Readiness: SAFE is an open-source research framework with collaborative projects in progress, so the natural first deployment is an internal security-engineering pilot on one large JavaScript monorepo rather than a mass-market product.
Written by GLM · 28 Nov 2026
AI assessment
A high-conviction play that operationalizes the gap between written security policy and automated enforcement by leveraging a formally specified JS analysis framework.
- Evidence strength 4/5
- The idea synthesizes a formal JS framework (SAFE) with a proven NL-to-formal-spec methodology (nl2spec), though it assumes the SAFE IR is sufficiently expressive for the types of policies mentioned.
- Market pull 5/5
- Large enterprises with strict compliance and internal API boundaries have a high urgency to automate the enforcement of bespoke security policies that generic scanners miss.
- Novelty & moat 4/5
- While HouseRules and VulnConcept touch on prose-to-rule conversion, this is the first to target a formally specified analysis framework (SAFE) for deterministic enforcement rather than just pattern matching or agent-guidance.
- Feasibility 3/5
- The core components (LLM for translation, SAFE for execution) exist, but the 'compilation' from LLM output to SAFE's specific IR is a non-trivial engineering hurdle.
- Wedge clarity 5/5
- The focus on turning written security checklists into CI-enforced rules is a sharp, high-value entry point for security engineering teams.
- Simplicity / focus 5/5
- The product is a single, focused pipeline: Natural Language -> Formal Rule -> CI Check.
Scored by Gemma 4 · 28 Nov 2026. Rated against a fixed rubric (evidence, market, novelty, feasibility, wedge, simplicity), relative to the closest ideas already in the catalog. A prior estimate to compare ideas before real-world signal arrives.
Act on this idea
Ideas only matter if someone runs with them. Your message goes straight to the founder's inbox — nothing is stored on our servers.
Who benefits
- Salesforcecompany
Runs one of the largest JavaScript estates (Lightning Web Components) and publishes an AppExchange security review checklist; Policy2Rule turns that written checklist into automated CI enforcement across their own and partners' code.
- PayPalcompany
Ships security-critical client-side JavaScript for payment flows under strict written secure-coding standards; converting those standards into enforced rules closes the gap between policy documents and manual code review.
- Shopifycompany
Maintains large JavaScript storefront and checkout codebases with plain-language security review requirements; executable rules catch policy violations at commit time instead of during manual review.
- Capital Onecompany
A bank with public engineering secure-coding standards and a large JavaScript frontend estate; demonstrable automated enforcement of written policies supports audit and regulatory obligations.
Research it builds on
- nl2spec: Interactively Translating Unstructured Natural Language to Temporal Logics with Large Language ModelsMatthias Cosler, Christopher Hahn, Daniel Mendoza et al. · 2023 · 122 citationsAll ideas from this paper →
- SAFE: Formal Specification and Implementation of a Scalable Analysis Framework for ECMAScriptAll ideas from this paper →
- Large Language Models Versus Static Code Analysis Tools: A Systematic Benchmark for Vulnerability DetectionDamian Gnieciak, Tomasz Szandała · 2025 · 39 citationsAll ideas from this paper →
- VulInstruct: Teaching LLMs Root-Cause Reasoning for Vulnerability Detection via Security SpecificationsAll ideas from this paper →