@opengeni/api-router 0.5.7 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/http/auth.ts CHANGED
@@ -3,6 +3,7 @@ import type { Context, MiddlewareHandler } from "hono";
3
3
  import { installExactPaths, isInstallRedirectPath } from "../routes/install";
4
4
 
5
5
  const githubConnectPathPattern = /^\/v1\/workspaces\/[^/]+\/github\/connect$/;
6
+ const githubInstallationLinkPathPattern = /^\/v1\/workspaces\/[^/]+\/github\/installations$/;
6
7
 
7
8
  export function requireAccessKey(settings: Settings): MiddlewareHandler {
8
9
  return async (c, next) => {
@@ -58,15 +59,22 @@ function isAuthExempt(c: Context, settings: Settings): boolean {
58
59
  if (path.startsWith("/v1/catalog-assets/")) {
59
60
  return true;
60
61
  }
61
- // Browser entry for MCP-issued GitHub install links: opened in a browser
62
- // that holds no API credentials, like the callbacks above. The route itself
63
- // verifies the signed workspace-bound state before doing anything.
62
+ // Compatibility entry for already-issued GitHub install/link URLs. It stays
63
+ // public like the callbacks above, verifies signed workspace-bound state,
64
+ // and then terminates with 410 while new installation binding is disabled.
64
65
  if (githubConnectPathPattern.test(path)) {
65
66
  return true;
66
67
  }
68
+ // Compatibility endpoint for stale chooser submissions. It remains public
69
+ // only so already-rendered forms can authenticate their signed account and
70
+ // workspace state locally before terminating with 410; it does not parse a
71
+ // ticket, resolve browser authority, or write an installation binding.
72
+ if (c.req.method === "POST" && githubInstallationLinkPathPattern.test(path)) {
73
+ return true;
74
+ }
67
75
  // The get.<domain> install-serving routes (install.sh/.ps1/uninstall.sh/
68
76
  // minisign pub + the release-binary redirects). Reached by a fresh machine
69
- // with no credentials; the bodies carry no secrets (dossier §23.1).
77
+ // with no credentials; the bodies carry no secrets.
70
78
  if (installExactPaths.has(path) || isInstallRedirectPath(path)) {
71
79
  return true;
72
80
  }