Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Hono } from "hono";
import type { Context } from "hono";
import { serve } from "@hono/node-server";
import { trimTrailingSlash } from "hono/trailing-slash";
import { getPath } from "hono/utils/url";
import type { ContentfulStatusCode } from "hono/utils/http-status";

const BASE = "https://raw.githubusercontent.com/getsentry/sentry-for-ai/refs/heads/main";
Expand Down Expand Up @@ -41,7 +42,11 @@ async function proxyText(c: Context, url: string): Promise<Response> {
}

// App
const app = new Hono();
// Hono does not normalize double slashes in paths (https://github.com/honojs/hono/issues/3034),
// which can lead to open redirects via protocol-relative URLs (e.g. //evil.com).
const app = new Hono({
getPath: (request) => getPath(request).replace(/\/+/g, "/"),
});
app.use(trimTrailingSlash({ alwaysRedirect: true }));

app.get("/", (c) => proxyText(c, `${BASE}/SKILL_TREE.md`));
Expand Down