Security Sprint M7.1: Fix P1 Security Issues (#283, #288, #289, #290) #319

Merged
jason.woltje merged 4 commits from fix/283-connection-status-validation into develop 2026-02-04 03:38:20 +00:00
2 changed files with 14 additions and 1 deletions
Showing only changes of commit ecb33a17fe - Show all commits

View File

@@ -198,6 +198,18 @@ describe("FederationService", () => {
expect(result1.publicKey).not.toEqual(result2.publicKey);
expect(result1.privateKey).not.toEqual(result2.privateKey);
});
it("should generate RSA-4096 key pairs for future-proof security", () => {
// Act
const result = service.generateKeypair();
// Assert - Verify key size by checking approximate length
// RSA-4096 keys are significantly larger than RSA-2048
// Private key in PKCS8 format: RSA-2048 ≈ 1700 bytes, RSA-4096 ≈ 3200 bytes
// Public key in SPKI format: RSA-2048 ≈ 400 bytes, RSA-4096 ≈ 800 bytes
expect(result.privateKey.length).toBeGreaterThan(3000);
expect(result.publicKey.length).toBeGreaterThan(700);
});
});
describe("regenerateKeypair", () => {

View File

@@ -57,10 +57,11 @@ export class FederationService {
/**
* Generate a new RSA key pair for instance signing
* Uses RSA-4096 for future-proof security (NIST recommendation)
*/
generateKeypair(): KeyPair {
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
modulusLength: 2048,
modulusLength: 4096,
publicKeyEncoding: {
type: "spki",
format: "pem",