Governance & Audit

Governance: One command to run all validation checks
Audit: Track all governance operations for compliance


What Is Ranex Governance?

Ranex Governance orchestrates all validation subsystems:

  • Compliance Engine - Standards enforcement
  • Structure Validator - Architecture rules
  • Security Scanner - Vulnerability detection
  • ARBITER - Test integrity validation
Feature detection table showing all validation subsystems

Ranex validation subsystems and what they detect in user code


Full Governance Check

Run comprehensive validation:

ranex govern check

Output:

πŸ›‘οΈ  Full Governance Check
════════════════════════════════════════════════════════════
  Target: /home/user/myproject
  Time:   2025-11-29 14:18:29
════════════════════════════════════════════════════════════

πŸ“‹ Compliance Check
   Status: PASS
   Score:  92/100

πŸ—οΈ  Structure Check
   Status: PASS

πŸ”’ Security Check
   Status: PASS
   Vulnerabilities: 0

════════════════════════════════════════════════════════════
Result: PASSED
Score:  92/100

Options

OptionDescription
--jsonOutput as JSON for CI/CD
--verbose, -vDetailed output
[PATH]Target path (default: current directory)

Pre-Commit Hook

Block bad commits before they happen:

ranex govern pre-commit

Output (pass):

βœ… Pre-commit validation passed
   Checks: structure, security, compliance
   Duration: 45ms

Output (fail):

❌ Pre-commit validation FAILED
════════════════════════════════════════════════
  Failed checks:
    - Security: 2 vulnerabilities found
    - Structure: 1 violation

  Commit blocked. Fix issues and try again.
════════════════════════════════════════════════

Set Up Git Hook

# Add to .git/hooks/pre-commit
#!/bin/bash
ranex govern pre-commit

Security Scanning

Ranex includes a SAST (Static Application Security Testing) scanner:

Security Scanner detecting SQL injection and hardcoded secrets

SAST scanner detecting SQL injection and hardcoded secrets in user code

Dependency scan detecting CVE vulnerabilities

Dependency vulnerability scan - detecting CVEs in pyyaml and sqlalchemy

Architecture violation detection

Architecture violation - forbidden folder detected, enforcing vertical slice architecture


Audit Trail

All governance operations are logged for compliance.

Query Audit Trail

ranex audit query

Output:

πŸ“‹ Audit Trail
────────────────────────────────────────────────────────────
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Timestamp            β”‚ Operation    β”‚ Result  β”‚ User     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2025-11-29 14:20:00  β”‚ govern check β”‚ PASS    β”‚ developerβ”‚
β”‚ 2025-11-29 14:18:30  β”‚ pre-commit   β”‚ PASS    β”‚ developerβ”‚
β”‚ 2025-11-29 14:15:00  β”‚ scan         β”‚ PASS    β”‚ developerβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Filter Audit Results

# By action type
ranex audit query --action govern

# By time range
ranex audit query --since 24h

# By result
ranex audit query --result FAIL

CI/CD Integration

GitHub Actions

name: Governance Check

on: [push, pull_request]

jobs:
  governance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Ranex
        run: pip install ranex

      - name: Run Governance Check
        run: ranex govern check --json > governance.json

      - name: Upload Results
        uses: actions/upload-artifact@v4
        with:
          name: governance-report
          path: governance.json

GitLab CI

governance:
  image: python:3.12
  script:
    - pip install ranex
    - ranex govern check
    - ranex govern pre-commit

Commands Reference

CommandDescription
ranex govern checkFull governance validation
ranex govern pre-commitPre-commit hook validation
ranex govern transitionValidate phase transition
ranex audit queryQuery audit trail
ranex audit exportExport audit log

Next Steps