feat: add guarded document workbench foundations
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
masterplan-lock / check (push) Successful in 5s
Security Scan (SIAX Cloud) / security (push) Successful in 15s
CI (SIAX Cloud) / security (push) Successful in 16s
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 7s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 21s
CI (SIAX Cloud) / security (pull_request) Successful in 25s
CI (SIAX Cloud) / quality (push) Successful in 1m17s
CI (SIAX Cloud) / integration (pull_request) Successful in 54s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m7s

This commit is contained in:
2026-11-02 01:26:36 +01:00
parent cb01f948eb
commit bd1c20edb2
34 changed files with 1992 additions and 19 deletions
+14
View File
@@ -151,6 +151,20 @@ describe('resolveAuthContext -- enforced mode (the default)', () => {
}
});
it('rejects a forged actor header and accepts only the verified subject', async () => {
const forged = await resolveAuthContext(
h({ authorization: 'Bearer good.tok.en', 'x-actor-id': 'user_other' }),
{ enforce: true, verify: okVerify },
);
expect(forged).toMatchObject({ ok: false, status: 403, code: 'OPT_ACCESS_DENIED' });
const matching = await resolveAuthContext(
h({ authorization: 'Bearer good.tok.en', 'x-actor-id': 'user_1' }),
{ enforce: true, verify: okVerify },
);
expect(matching.ok).toBe(true);
if (matching.ok) expect(matching.ctx.actorId).toBe('user_1');
});
it('allows a matching X-Tenant-Id', async () => {
const d = await resolveAuthContext(
h({ authorization: 'Bearer good.tok.en', 'x-tenant-id': 'tenant_x' }),