feat(desktop): support remote runtime headers

This commit is contained in:
Bohdan Triapitsyn
2026-06-30 00:30:48 +03:00
parent 9c1eb755f9
commit 359c73fcf3
23 changed files with 458 additions and 45 deletions
@@ -0,0 +1,16 @@
const isReservedRuntimeRequestHeaderName = (name) => {
return String(name || '').trim().toLowerCase() === 'authorization';
};
export const sanitizeRuntimeRequestHeaders = (headers) => {
if (!headers || typeof headers !== 'object') return {};
const next = {};
for (const [rawName, rawValue] of Object.entries(headers)) {
const name = typeof rawName === 'string' ? rawName.trim() : '';
const value = typeof rawValue === 'string' ? rawValue.trim() : '';
if (!name || !value || /[\r\n:]/.test(name) || /[\r\n]/.test(value)) continue;
if (isReservedRuntimeRequestHeaderName(name)) continue;
next[name] = value;
}
return next;
};