Files
BetterDesk/web-nodejs/tests/goApiProxy.test.js
T
UNITRONIX f346f891bc fix(security): phase-E shared Go API proxy, XSS hardening, audit clamp
Centralize path-segment validation in goApiProxy for fleet/commercialization/cross-platform routes while preserving RustDesk peer ID compatibility; sanitize panel JS output and cap audit Recent queries.
2026-06-09 03:22:14 +02:00

16 lines
561 B
JavaScript

'use strict';
const { safeSegment } = require('../lib/goApiProxy');
describe('goApiProxy', () => {
test('safeSegment encodes valid RustDesk-style peer IDs', () => {
expect(safeSegment('1192137448', 'deviceId')).toBe('1192137448');
expect(safeSegment('peer-abc_1', 'deviceId')).toBe('peer-abc_1');
});
test('safeSegment rejects path-smuggling segments', () => {
expect(() => safeSegment('foo/bar', 'orgId')).toThrow(/Invalid orgId/i);
expect(() => safeSegment('..', 'orgId')).toThrow(/Invalid orgId/i);
});
});