Fix jwt-token
This commit is contained in:
@@ -65,9 +65,13 @@ describe('Security Tests', () => {
|
||||
// This might be valid depending on configuration
|
||||
continue;
|
||||
}
|
||||
expect.fail(`Token manipulation test "${test.name}" should have failed`);
|
||||
// Token should have been rejected but wasn't - this is unexpected
|
||||
throw new Error(`Token manipulation test "${test.name}" should have failed but was accepted`);
|
||||
} catch (error) {
|
||||
// Expected behavior - token should be rejected
|
||||
if (error.message && error.message.includes('should have failed but was accepted')) {
|
||||
throw error; // Re-throw unexpected success
|
||||
}
|
||||
expect(error.name).to.be.oneOf(['JsonWebTokenError', 'TokenExpiredError', 'NotBeforeError']);
|
||||
}
|
||||
}
|
||||
@@ -230,11 +234,15 @@ describe('Security Tests', () => {
|
||||
];
|
||||
|
||||
allowedIPs.forEach(ip => {
|
||||
expect(checkIPRestriction(ip, tenant.ip_restrictions)).to.be.true;
|
||||
const result = checkIPRestriction(ip, tenant.ip_restrictions);
|
||||
console.log(`Testing allowed IP ${ip} against ${tenant.ip_restrictions}: ${result}`);
|
||||
expect(result).to.be.true;
|
||||
});
|
||||
|
||||
blockedIPs.forEach(ip => {
|
||||
expect(checkIPRestriction(ip, tenant.ip_restrictions)).to.be.false;
|
||||
const result = checkIPRestriction(ip, tenant.ip_restrictions);
|
||||
console.log(`Testing blocked IP ${ip} against ${tenant.ip_restrictions}: ${result}`);
|
||||
expect(result).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user