fix(pdd-extension): 增强 MMS Cookie 多维嗅探与 PASS_ID 校验,新增插件运行日志与升级 v1.1.0
This commit is contained in:
@@ -40,12 +40,12 @@ test('decryptPddExtensionPayload successfully decrypts valid envelope', () => {
|
||||
assert.equal(decrypted.nonce, payload.nonce)
|
||||
})
|
||||
|
||||
test('decryptPddExtensionPayload rejects expired timestamp (> 60s)', () => {
|
||||
test('decryptPddExtensionPayload rejects expired timestamp (> 300s)', () => {
|
||||
const kp = getOrCreatePddRsaKeyPair()
|
||||
const payload = {
|
||||
shopId: 'store_test_01',
|
||||
cookie: 'PASS_ID=test_pass;',
|
||||
timestamp: Date.now() - 120_000, // 2 minutes ago
|
||||
timestamp: Date.now() - 600_000, // 10 minutes ago (> 300s)
|
||||
nonce: 'nonce-expired-' + Math.random().toString(36).slice(2),
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,10 @@ export interface PddDecryptedCookiePayload {
|
||||
nonce: string
|
||||
}
|
||||
|
||||
// In-memory Nonce cache for anti-replay attacks (TTL: 3 minutes)
|
||||
// In-memory Nonce cache for anti-replay attacks (TTL: 6 minutes)
|
||||
const seenNonces = new Map<string, number>()
|
||||
const NONCE_TTL_MS = 180_000
|
||||
const MAX_TIMESTAMP_SKEW_MS = 60_000
|
||||
const NONCE_TTL_MS = 360_000
|
||||
const MAX_TIMESTAMP_SKEW_MS = 300_000
|
||||
|
||||
function cleanupExpiredNonces() {
|
||||
const now = Date.now()
|
||||
|
||||
Reference in New Issue
Block a user