feat(media-proxy): sign attachment URLs and gate origins (#2830)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-18 15:57:32 +02:00
1 parent 025c01ab13
commit 522cf08e61
108 files changed
+10148 -441

No files matched your search

+5 -3
View File
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {createHash} from 'node:crypto';
import {stripOwnAttachmentSignature} from '@app/api/attachment/AttachmentUrls';
import {Config} from '@app/api/Config';
import {Logger} from '@app/api/Logger';
import * as InviteUtils from '@app/api/utils/InviteUtils';
@@ -103,9 +104,10 @@ export function extractURLs(inputText: string) {
if (isFluxerAppExcludedURL(url)) continue;
const encoded = idnaEncodeURL(url);
if (!encoded) continue;
if (!seen.has(encoded)) {
seen.add(encoded);
result.push(encoded);
const canonical = stripOwnAttachmentSignature(encoded);
if (!seen.has(canonical)) {
seen.add(canonical);
result.push(canonical);
if (result.length >= 5) break;
}
}