diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5f2cf9f..f131e3d 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -22,3 +22,7 @@ Read [`AGENTS.md`](../AGENTS.md) and [`docs/DESIGN-PIVOT.md`](../docs/DESIGN-PIV ## Key paths `policy.cedar`, `policy.cedarschema`, `protect-mcp.config.json`, `packages/cedar-daemon`, `apps/secure-gateway`, `packages/crypto-utils`, `apps/admin-dashboard`. + +## Coding standards + +Follow path-specific files in [`.github/instructions/`](instructions/). Copilot code review loads [`.github/skills/code-review/`](skills/code-review/). diff --git a/.github/instructions/cedar.instructions.md b/.github/instructions/cedar.instructions.md new file mode 100644 index 0000000..5bc502e --- /dev/null +++ b/.github/instructions/cedar.instructions.md @@ -0,0 +1,10 @@ +--- +applyTo: "**/*.cedar,**/*.cedarschema" +--- + +# Cedar coding standards (September 2026) + +- Keep authorization fail-closed. A missing policy, schema mismatch, or unavailable PDP is a deny. +- Do not introduce a silent fallback from enforce to shadow. +- Validate against the checked-in schema (`policy.cedarschema` or the service equivalent). +- Pair policy edits with the existing Cedar validation script or tests. diff --git a/.github/instructions/tests.instructions.md b/.github/instructions/tests.instructions.md new file mode 100644 index 0000000..cc67037 --- /dev/null +++ b/.github/instructions/tests.instructions.md @@ -0,0 +1,15 @@ +--- +applyTo: "**/*.{test,spec}.ts,**/*.{test,spec}.tsx,**/tests/**/*.ts,**/tests/**/*.tsx" +--- + +# Test standards (September 2026) + +- Ship behavior with a test in the existing layout (co-located `*.test.ts` or `tests/`). +- Do not skip, delete, or weaken verify, lint, typecheck, or adversarial gates to land a change. +- Do not invent a passing gate from prose. Run the documented verify command. +- Fixtures are synthetic. Never commit real PII, PHI, payroll, or credentials. + +## This repository + +- Definition of Done: `./scripts/harness/verify.sh`. +- Cedar: `bash scripts/cedar-validate.sh`. diff --git a/.github/instructions/typescript.instructions.md b/.github/instructions/typescript.instructions.md new file mode 100644 index 0000000..6a630b1 --- /dev/null +++ b/.github/instructions/typescript.instructions.md @@ -0,0 +1,21 @@ +--- +applyTo: "**/*.ts,**/*.tsx" +--- + +# TypeScript coding standards (September 2026) + +- Write TypeScript, not new application JavaScript. Leave existing tooling `.js` / `.mjs` / `.cjs` files alone. +- Place imports at the top of the module. Do not use inline `import()` in function bodies except for a documented circular-dependency or optional-runtime case. +- Prefer early returns over nested conditionals. +- On `switch` over a discriminated union or enum, handle every variant. Use a `never` check in `default` so newly added variants fail at compile time. +- Do not introduce `any` in new production code. Prefer `unknown` plus narrowing. Do not use non-null assertions to silence `strict` or `noUncheckedIndexedAccess`. +- Match this repository's existing formatter and linter. Do not add a second style system. +- Keep public unions narrow. Do not widen a literal union to `string` without a spec change. +- Do not weaken fail-closed, human-in-the-loop, tenancy, or verify gates to make types compile. + +## This repository + +- Authorization and Ed25519 receipts stay on the MCP tool-call path. +- Do not convert authorize, kill-switch, PDP, principal-signature, or production-profile paths to fail-open. +- Shadow mode may log-without-block only when `protect-mcp.config.json` `mode` is explicitly `shadow`. +- Do not treat this tree as a prompt-injection classifier. diff --git a/.github/skills/code-review/SKILL.md b/.github/skills/code-review/SKILL.md new file mode 100644 index 0000000..bc5bc6f --- /dev/null +++ b/.github/skills/code-review/SKILL.md @@ -0,0 +1,28 @@ +--- +name: code-review +description: "Review FidusGate PRs for fail-closed Cedar authorize and Ed25519 receipt integrity. Use on pull requests that touch policy.cedar, the secure gateway, crypto-utils, or the admin console. Flag silent enforce-to-shadow fallbacks." +--- + +# Copilot code review — FidusGate + +Use this skill when reviewing a pull request in this repository. + +FidusGate issues **signed Ed25519 receipts for MCP tool calls**. + +- Reject fail-open authorize, kill-switch, PDP, or production-profile paths. +- Reject silent fallback from enforce to shadow. +- Do not treat Cedar work as a prompt-injection classifier. +- Verify with `./scripts/harness/verify.sh` and `bash scripts/cedar-validate.sh` when policies change. + + +## Always flag + +- Secrets, `.env` values, private keys, or real personal data in the diff +- Weakened or skipped verify / lint / typecheck / adversarial gates +- Invented success (prose claiming a gate passed with no command output) +- Fail-open authorization, skipped human approval, or agents recording `--actor user` + +## Never request + +- Drive-by major upgrades, formatter churn, or unrelated refactors +- Softening honesty disclaimers or certification claims diff --git a/AGENTS.md b/AGENTS.md index db9d01a..248e9fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -41,3 +41,9 @@ Do not convert authorize, kill-switch, PDP, principal-signature, production-prof ## Honesty Keep demo and mock surfaces labeled as demo (local keys, JSON datastore, simulated syscalls/OIDC). Do not add sidecar features to compete with OpenFirma, Vectimus, Symbiont, or Permit Cedar Agent. Deepen receipts and the console. + +## Coding standards (September 2026) + +Path-specific Copilot instructions: [`.github/instructions/`](.github/instructions/). +Repository-wide Copilot file: [`.github/copilot-instructions.md`](.github/copilot-instructions.md). +Copilot code review skill: [`.github/skills/code-review/SKILL.md`](.github/skills/code-review/SKILL.md). diff --git a/llms.txt b/llms.txt index 8bbfbb3..7dbc188 100644 --- a/llms.txt +++ b/llms.txt @@ -24,3 +24,6 @@ FidusGate does not compete as a generic zero-trust agent governance platform. Op - [MCP 2026-07-28 migration](https://github.com/SafetyMP/FidusGate/blob/main/docs/mcp-2026-07-28-migration.md) - [OWASP MCP Top 10 ADR](https://github.com/SafetyMP/FidusGate/blob/main/docs/adr/0001-owasp-mcp-top-10.md) - [GitHub storefront playbook](https://github.com/SafetyMP/FidusGate/blob/main/docs/community/github-presentation.md) +- [.github/copilot-instructions.md](.github/copilot-instructions.md): repository-wide Copilot coding standards +- [.github/instructions/](.github/instructions/): path-specific Copilot coding standards (September 2026) +- [.github/skills/code-review/SKILL.md](.github/skills/code-review/SKILL.md): Copilot code review skill