Skip to content

feat: Add new international and industry-specific AI policies with custom folder exclusion#10

Merged
kmadan merged 22 commits into
mainfrom
opa-policy-builder
Jun 30, 2025
Merged

feat: Add new international and industry-specific AI policies with custom folder exclusion#10
kmadan merged 22 commits into
mainfrom
opa-policy-builder

Conversation

@kmadan
Copy link
Copy Markdown
Contributor

@kmadan kmadan commented Jun 30, 2025

Summary

This PR adds comprehensive new AI governance policies for international frameworks and industry-specific requirements, along with infrastructure improvements to support custom policy development.

🌍 New International Policies

Brazil AI Governance (international/brazil/v1/)

  • Bill of Law No. 2,338/2023 (PL 2338/23) compliance
  • Risk-based approach: Excessive Risk, High-Risk, Other Systems
  • Rights framework: explanation, contest, human review
  • Algorithmic impact assessments and oversight requirements

India Digital Policy (international/india/v1/)

  • Digital India AI Policy framework implementation
  • NITI Aayog National Strategy alignment
  • Core pillars: Fairness, Transparency, Accountability, Safety
  • Electoral integrity and bias mitigation safeguards

NIST AI RMF (international/nist/v1/)

  • NIST AI 600-1 Risk Management Framework
  • Four-function approach: Govern, Map, Measure, Manage
  • Comprehensive orchestrator with modular components
  • Governance, transparency, and accountability requirements

🏫 New Industry-Specific Policies

Education Sector (industry_specific/education/v1/)

  • Academic Integrity: AI plagiarism detection, acceptable AI use
  • Student Data Privacy: COPPA compliance, FERPA compliance, data minimization
  • Fairness & Equity: Equitable admissions, unbiased grading, digital divide mitigation
  • Safe Learning Environment: Age-appropriate content, instructional tool vetting
  • Assessment & Evaluation: Responsible AI proctoring, human-in-the-loop grading

🛠️ Infrastructure Improvements

Custom Policy Framework

  • Custom folder exclusion: custom/ directory now excluded from git tracking and PRs
  • Local development support: Organizations can develop proprietary policies locally
  • CI/CD safety: Custom policies excluded from OPA check and Regal lint in workflows
  • Documentation: Comprehensive guide for custom policy development

Code Quality & Compliance

  • Regal lint compliance: All new policies pass strict linting rules
  • OPA validation: All policies validated with opa check
  • Formatting: Consistent code formatting with opa fmt
  • Best practices: Eliminated default-over-else, messy-rule, and other violations

✅ Quality Assurance

  • OPA Check: ✅ All policies pass opa check
  • Regal Lint: ✅ All new policies have zero violations
  • Custom Exclusion: ✅ Verified custom folder is properly ignored
  • CI/CD Ready: ✅ All GitHub workflow checks will pass

🎯 Impact

  • Regulatory Coverage: Expanded support for Brazil, India, and US (NIST) frameworks
  • Industry Support: First comprehensive education sector policies
  • Developer Experience: Improved custom policy development workflow
  • Maintainability: Enhanced code quality and consistency

📋 Files Changed

New Policy Files

  • international/brazil/v1/ai_governance/ai_governance.rego
  • international/india/v1/digital_india_policy/digital_india_policy.rego
  • international/nist/v1/ai_600_1/ai_600_1.rego (+ supporting modules)
  • industry_specific/education/v1/**/*.rego (multiple policies)

Infrastructure Updates

  • .gitignore: Added custom/ exclusion
  • .github/workflows/opa-ci.yaml: Updated to exclude custom folder
  • .pre-commit-config.yaml: Updated to exclude custom folder
  • README.md: Enhanced documentation for custom policies

Ready for review and merge 🚀

kmadan added 10 commits June 30, 2025 11:25
This commit introduces a new set of OPA Rego policies for the US NIST AI Risk Management Framework (RMF). The policies are structured to align with the four core functions of the RMF: Govern, Map, Measure, and Manage.

The implementation includes:
- A directory structure that mirrors the RMF functions.
- Placeholder policies for each function, with detailed rules for governance, mapping, measurement, and management.
- An orchestrator policy that combines the individual policies into a single, comprehensive evaluation.
- Test files to ensure the correctness of the policies.
This commit introduces a new OPA Rego policy for India_s AI governance framework. The policy is based on the key principles outlined in the National Strategy for Artificial Intelligence, recent advisories from the Ministry of Electronics and Information Technology (MeitY), and the report of the subcommittee on AI Governance and Guidelines Development.
This commit introduces a new set of OPA Rego policies for Brazil's AI governance framework. The policies are based on Bill of Law No. 2,338/2023 (PL 2338/23) and adopt a risk-based approach.

The implementation includes:
- A directory structure for Brazil's AI governance policies.
- A Rego policy file (`ai_governance.rego`) that incorporates the risk-based approach and key principles from Bill 2338/2023, including:
    - Risk categorization (excessive, high, and other risks).
    - Core principles and rights (right to explanation, contest, and human review).
    - Governance and compliance requirements (algorithmic impact assessments, robustness, accuracy, reliability, and oversight authority).
- A README.md file explaining the policies and their basis.
This commit adds a disclaimer to all `README.md` files within the policy categories. The disclaimer clarifies that the policies are for informational purposes only and do not constitute legal advice, advising users to consult with legal professionals for specific guidance.
Adds a new set of AI risk policies specifically for the education industry.
This includes policies for:
- Student Data Privacy (FERPA, COPPA)
- Academic Integrity
- Fairness and Equity
- Safe Learning Environment
- Assessment and Evaluation
@kmadan kmadan force-pushed the opa-policy-builder branch from 1464549 to 96ba41a Compare June 30, 2025 12:49
@kmadan kmadan changed the title Opa policy builder feat: Add new international and industry-specific AI policies with custom folder exclusion Jun 30, 2025
kmadan added 10 commits June 30, 2025 13:55
- Fixed default-over-else violations by using default assignments
- Fixed test-outside-test-package violations by renaming test packages
- Fixed non-loop-expression warning in education policy
- Updated test imports to reference correct policy modules
- Added proper imports for policy modules in test files
- Updated test function calls to use qualified module names
- All OPA checks now pass successfully
- Apply opa fmt to all NIST test files
- Break down long test rule in ai_600_1_test.rego to avoid rule-length violation
- Fix non-loop-expression warning in ferpa_compliance.rego by using explicit comparison
- Fix import order in all NIST test files to satisfy opa-fmt
- Revert ferpa_compliance.rego to use 'not' operator to fix non-loop-expression warning
- All regal lint violations should now be resolved
- Extract student opt-out check into helper function to avoid direct field access in rule
- This should resolve the last remaining regal lint violation
- All CI checks should now pass
- Move student_opted_out helper function to end of file with other helpers
- This groups all ferpa_compliant rules together to avoid messy-rule violation
- Should resolve the final 2 remaining regal lint violations
- Change logic from negative (not student_opted_out) to positive (student_allows_directory_sharing)
- Use explicit comparison (== false) instead of 'not' operator
- This should resolve the last remaining regal lint violation
- Move input.student.directory_information_opt_out check before the every loop
- This resolves the non-loop-expression performance warning
- Remove unused helper functions
- Apply opa fmt formatting

Your suggestion to move the expression before the loop worked perfectly!
- Used 'opa fmt -w' to properly format ferpa_compliance.rego in place
- All regal lint violations now resolved: 85 files linted, 0 violations found
- CI should now pass completely! 🎉
@kmadan kmadan requested a review from Prinevo June 30, 2025 14:53
Copy link
Copy Markdown
Contributor

@Prinevo Prinevo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loogs good to me.

@kmadan kmadan merged commit 11b3602 into Principled-Evolution:main Jun 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants