-
Notifications
You must be signed in to change notification settings - Fork 0
Enforce mandatory PR security checklist, CI scans, contract tests, and backward-compat policy #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,19 @@ | ||
| # 🖋️ Contributing to Amrikyy Lab | ||
|
|
||
| ## Sovereign Contribution Protocol | ||
| By contributing to **Amrikyy Lab**, you agree to transfer all IP to the Sovereign State of PiWorker-OS. | ||
|
|
||
| By contributing to **Amrikyy Lab**, you agree to transfer all IP to the Sovereign State of PiWorker-OS. | ||
|
|
||
| ## Rules of Engagement | ||
|
|
||
| 1. **Clean Room Only**: No legacy code or unauthorized logic extraction. | ||
| 2. **Type Safety**: Strict TypeScript is the law. | ||
| 3. **Sovereign Signature**: All commits must be signed. | ||
|
|
||
| --- | ||
|
|
||
| **Amrikyy Lab :: Built for Independence** | ||
|
|
||
| ## Security Governance | ||
|
|
||
| All contributors must follow `docs/operations/security-governance-policy.md` for PR security gates, backward compatibility/versioning, deprecation windows, and security SLA expectations. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,17 +10,33 @@ permissions: | |||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||
| changes: | ||||||||||||||||||||||||||||||||||||||||||||
| name: Detect API/proto changes | ||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||||||||||||||
| api_or_proto_changed: ${{ steps.filter.outputs.api_or_proto }} | ||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Filter paths | ||||||||||||||||||||||||||||||||||||||||||||
| id: filter | ||||||||||||||||||||||||||||||||||||||||||||
| uses: dorny/paths-filter@v3 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| filters: | | ||||||||||||||||||||||||||||||||||||||||||||
| api_or_proto: | ||||||||||||||||||||||||||||||||||||||||||||
| - 'api/**' | ||||||||||||||||||||||||||||||||||||||||||||
| - '**/*.proto' | ||||||||||||||||||||||||||||||||||||||||||||
| - 'sidecar/sovereign-engine/pkg/pb/**' | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||||||||||
| name: Build & Security Audit | ||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||||
| # Pin action versions to a vetted release tag for supply-chain security and reproducible runs. | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||||||||||||||||
| # Pin action versions to a vetted release tag for supply-chain security and reproducible runs. | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| node-version: "22.x" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -38,8 +54,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||
| run: npm run contracts:check | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Go | ||||||||||||||||||||||||||||||||||||||||||||
| # Pin action versions to a vetted release tag for supply-chain security and reproducible runs. | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-go@v6 | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| go-version: "1.25.10" | ||||||||||||||||||||||||||||||||||||||||||||
| cache-dependency-path: go.sum | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -69,8 +84,13 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||
| - name: Secret scan (Secretlint) | ||||||||||||||||||||||||||||||||||||||||||||
| run: npx secretlint "**/*" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Static scan (Semgrep) | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | ||||||||||||||||||||||||||||||||||||||||||||
| pip install semgrep | ||||||||||||||||||||||||||||||||||||||||||||
| semgrep --config p/owasp-top-ten --error | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Vulnerability scan (Trivy) | ||||||||||||||||||||||||||||||||||||||||||||
| # Pin action versions to a vetted release tag for supply-chain security and reproducible runs. | ||||||||||||||||||||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@v0.24.0 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| scan-type: fs | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -94,7 +114,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||
| ## Build & verification matrix | ||||||||||||||||||||||||||||||||||||||||||||
| - Node typecheck | ||||||||||||||||||||||||||||||||||||||||||||
| - Go build (CLI + sovereign engine) | ||||||||||||||||||||||||||||||||||||||||||||
| - Security scans (Secretlint + Trivy + govulncheck) | ||||||||||||||||||||||||||||||||||||||||||||
| - Security scans (Secretlint + Semgrep + Trivy + govulncheck + npm audit) | ||||||||||||||||||||||||||||||||||||||||||||
| - Targeted Performance SLO Profiling | ||||||||||||||||||||||||||||||||||||||||||||
| - Contract Sync Validation | ||||||||||||||||||||||||||||||||||||||||||||
| - Artifact sanity checks | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -104,51 +124,32 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||
| EOF2 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload release checklist artifact | ||||||||||||||||||||||||||||||||||||||||||||
| # Pin action versions to a vetted release tag for supply-chain security and reproducible runs. | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| name: release-checklist | ||||||||||||||||||||||||||||||||||||||||||||
| path: release-checklist.md | ||||||||||||||||||||||||||||||||||||||||||||
| if-no-files-found: error | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| e2e-real: | ||||||||||||||||||||||||||||||||||||||||||||
| name: E2E Real (staging) | ||||||||||||||||||||||||||||||||||||||||||||
| contract-tests: | ||||||||||||||||||||||||||||||||||||||||||||
| name: Contract tests for API/proto changes | ||||||||||||||||||||||||||||||||||||||||||||
| needs: changes | ||||||||||||||||||||||||||||||||||||||||||||
| if: needs.changes.outputs.api_or_proto_changed == 'true' | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+133
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The |
||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||
| needs: build | ||||||||||||||||||||||||||||||||||||||||||||
| # This job is a blocker for main/release branches by failing hard when env/secrets are absent or tests fail. | ||||||||||||||||||||||||||||||||||||||||||||
| if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/release/') | ||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||
| SOVEREIGN_STAGING_URL: ${{ vars.SOVEREIGN_STAGING_URL }} | ||||||||||||||||||||||||||||||||||||||||||||
| SOVEREIGN_AUTH_TOKEN: ${{ secrets.SOVEREIGN_AUTH_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||
| AGENT_SYSTEM_SECRET: ${{ secrets.AGENT_SYSTEM_SECRET }} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| node-version: "22.x" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||
| run: npm install --ignore-scripts --no-audit --no-fund --legacy-peer-deps | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Validate required staging env | ||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||
| missing=0 | ||||||||||||||||||||||||||||||||||||||||||||
| [ -n "$SOVEREIGN_STAGING_URL" ] || { echo "Missing required var: SOVEREIGN_STAGING_URL"; missing=1; } | ||||||||||||||||||||||||||||||||||||||||||||
| [ -n "$SOVEREIGN_AUTH_TOKEN" ] || { echo "Missing required var: SOVEREIGN_AUTH_TOKEN"; missing=1; } | ||||||||||||||||||||||||||||||||||||||||||||
| [ -n "$AGENT_SYSTEM_SECRET" ] || { echo "Missing required var: AGENT_SYSTEM_SECRET"; missing=1; } | ||||||||||||||||||||||||||||||||||||||||||||
| [ "$missing" -eq 0 ] || exit 1 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Run real E2E | ||||||||||||||||||||||||||||||||||||||||||||
| run: npm run test:tier4 | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload E2E artifacts | ||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Contract sync check | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
145
to
+147
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||
| run: npm run contracts:check | ||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Go | ||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/setup-go@v5 | ||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||
| name: e2e-real-artifacts | ||||||||||||||||||||||||||||||||||||||||||||
| path: tests/e2e/artifacts/ | ||||||||||||||||||||||||||||||||||||||||||||
| if-no-files-found: warn | ||||||||||||||||||||||||||||||||||||||||||||
| go-version: "1.25.10" | ||||||||||||||||||||||||||||||||||||||||||||
| cache-dependency-path: go.sum | ||||||||||||||||||||||||||||||||||||||||||||
| - name: API package tests | ||||||||||||||||||||||||||||||||||||||||||||
| run: go test ./api/... | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
124
to
+155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The entire |
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Security Governance Policy | ||
|
|
||
| ## 1) Scope | ||
|
|
||
| This policy applies to every pull request merged into `main`, including application code, infrastructure code, API/proto contracts, and CI/CD workflows. | ||
|
|
||
| ## 2) Required PR Security Gates | ||
|
|
||
| Every PR MUST pass all of the following checks: | ||
|
|
||
| 1. **Dependency scanning** | ||
| - `npm audit --audit-level=high --omit=dev` | ||
| - `govulncheck ./...` | ||
| 2. **Secret scanning** | ||
| - `secretlint` and repository secret scanning workflow. | ||
| 3. **Static analysis scanning** | ||
| - `semgrep --config p/owasp-top-ten --error` | ||
| 4. **Filesystem vulnerability scanning** | ||
| - `trivy fs` (fail on `CRITICAL,HIGH`). | ||
|
|
||
| Any failing critical gate blocks merge. | ||
|
|
||
| ## 3) Contract Tests for API/Proto Changes | ||
|
|
||
| For any PR that changes API or proto surface (e.g. `api/**`, `*.proto`, generated protobufs), contract tests are mandatory and must pass before merge. | ||
|
|
||
| ## 4) Backward Compatibility Policy | ||
|
|
||
| ### Versioning | ||
|
|
||
| - Public API/proto changes MUST follow semantic versioning principles: | ||
| - Backward-compatible additions: **minor** version bump. | ||
| - Breaking changes: **major** version bump. | ||
|
|
||
| ### Deprecation window | ||
|
|
||
| - Deprecated fields/endpoints/RPCs must remain supported for at least **90 days** after deprecation notice. | ||
| - Deprecation notices must include: | ||
| - exact deprecation date, | ||
| - planned removal date, | ||
| - migration path. | ||
|
|
||
| ### Breaking-change controls | ||
|
|
||
| - Breaking changes require: | ||
| - explicit approval from maintainers, | ||
| - migration notes in release artifacts, | ||
| - validation that consumers have a migration path. | ||
|
|
||
| ## 5) Critical Findings SLA & Monitoring | ||
|
|
||
| ### SLA | ||
|
|
||
| - **CRITICAL findings:** remediation or approved compensating control within **24 hours**. | ||
| - **HIGH findings:** remediation within **7 calendar days**. | ||
|
|
||
| ### Monitoring & closure | ||
|
|
||
| - Security findings from CI/security tools must be triaged on every PR. | ||
| - Unresolved findings must be tracked with owner + due date. | ||
| - PRs introducing unapproved CRITICAL findings must not merge. | ||
|
|
||
| ## 6) Exceptions | ||
|
|
||
| Any policy exception must include written risk acceptance, compensating controls, and an expiry date approved by maintainers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip install semgrepwithout a version specifier fetches whatever the latest PyPI release is at run time. This contradicts the supply-chain hardening intent of this PR: a new Semgrep release could silently change rule results, break the--config p/owasp-top-tenfetch, or introduce a dependency with a vulnerability. Pin a specific version to make the scan reproducible and auditable.