mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
524aab5528
Add comprehensive documentation and GitHub Copilot configuration: - docs/knowledge/: 17 deep-dive knowledge files covering value semantics, RVM architecture, builtins, FFI boundary, feature composition, error handling migration, policy evaluation security, Rego semantics, interpreter/compiler architecture, Azure Policy/RBAC, engine API, time builtins, language extension guide, tooling architecture, causality/partial eval, Rego compiler, Azure Policy aliases, and telemetry/diagnostics - .github/agents/: 16 role-specific AI agent definitions (red-teamer, semantics-expert, architect, performance-engineer, test-engineer, verification-engineer, security-auditor, reliability-engineer, support-engineer, ci-engineer, refactorer, api-steward, program-manager, demo-engineer, dx-engineer, tech-lead) - .github/skills/: 6 workflow skill definitions (thorough-review, design-alternatives, add-builtin, opa-conformance, security-review, verification) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: anakrish <35780660+anakrish@users.noreply.github.com>
4.1 KiB
4.1 KiB
name, description, allowed-tools
| name | description | allowed-tools |
|---|---|---|
| security-review | Security-focused review for regorus changes. Use this skill when asked to do a security review, threat analysis, or when reviewing changes to FFI boundaries, resource limits, policy evaluation, or dependency updates. | shell |
Security Review Skill
regorus is a security-critical policy evaluation engine. Policy evaluation bugs can lead to incorrect access control decisions at Azure scale. This skill provides a security-focused review lens.
Threat Model
regorus evaluates untrusted policies and inputs provided by external users. The engine must:
- Produce correct results — a wrong allow/deny is a security bug
- Not crash — panics in FFI contexts poison the engine permanently
- Bound resource usage — adversarial inputs must not cause DoS
- Maintain isolation — evaluation of one policy must not affect another
- Protect the host — no arbitrary code execution, file access, or network access
Review Approach
Think adversarially. For each change, ask:
Policy Evaluation Correctness
- Could this change cause a policy to evaluate to a different result?
- If the result changes, is that the correct behavior per specification?
- What happens with edge-case inputs: empty, null, very large, deeply nested?
- What happens when values are Undefined? (
not Undefined = true) - Are default rules affected?
Resource Exhaustion
- Does this introduce unbounded iteration (no instruction budget check)?
- Does this allocate memory proportional to untrusted input size?
- Does this add recursion without depth bounds?
- Can an adversarial policy trigger O(n²) or worse behavior?
- RVM instruction budget is 25,000 — does this change affect instruction count significantly for common policies?
Panic Safety
- Can this code path panic? (
.unwrap(),.expect(), index[i], integer overflow viaascasts, slice out of bounds) - Is this reachable from FFI? (If so, panic = permanent engine poisoning)
- Are all match arms exhaustive?
- Are arithmetic operations checked? (
checked_add,saturating_mul, etc.)
FFI Boundary
If the change touches public API or FFI:
- Does the handle pattern remain safe? (
Box::into_raw/Box::from_raw) - Is
with_unwind_guard()used for panic containment? - Do all 9 binding languages handle the change correctly?
- Are error codes and status values consistent?
- Could a binding language misuse the new API in a way that causes UB?
Supply Chain
If dependencies change:
- Is the new dependency necessary?
- Does it have known vulnerabilities? (
cargo audit) - Does it use
unsafe? How much? - Is it maintained? How many maintainers?
- Does it support
no_stdwithdefault-features = false? - Could it be replaced with a smaller, more focused crate?
Run: cargo audit and cargo deny check after dependency changes.
Feature Flag Safety
- Does this compile with
--all-features? - Does this compile with
--no-default-features? - Does the
arcfeature (Rc→Arc) work correctly with this change? - Are
#[cfg(...)]guards correct and complete?
Automated Security Checks
# Dependency audit
cargo audit
# Dependency policy check
cargo deny check
# Clippy with all features (catches unsafe patterns)
cargo clippy --all-features -- -D warnings
# Clippy with no features (no_std safety)
cargo clippy --no-default-features -- -D warnings
# Miri for memory safety (if nightly available)
cargo +nightly miri test
Severity Assessment
For each finding, assess:
- Impact: what's the worst case if exploited?
- Exploitability: can an external user trigger this?
- Scope: how many deployments are affected?
In regorus, most evaluation bugs are high-impact because they affect policy decisions across all deployments using the engine.
Reference
docs/knowledge/policy-evaluation-security.md— DoS protection, limitsdocs/knowledge/ffi-boundary.md— Handle pattern, panic containmentdocs/knowledge/feature-composition.md— Feature flag interactionsdocs/knowledge/value-semantics.md— Undefined propagation (security-relevant)