Skip to main content
QUICK REVIEW

[论文解读] Prose2Policy (P2P): A Practical LLM Pipeline for Translating Natural-Language Access Policies into Executable Rego

Vatsal Gupta, Darshan Sreenivasamurthy|arXiv (Cornell University)|Mar 16, 2026
Natural Language Processing TechniquesComputer Science被引用 0
一句话总结

Prose2Policy 是一个端到端的基于大型语言模型的工具链,将自然语言访问控制策略转译为可执行的 Rego 代码,包括提取、模式验证、lint、编译与自动化测试。它强调部署的可靠性与可审计性。

ABSTRACT

Prose2Policy (P2P) is a LLM-based practical tool that translates natural-language access control policies (NLACPs) into executable Rego code (the policy language of Open Policy Agent, OPA). It provides a modular, end-to-end pipeline that performs policy detection, component extraction, schema validation, linting, compilation, automatic test generation and execution. Prose2Policy is designed to bridge the gap between human-readable access requirements and machine-enforceable policy-as-code (PaC) while emphasizing deployment reliability and auditability. We evaluated Prose2Policy on the ACRE dataset and demonstrated a 95.3\% compile rate for accepted policies, with automated testing achieving a 82.2\% positive-test pass rate and a 98.9\% negative-test pass rate. These results indicate that Prose2Policy produces syntactically robust and behaviorally consistent Rego policies suitable for Zero Trust and compliance-driven environments.

研究动机与目标

  • 弥合可读性访问需求与机器强制执行策略代码(PaC)之间的差距。
  • 提供一个从 NLACP 到 Rego 的端到端、模块化流水线,包含验证、lint 和测试。
  • 通过结构化提示和中间产物实现可审计性与部署可靠性。
  • 为研究人员提供可重复的流程,以研究提示策略与守则的制定。

提出的方法

  • 结构化提示流水线以识别意图、提取 DSARCP 组件(Decision, Subject, Action, Resource, Condition, Purpose),并合成 Rego。
  • 四模块架构:预处理、组件提取、模式验证,以及 Rego 生成/改进/测试。
  • 将 Rego 视为目标策略语言,具备默认拒绝语义和审计注释。
  • 集成 Rego lint 工具(Regal)和 OPA 的编译/测试用于验证和单元测试生成。
  • 支持批量与单策略接口,提供可选的 LLM 或基于规则的测试生成模式。
Figure 1. Prose2Policy Architecture
Figure 1. Prose2Policy Architecture

实验结果

研究问题

  • RQ1NLACPs 是否能被可靠地检测并分解为可执行的 Rego 策略要素?
  • RQ2LLMs 将策略组件(DSARCP)从 NLACPs 提取并转换为 Rego 代码的准确性如何?
  • RQ3集成的 lint、编译和单元测试流水线是否产生语法正确且行为正确的策略?
  • RQ4RAGent 类基线对比 Prose2Policy 方案在生成策略质量上的影响如何?
  • RQ5在标准数据集(如 ACRE)上,Prose2Policy 的编译通过率和测试通过率表现如何?

主要发现

  • 实现了 95.3% 的编译通过率:389 条中有 371 条被接受的 NLACPs 生成了有效的 Rego 策略。
  • 在 LLM 驱动的测试生成下,获得 82.2% 的正向测试通过率(305/371)。
  • LLM 驱动的测试实现下,负向测试通过率达到 98.9%(367/371)。
  • 基于规则的测试生成达到 62.1% 的正向测试通过率和 97.1% 的负向测试通过率。
  • 有 18 条策略在自动生成过程中因语法问题未能产生有效的 Rego。
  • 展示了强健的默认拒绝策略执行,负向测试成功率较高。
Figure 2. Inputs and outputs of each component
Figure 2. Inputs and outputs of each component

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。