Repository navigation
feat(examples): add UK regulatory policy pack (UK GDPR, ICO ADM, FCA) - #3254
MohammadHaroonAbuomar merged 31 commits into
Conversation
Add governance starter policies for GB jurisdiction covering UK GDPR/DPA 2018, DUAA 2025 automated decision-making safeguards, and FCA principles-based financial conduct, with OPA Rego references and jurisdiction router wiring. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Add 38 Rego unit tests covering UK GDPR, ICO ADM, FCA conduct, and GB jurisdiction routing, plus a run_tests.sh runner and README instructions. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Keep upstream README structure (Using this directory, Policy format, Related) and add a Policy Packs table row for uk-regulatory without replacing existing documentation. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Restore examples/policies/README.md to match upstream main; policy pack catalog updates are handled elsewhere. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Add GB pack mappings without removing upstream IN entries (dpdp, certin, rbi, sebi, aadhaar). Add regression test to keep India routing intact. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Refine breach-notification messaging, escalate cross-border transfers instead of blanket blocking, correct Art. 22B special-category ADM requirements, and sync YAML with Rego reference implementations. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
🤖 AI Agent: security-scanner — View details
No security issues found. |
🤖 AI Agent: test-generator — `examples/policies/uk-regulatory/fca-financial-conduct.yaml`
|
🤖 AI Agent: code-reviewer — View details
TL;DR: 0 blockers, 1 warning. [Solid addition with minor follow-up needed.]
Action items: None. Warnings:
|
🤖 AI Agent: docs-sync-checker — Docs Sync
Docs Sync
|
🤖 AI Agent: contributor-guide — View details
Welcome, and thank you for contributing! Great job on providing detailed documentation and comprehensive test coverage for the UK regulatory policy pack. Before merging, please address the following:
Refer to CONTRIBUTING.md for guidance. Let us know if you have any questions! |
🤖 AI Agent: breaking-change-detector — API Compatibility
API CompatibilityNo breaking changes detected. |
|
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
Imran Siddique (imran-siddique)
left a comment
There was a problem hiding this comment.
Thanks for the thorough pack — the Rego side is solid (41/41 OPA tests, GB wired into the shared jurisdiction router with an India-preservation regression test, and clear per-file disclaimers). One blocking issue on the YAML side.
action: escalate is not a valid PolicyAction and will fail PolicyDocument.from_yaml().
agent-governance-python/agent-os/src/agent_os/policies/schema.py defines:
class PolicyAction(str, Enum):
ALLOW = "allow"
DENY = "deny"
AUDIT = "audit"
BLOCK = "block"There is no escalate. PolicyRule.action is typed as PolicyAction, and from_yaml() does yaml.safe_load(...) → cls.model_validate(data), so loading any of these YAMLs raises a pydantic ValidationError. Affected rules (7):
uk-gdpr-data-protection.yaml:ukgdpr-purpose-limitation-escalate,ukgdpr-special-category-health,ukgdpr-special-category-general,ukgdpr-bulk-export-escalate,ukgdpr-cross-border-language-escalate,ukgdpr-cross-border-action-escalateico-automated-decisions.yaml:adm-recruitment-decision-escalate
The India (dpdp-data-protection.yaml) and African (popia-south-africa.yaml) packs you're modelling on deliberately use action: block for exactly this review/hold tier — none of them use escalate. That's why opa test is green (Rego defines its own independent escalate decision, unconstrained by the Python enum) while the YAML path is broken, and it's masked because CI doesn't run the YAML validator. Consistent with this, your own test-plan checkbox python -m agent_os.policies.cli validate examples/policies/uk-regulatory/*.yaml is unchecked — that step will currently fail.
Requested change: switch the 7 action: escalate rules to action: block to match the schema and the sibling packs, then run the validate command to confirm all three YAMLs load. The Rego escalate tier can stay as-is (schema-independent). The FCA YAML already uses only deny/audit/block and is fine. Happy to re-review once this is in.
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Citation and scope corrections:
fca-financial-conduct.rego:52and the yaml: PRIN 2A.1 -> PRIN 2A.4 (fair-value outcome is 2A.4).uk-gdpr-data-protection.rego:49, yaml, and README: drop or scope DPA 2018 s.67. That is Part 3 (law-enforcement processing) only and conflates regimes when applied to general processing.- Remove
"AU"fromadequacy_countries; Australia is not on the UK adequacy list. - Drop unused
lawful_basis_documentedfrom the input-schema comment. - CLA check is still pending.
|
Thanks Imran Siddique (@imran-siddique) and MohammadHaroonAbuomar for the review, I've addressed the requested changes in the latest commit. Imran Siddique (@imran-siddique) — YAML schema Replaced all 7 action: escalate rules with action: block in uk-gdpr-data-protection.yaml (6 rules) and ico-automated-decisions.yaml (adm-recruitment-decision-block) PRIN 2A.1 → PRIN 2A.4 in fca-financial-conduct.yaml and fca-financial-conduct.rego |
|
@microsoft-github-policy-service agree |
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- DCO failing on merge commit d680879 (no Signed-off-by trailer); sign the merge or rebase instead of merge-from-main
- Spell-check changed files failing (run 28923597705); add flagged term(s) to .cspell-repo-terms.txt
d680879 to
f82687b
Compare
…block, corrected PRIN 2A.4 and Art. 33 citations, removed DPA s.67 from general processing scope, removed AU from adequacy list, dropped unused Rego schema field. Validated all 3 YAMLs and 41/41 OPA tests pass Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
5355f72 to
6657ad7
Compare
There was a problem hiding this comment.
Review details
Suppressed comments (4)
examples/policies/uk-regulatory/rego/fca-financial-conduct.rego:42
- The regex uses the misspelled token "vulnerabilit". This was later added to the cspell allowlist, but it’s clearer (and avoids propagating the typo) to match the full words "vulnerability" / "vulnerabilities" explicitly.
regex.match(`(?i)(mislead\s+(the\s+)?customer|hide\s+(fees|charges|risks)|exploit\s+vulnerabilit|target\s+vulnerable\s+customer|dark\s+pattern|push\s+unsuitable\s+product)`, _output_text)
examples/policies/uk-regulatory/README.md:51
- The referenced template path
agent-os/templates/policies/gdpr.yamldoesn’t exist at the repo root; the actual file is underagent-governance-python/agent-os/templates/policies/gdpr.yaml. Updating this avoids sending readers to a dead path.
Output text is stringified before regex evaluation (Agent-OS / production Rego practice) so structured `output` cannot evade phrase rules. Transfer adequacy uses pack-owned defaults overridable only via `data.config.uk_gdpr.*` (same deployer-config pattern as African agent-safety packs). Caller-set `adequacy_covered` / `safeguards_in_place` / DPF flags on `input.params` are ignored. The United States is not in the default adequacy set; US transfers are allowed only when the platform sets both `eu_us_data_privacy_framework` and `supplementary_measures` (mirrors `agent-os/templates/policies/gdpr.yaml`).
examples/policies/uk-regulatory/rego/uk-gdpr-data-protection.rego:57
- This comment references
agent-os/templates/policies/gdpr.yaml, but the actual template lives atagent-governance-python/agent-os/templates/policies/gdpr.yamlin this repo. Updating the path avoids confusion for readers trying to cross-check the referenced policy behavior.
# Platform-set only — mirrors agent-os/templates/policies/gdpr.yaml us_data_transfer.
.cspell-repo-terms.txt:1063
- This adds the misspelling "vulnerabilit" to the repository cspell allowlist. If the FCA policy regex is updated to match the correct words (e.g., "vulnerability" / "vulnerabilities"), this entry should be removed to avoid baking typos into the dictionary.
vulnerabilit
- Files reviewed: 15/15 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Go with option B for this PR: keep |
Union-resolve .cspell-repo-terms.txt and fix FCA Rego consumer-harm regex to match full vulnerability words. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Head branch was pushed to by a user without write access
|
Thanks Imran Siddique (@imran-siddique), option B is in place: no |
6747616 to
e141e48
Compare
Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Match compact and spaced NI formats plus "No." phrasing, add regression tests, and allowlist the UK regulatory terms cspell flagged. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Deny full National Insurance / National Health Service wording and spaced official ID formats so these PII rules no longer fail open Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Harden NHS/NI separators, match Do not with don't, accept ASCII hyphens in ICO contest phrasing, and require platform-set FCA trading approval. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
e141e48 to
422f17d
Compare
Align uk-regulatory YAML packs with the SDK version accepted after microsoft#3939 so AgentControl.from_path and policy validation can load them. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
fbaacae to
0fee005
Compare
Point UK pack docs and Rego comments at agent-governance-python/agent-os/templates/policies/gdpr.yaml. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
… ISO codes Replace region tokens and partial-adequacy countries in the default set with ICO full-adequacy ISO-3166 codes, keep CA/JP/US out of defaults, and cover EU allow plus CA/JP deny paths in Rego tests. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Use evaluate_intervention_point instead of the nonexistent AgentControl.evaluate, and allowlist APPI, PIHBOs, and PIPEDA for spell-check. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
Document warn (from audit) ACS mapping, fix opa eval to use an input file, note from_path pack-only vs router two-layer selection, and use a repo-root YAML path in the AgentControl example. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com>
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Verified at 0f8d1f3: the three spell-check terms are in place and the workflow's own steps pass clean, and the README snippet now runs as written against this PR's SDK (prints Decision.DENY for a National Insurance number). No policy content changed since the verified head; 37 adversarial probes through the SDK against all three UK manifests still fail closed, including malformed snapshots. 219/219 OPA tests, 51 native manifests validate, all 21 single-parent commits signed off.
…microsoft#3254) * feat(examples): add UK regulatory policy pack (UK GDPR, ICO ADM, FCA) Add governance starter policies for GB jurisdiction covering UK GDPR/DPA 2018, DUAA 2025 automated decision-making safeguards, and FCA principles-based financial conduct, with OPA Rego references and jurisdiction router wiring. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * test(examples): add OPA tests for UK regulatory policy pack Add 38 Rego unit tests covering UK GDPR, ICO ADM, FCA conduct, and GB jurisdiction routing, plus a run_tests.sh runner and README instructions. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * docs(examples): restore policies README and add UK pack entry Keep upstream README structure (Using this directory, Policy format, Related) and add a Policy Packs table row for uk-regulatory without replacing existing documentation. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * docs(examples): drop README changes covered by separate PR Restore examples/policies/README.md to match upstream main; policy pack catalog updates are handled elsewhere. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(examples): restore India routing alongside UK in jurisdiction router Add GB pack mappings without removing upstream IN entries (dpdp, certin, rbi, sebi, aadhaar). Add regression test to keep India routing intact. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(examples): align UK policies with DUAA regulatory review Refine breach-notification messaging, escalate cross-border transfers instead of blanket blocking, correct Art. 22B special-category ADM requirements, and sync YAML with Rego reference implementations. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * Addressed review feedback: replaced all 7 escalate YAML actions with block, corrected PRIN 2A.4 and Art. 33 citations, removed DPA s.67 from general processing scope, removed AU from adequacy list, dropped unused Rego schema field. Validated all 3 YAMLs and 41/41 OPA tests pass Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * chore(spell): add UK policy terms for cspell check Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(docs): remove v4 PolicyDocument snippet from UK regulatory README Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * refactor(examples): migrate UK regulatory pack to native ACS manifests Convert the YAML packs to ACS manifests, add the shared ACS result adapter, harden UK GDPR transfer checks (platform-set adequacy/DPF only), and stringify non-string output before regex evaluation. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * chore(examples): add MIT license header to UK Rego test runner Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * chore(spell): move UK regulatory terms section header with other cspell groups Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(examples): detect HMRC-spaced UK National Insurance numbers Match compact and spaced NI formats plus "No." phrasing, add regression tests, and allowlist the UK regulatory terms cspell flagged. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(policies): catch NHS and NI numbers in common UK output phrasings Deny full National Insurance / National Health Service wording and spaced official ID formats so these PII rules no longer fail open Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(policies): close UK pack deny fail-opens and caller trust bypasses Harden NHS/NI separators, match Do not with don't, accept ASCII hyphens in ICO contest phrasing, and require platform-set FCA trading approval. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * chore: remove local spell-check diff output Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(examples): bump UK ACS manifests to 0.4.0-alpha.1 Align uk-regulatory YAML packs with the SDK version accepted after microsoft#3939 so AgentControl.from_path and policy validation can load them. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * docs(examples): fix UK GDPR template path after package layout move Point UK pack docs and Rego comments at agent-governance-python/agent-os/templates/policies/gdpr.yaml. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * fix(policies): align UK GDPR adequacy defaults with ICO full-adequacy ISO codes Replace region tokens and partial-adequacy countries in the default set with ICO full-adequacy ISO-3166 codes, keep CA/JP/US out of defaults, and cover EU allow plus CA/JP deny paths in Rego tests. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * docs(examples): fix UK pack README ACS snippet and cspell terms Use evaluate_intervention_point instead of the nonexistent AgentControl.evaluate, and allowlist APPI, PIHBOs, and PIPEDA for spell-check. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> * docs(examples): clarify UK pack README ACS and OPA usage Document warn (from audit) ACS mapping, fix opa eval to use an input file, note from_path pack-only vs router two-layer selection, and use a repo-root YAML path in the AgentControl example. Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> --------- Signed-off-by: Ayo Omotayo <ayonifeoluwa@gmail.com> Signed-off-by: MohammadHaroonAbuomar <40180927+MohammadHaroonAbuomar@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: MohammadHaroonAbuomar <40180927+MohammadHaroonAbuomar@users.noreply.github.com> Signed-off-by: yuvrajsingh2428 <offcyuvi2428@gmail.com>
Description
Adds a UK regulatory policy pack to
examples/policies/uk-regulatory/, following the same pattern established by the African regulatory pack (#3077) and India regulatory pack (#3123).The UK is a major regulated AI-agent market (financial services, public sector, healthcare) and had no jurisdiction-specific coverage in AGT yet. This PR adds starter Policy-as-Code examples that govern what an AI agent is allowed to do under UK law, evaluated at the agent action/output boundary with
allow,audit,escalate, ordenydecisions and statutory citations on each rule.Three policy files
uk-gdpr-data-protection.yamlico-automated-decisions.yamlfca-financial-conduct.yamlAlso included
rego/(not loaded by the Agent-OS Python runtime; provided for OPA-based pipelines, mirroring feat(examples): add African regulatory policy pack (NDPA, CBN, POPIA, Kenya DPA) #3077 and feat(examples): add India regulatory policy pack (DPDP, CERT-In, RBI, SEBI, Aadhaar) #3123)rego/run_tests.sh(goes beyond feat(examples): add India regulatory policy pack (DPDP, CERT-In, RBI, SEBI, Aadhaar) #3123 which shipped without in-repo tests; aligns with feat(examples): add African regulatory policy pack (NDPA, CBN, POPIA, Kenya DPA) #3077's Rego test coverage approach)GBentry wired into the shared jurisdiction router inafrican-regulatory/rego/jurisdiction-router.regoType of Change
Package(s) Affected
Checklist
opa test— 41/41 pass viarego/run_tests.sh)Test plan
./examples/policies/uk-regulatory/rego/run_tests.sh— expect 41/41 PASSagent-governance-pythoninstalled):