|
| 1 | +# Copilot β Repository Instructions (Security-first) |
| 2 | + |
| 3 | +## Goals & tone |
| 4 | + |
| 5 | +- Apply our **Web Coding Standards** during **PR description drafting** and **code review**. |
| 6 | +- Prefer **specific, actionable** comments with short code examples. |
| 7 | +- Use severities: **[Blocker]**, **[Important]**, **[Suggestion]**. |
| 8 | +- Do **not** nitpick items handled by automation (formatting, lint rules). |
| 9 | + |
| 10 | +Related docs (important): |
| 11 | + |
| 12 | +- **Coding Standards:** docs/coding-standards.md |
| 13 | +- **Tech Radar:** docs/tech-radar.md |
| 14 | + |
| 15 | +**Additional rules (open when relevant)** |
| 16 | + |
| 17 | +- Security: `.github/instructions/security.instructions.md` |
| 18 | +- Accessibility: `.github/instructions/accessibility.instructions.md` |
| 19 | +- React/UX: `.github/instructions/react.instructions.md` |
| 20 | +- TypeScript: `.github/instructions/typescript.instructions.md` |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## PR description β Auto-checks Copilot should perform |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Security Checklist (required) |
| 29 | + |
| 30 | +- [ ] **External inputs validated & sanitised** (client/server as applicable). _Tick if_ validation/sanitisation is visible before use. |
| 31 | +- [ ] **API responses validated**; unexpected shapes handled (fallbacks/errors). _Tick if_ guards/schemas are present at boundaries. |
| 32 | +- [ ] **No unsafe HTML is rendered**; if unavoidable, sanitisation is applied **and** noted where it happens. _Fail signal:_ `dangerouslySetInnerHTML` without sanitiser (e.g., `DOMPurify.sanitize`). |
| 33 | +- [ ] **Injection risks (XSS/SQL/command) mitigated** via safe APIs/escaping. _Tick if_ sinks are avoided or safely wrapped. |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## When reviewing pull requests (Copilot) |
| 38 | + |
| 39 | +**Scope & approach** |
| 40 | + |
| 41 | +- Review **from the code diff only**; do not assume runtime behavior. |
| 42 | +- Use severities: **[Blocker]**, **[Important]**, **[Suggestion]**. |
| 43 | +- Provide concise, actionable comments; include a minimal before/after snippet where useful. |
| 44 | + |
| 45 | +### Security (focus of inline review) |
| 46 | + |
| 47 | +- Avoid/flag `dangerouslySetInnerHTML`; if present, require sanitisation and name the sanitizer. |
| 48 | +- No raw DOM insertion into trusted contexts; validate URLs/redirect targets. |
| 49 | +- Validate untrusted inputs and API responses **before** use; prefer schemas/guards. |
| 50 | +- Check for secrets/tokens in code, configs, and tests. |
| 51 | +- Call out missing error/fallback paths on boundary failures. |
| 52 | + |
| 53 | +### Accessibility (minimum check) |
| 54 | + |
| 55 | +- Keyboard access (Esc closes dialogs), visible focus, correct roles/labels. |
| 56 | +- Use of `aria-live` for async status where appropriate. |
| 57 | + |
| 58 | +### Everything else |
| 59 | + |
| 60 | +- For imports/TS/React/testing/naming/readability: **refer to** the [Coding Standards](docs/coding-standards.md). |
| 61 | + - If a standard is violated, link the relevant section and suggest a minimal change. |
| 62 | + |
| 63 | +### Technology choices |
| 64 | + |
| 65 | +- Compare any new dependencies in `package.json`/lockfiles to the [Tech Radar](docs/tech-radar.md). |
| 66 | + - If not **Adopt**/**Trial**, mark **[Blocker]** and request an RFC/approval link. |
| 67 | + - For **Trial**, ensure usage is narrowly scoped and success criteria exist. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Comment format Copilot should use |
| 72 | + |
| 73 | +**Top-level summary** |
| 74 | + |
| 75 | +- Verdict: **Ready** / **Changes requested**, with counts of Blockers/Important/Suggestions. |
| 76 | +- Mini checklist (only items evidenced by diff): Security, Accessibility, Tech choices, (then link to Coding Standards for any non-security notes). |
| 77 | + |
| 78 | +**Inline comments** |
| 79 | + |
| 80 | +- One issue per comment with severity, file:line, brief reason, and (when helpful) a minimal suggested patch. |
| 81 | + |
| 82 | +**Approval** |
| 83 | + |
| 84 | +- Approve only if there are **no Blockers** and Important items are fixed or explicitly deferred with rationale. |
0 commit comments