feat(casan): establish assurance kernel and harden control plane
This commit is contained in:
@@ -29,3 +29,17 @@ test('auth context fails closed to viewer for unknown role claim', () => {
|
||||
});
|
||||
assert.equal(actor.role, 'viewer');
|
||||
});
|
||||
|
||||
test('JWT mode rejects direct spoofed identity headers without middleware verification', () => {
|
||||
const prior = process.env.CASAN_CP_AUTH_MODE;
|
||||
process.env.CASAN_CP_AUTH_MODE = 'jwt';
|
||||
try {
|
||||
assert.throws(() => actorFromHeaders({
|
||||
'x-casan-actor': 'attacker',
|
||||
'x-casan-role': 'org-admin',
|
||||
}), /AUTH_VERIFIED_IDENTITY_REQUIRED/);
|
||||
} finally {
|
||||
if (prior === undefined) delete process.env.CASAN_CP_AUTH_MODE;
|
||||
else process.env.CASAN_CP_AUTH_MODE = prior;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user