fix(media): 🐛 Don't proxy media from trusted origins, use new ProxiedUrl class
Some checks failed
CodeQL Scan / Analyze (javascript-typescript) (push) Failing after 6s
Build Docker Images / lint (push) Failing after 10s
Build Docker Images / check (push) Failing after 11s
Build Docker Images / tests (push) Failing after 27s
Build Docker Images / build (server, Dockerfile, ${{ github.repository_owner }}/server) (push) Has been skipped
Build Docker Images / build (worker, Worker.Dockerfile, ${{ github.repository_owner }}/worker) (push) Has been skipped
Deploy Docs to GitHub Pages / build (push) Failing after 6s
Mirror to Codeberg / Mirror (push) Failing after 0s
Deploy Docs to GitHub Pages / Deploy (push) Has been skipped
Nix Build / check (push) Failing after 5s

This commit is contained in:
Jesse Wierzbinski 2025-03-30 23:44:50 +02:00
parent 411fcd8af5
commit dc1ddb758d
No known key found for this signature in database
14 changed files with 114 additions and 140 deletions

View file

@ -5,7 +5,7 @@ import { getCookie } from "hono/cookie";
import { jwtVerify } from "jose";
import { JOSEError, JWTExpired } from "jose/errors";
import { z } from "zod";
import { keyPair, sensitiveString } from "~/classes/config/schema.ts";
import { url, keyPair, sensitiveString } from "~/classes/config/schema.ts";
import { ApiError } from "~/classes/errors/api-error.ts";
import authorizeRoute from "./routes/authorize.ts";
import jwksRoute from "./routes/jwks.ts";
@ -27,7 +27,7 @@ const configSchema = z.object({
url: z.string().min(1),
client_id: z.string().min(1),
client_secret: sensitiveString,
icon: z.string().min(1).optional(),
icon: url.optional(),
}),
)
.default([]),

View file

@ -1,5 +1,4 @@
import { auth, handleZodError } from "@/api";
import { proxyUrl } from "@/response";
import { RolePermission } from "@versia/client/schemas";
import { db } from "@versia/kit/db";
import { type SQL, eq } from "@versia/kit/drizzle";
@ -77,9 +76,7 @@ export default (plugin: PluginType): void => {
{
id: issuer.id,
name: issuer.name,
icon: issuer.icon
? proxyUrl(new URL(issuer.icon))
: undefined,
icon: issuer.icon?.proxied,
},
200,
);