Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"dependencies": {
"@decocms/bindings": "^1.4.0",
"@decocms/runtime": "^1.6.0",
"@decocms/runtime": "^3.0.0",
"@modelcontextprotocol/sdk": "^1.27.1",
"zod": "^4.0.0"
"zod": "4.3.6"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20251014.0",
Expand Down
68 changes: 0 additions & 68 deletions github/server/lib/redirect-allowlist.test.ts

This file was deleted.

57 changes: 0 additions & 57 deletions github/server/lib/redirect-allowlist.ts

This file was deleted.

13 changes: 6 additions & 7 deletions github/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ import {
handleRepoGrantTokenRequest,
} from "./lib/repo-grant.ts";
import { setRepoGrantKV } from "./lib/repo-grant-store.ts";
import { assertAllowedRedirectUri } from "./lib/redirect-allowlist.ts";
import { REPO_GRANT_REVOKE_PATH, REPO_GRANT_TOKEN_PATH } from "./constants.ts";
import {
ALLOWED_REDIRECT_HOST_SUFFIXES,
REPO_GRANT_REVOKE_PATH,
REPO_GRANT_TOKEN_PATH,
} from "./constants.ts";
import { setTriggerKV } from "./lib/trigger-store.ts";
import { getTools } from "./tools/index.ts";
import { type Env, StateSchema } from "./types/env.ts";
Expand Down Expand Up @@ -65,6 +68,7 @@ async function getRuntime(): Promise<Runtime> {
oauth: {
mode: "PKCE",
authorizationServer: "https://github.com",
allowedRedirectHosts: [...ALLOWED_REDIRECT_HOST_SUFFIXES],

authorizationUrl: (callbackUrl) => {
const clientId = process.env.GITHUB_CLIENT_ID || "";
Expand All @@ -75,11 +79,6 @@ async function getRuntime(): Promise<Runtime> {
callbackUrlObj.searchParams.delete("state");
const redirectUri = callbackUrlObj.toString();

// Defense-in-depth: never forward a redirect_uri off the decocms.com
// origin to GitHub. GitHub returns the authorization `code` here, so
// an attacker-influenced host would hijack the code/token.
assertAllowedRedirectUri(redirectUri);

const url = new URL("https://github.com/login/oauth/authorize");
url.searchParams.set("client_id", clientId);
url.searchParams.set("redirect_uri", redirectUri);
Expand Down
Loading