feat(timestamp): add TSA URL validation and sanitization methods

This commit is contained in:
alam00000 committed 2026-07-01 23:23:37 +05:30
1 parent b09fc21e66
commit b21f602cca
7 files changed
+168 -2

No files matched your search

+12 -1
View File
@@ -4,7 +4,10 @@ import { pdfSocket } from '../sockets';
import type { SocketData } from '../types';
import { requirePdfInput, processBatch } from '../types';
import { wfError } from '../errors';
import { TIMESTAMP_TSA_PRESETS } from '../../config/timestamp-tsa.js';
import {
TIMESTAMP_TSA_PRESETS,
isAllowedTsaUrl,
} from '../../config/timestamp-tsa.js';
import { timestampPdf } from '../../logic/digital-sign-pdf.js';
import { loadPdfDocument } from '../../utils/load-pdf-document.js';
@@ -32,6 +35,14 @@ export class TimestampNode extends BaseWorkflowNode {
return TIMESTAMP_TSA_PRESETS;
}
sanitizeControlValue(key: string, value: unknown): unknown {
const sanitized = super.sanitizeControlValue(key, value);
if (key === 'tsaUrl' && !isAllowedTsaUrl(sanitized)) {
return TIMESTAMP_TSA_PRESETS[0].url;
}
return sanitized;
}
async data(
inputs: Record<string, SocketData[]>
): Promise<Record<string, SocketData>> {