Skip to content

Commit a40f3ce

Browse files
committed
docs: add CONTRIBUTING.md and SECURITY.md
Two doc additions that the repo has been missing: - CONTRIBUTING.md — policy-authoring conventions (package paths, default deny, METADATA blocks, report composition), the local-checks recipe (opa check + regal lint + tests), PR review criteria, and a step-by-step "adding a new framework" guide. Resolves the broken link the README has been carrying in all 5 language variants. - SECURITY.md — private vulnerability-disclosure flow at security@principledevolution.ai, 5-business-day acknowledgement, coordinated disclosure. Explicitly separates security issues (CI workflows, supply chain, helper_functions bugs) from policy- correctness disputes (which are public discussions, not embargoed vulnerabilities).
1 parent 8d9129e commit a40f3ce

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing to GOPAL
2+
3+
Thanks for considering a contribution. GOPAL is an open, community-curated library of [OPA](https://www.openpolicyagent.org/) Rego policies encoding AI-governance requirements; the more eyes on each rule, the better the policies get.
4+
5+
## What we welcome
6+
7+
- **New policies** for an existing framework (e.g. an additional EU AI Act article)
8+
- **New frameworks** (e.g. UK AI Principles, California SB-1047 successor, MAS banking AI guidance)
9+
- **New industry verticals** (e.g. media, energy, defence)
10+
- **Fixes** for bugs in existing policy logic
11+
- **Tests** — every policy should have a sibling `*_test.rego`. Missing tests on existing policies are open invitations.
12+
- **Translations** — the README ships in 5 languages. Native-speaker review of any of them is gold.
13+
- **Documentation** improvements (CONTRIBUTING, README, AGENTS, STYLE)
14+
15+
## Before you open a PR
16+
17+
1. **Open or check an issue first.** For new frameworks or larger additions, a quick "I'm planning to add X" comment avoids duplicate work.
18+
2. **Run the same checks CI runs.** See [Development](#development) below.
19+
3. **Match the existing policy shape.** Every policy file follows the same structure (package, imports, METADATA, default deny, allow rule, report). See [diagrams/diagram3_policy_anatomy_light.svg](diagrams/diagram3_policy_anatomy_light.svg) and any existing `.rego` for the canonical pattern.
20+
4. **Add a test sibling.** A new `foo.rego` needs a `foo_test.rego` covering both allow and deny cases.
21+
5. **Update [CHANGELOG.md](CHANGELOG.md)** under `[Unreleased]` with a one-line entry describing your change.
22+
23+
## Development
24+
25+
```bash
26+
# One-time setup
27+
pip install pre-commit
28+
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 \
29+
&& chmod +x opa && sudo mv opa /usr/local/bin/
30+
curl -L -o regal https://github.com/StyraInc/regal/releases/latest/download/regal_Linux_x86_64 \
31+
&& chmod +x regal && sudo mv regal /usr/local/bin/
32+
pre-commit install
33+
34+
# Run the checks CI runs
35+
opa check --ignore custom/ .
36+
regal lint --ignore-files custom/ .
37+
38+
# Run tests for a specific package
39+
opa test international/eu_ai_act/v1/
40+
```
41+
42+
If `opa check` fails it usually means a typo in a package path or an undeclared rule. If `regal lint` fails, run with `--format pretty` for human-readable advice on the issue.
43+
44+
## Policy authoring conventions
45+
46+
- **Package path mirrors the directory.** `international/eu_ai_act/v1/transparency.rego` declares `package international.eu_ai_act.v1.transparency`.
47+
- **Default deny.** Every policy starts with `default allow := false` so a missing rule produces a safe (deny) result, never an accidental allow.
48+
- **Metadata comments.** Use `# METADATA` followed by `# title:` and `# description:` so the rule is human-readable in audit reports.
49+
- **Report composition.** Use `data.helper_functions.reporting.compose_report(...)` to produce the standardized output shape — don't roll your own report dict. The helper guarantees the field names auditors expect.
50+
- **Versioning.** New frameworks go under `<framework>/v1/`. When a regulation amends, the old `v1/` stays put and a new `v2/` ships alongside. See [COMPATIBILITY.md](COMPATIBILITY.md).
51+
- **Reference data needed?** Add it as a constant inside the policy or under a sibling `_data.rego`. Avoid runtime dependencies on external services.
52+
53+
## Adding a new framework
54+
55+
The fastest path:
56+
57+
1. Decide where it goes: `international/`, `industry_specific/`, `global/`, or `operational/`.
58+
2. `mkdir <category>/<framework>/v1/`
59+
3. Drop in a first policy that follows the standard shape. The [`draft-rego-policy`](skills/draft-rego-policy/SKILL.md) skill scaffolds this for you under Claude Code.
60+
4. Add a test sibling.
61+
5. Update the README count + add a row under "What's Inside".
62+
6. Open a PR.
63+
64+
## PR review
65+
66+
PRs are reviewed for:
67+
68+
1. **Correctness** — does the policy logic accurately encode the regulation?
69+
2. **Test coverage** — does the test cover both allow and deny? Edge cases?
70+
3. **Style**`opa check` + `regal lint` clean? Matches existing patterns?
71+
4. **Scope** — single concern per PR, easier to revert.
72+
73+
We aim to respond within 5 business days. Larger framework additions may take longer if the regulator's text needs verification.
74+
75+
## Custom policies
76+
77+
The `custom/` directory is `.gitignore`d and CI-skipped — that's where your organization's proprietary rules go. They evaluate alongside the public set without ever being pushed to this repo. See the [README's Custom Policies section](README.md#custom-policies).
78+
79+
## Community
80+
81+
- **Questions** — open a [Discussion](https://github.com/Principled-Evolution/gopal/discussions) or comment on the relevant issue.
82+
- **Security disclosures** — see [SECURITY.md](SECURITY.md). Do not file public issues for vulnerabilities.
83+
- **Code of conduct** — be kind, assume good faith, focus on the work.
84+
85+
## License
86+
87+
By contributing, you agree your contributions will be licensed under the [Apache License 2.0](LICENSE), the same license as GOPAL itself.

SECURITY.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Security Policy
2+
3+
## Reporting a vulnerability
4+
5+
If you find a security issue in GOPAL, please **do not file a public issue**. Email **security@principledevolution.ai** with:
6+
7+
- A description of the issue
8+
- Steps to reproduce
9+
- The version (commit SHA or release tag) where you observed it
10+
- Your assessment of severity (CVSS 3.1 if you have it)
11+
12+
We aim to acknowledge within **5 business days**. We follow a coordinated-disclosure approach: we'll work with you on a fix and a disclosure timeline before any public announcement.
13+
14+
## What's in scope
15+
16+
- **CI / workflow vulnerabilities** in `.github/workflows/` (command injection, secret leakage, untrusted-input handling)
17+
- **Supply-chain issues** in `pyproject.toml` (the Python distribution metadata that ships GOPAL as a package), or in the installer scripts in `CONTRIBUTING.md` / `README.md`
18+
- **Helper-function bugs** in `helper_functions/*.rego` that could be exploited to bypass policy checks
19+
- **Documentation issues** that would lead a reader to a less-secure configuration
20+
21+
## What's NOT in scope
22+
23+
- **Policy correctness disputes** — if you think a specific Rego rule is too strict, too lax, or misinterprets a regulation, please file a **public issue** rather than emailing security. That's a policy-design discussion, not a vulnerability, and is best done in the open with the community.
24+
- **The regulations themselves** — GOPAL encodes published regulatory frameworks (EU AI Act, NIST AI RMF, etc.). Concerns about the underlying regulation belong with the regulator that issued it.
25+
- **Generic OPA / Rego issues** — please report those to [open-policy-agent/opa](https://github.com/open-policy-agent/opa) or [StyraInc/regal](https://github.com/StyraInc/regal) directly.
26+
27+
## Supported versions
28+
29+
GOPAL ships under semver (see [COMPATIBILITY.md](COMPATIBILITY.md)). Security fixes are applied to:
30+
31+
- The current `main` branch
32+
- The current `vN/` directory under each framework
33+
34+
Older versioned policy directories (`v1/` once `v2/` ships) are treated as frozen reference artefacts — they will not receive security updates. If your deployment pins to an older policy version, plan to migrate.
35+
36+
## Public attribution
37+
38+
We are happy to credit reporters in the changelog and release notes unless you ask us not to.
39+
40+
---
41+
42+
This policy will evolve as the project grows. Last reviewed: 2026-05.

0 commit comments

Comments
 (0)