Harden alarm push auth and session export ZIP paths.

Ignore hub alarms before auth-ok, stop reconnecting after auth-fail, serialize sticky delivery with dispose on reset, and sanitize ZIP entry names against path traversal.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-06 14:45:35 +08:00
parent 92279c1220
commit 5598b3661c
5 changed files with 148 additions and 56 deletions

View file

@ -7,8 +7,10 @@ import {
sessionsExportZipFilename,
} from '../src/netx/session-export.ts'
test('safePathSegment strips path separators and dots', () => {
assert.equal(safePathSegment('../a/b'), '___a_b')
test('safePathSegment strips path separators and keeps filename extensions', () => {
assert.equal(safePathSegment('../a/b'), 'b')
assert.equal(safePathSegment('..\\evil.jsonl'), 'evil.jsonl')
assert.equal(safePathSegment('session.jsonl'), 'session.jsonl')
assert.equal(safePathSegment('netxops-alarm-abc'), 'netxops-alarm-abc')
})