Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -14,6 +14,9 @@ export type McpRuntimeConfig = {
|
||||
authorizationServerUrl: string;
|
||||
tokenHashSecret?: string;
|
||||
};
|
||||
audit: {
|
||||
chainSecret?: string;
|
||||
};
|
||||
security: {
|
||||
allowedHosts: string[];
|
||||
allowedOrigins: string[];
|
||||
@@ -24,6 +27,9 @@ const DEFAULT_ALLOWED_HOSTS = ["mcp.hivegrid.de", "staging-mcp.hivegrid.de", "lo
|
||||
const DEFAULT_ALLOWED_ORIGINS = ["https://mcp.hivegrid.de", "https://staging-mcp.hivegrid.de", "http://localhost", "http://127.0.0.1"];
|
||||
const DEFAULT_RESOURCE_URL = "https://mcp.hivegrid.de";
|
||||
const DEFAULT_AUTHORIZATION_SERVER_URL = "https://app.hivegrid.de";
|
||||
const MIN_TOKEN_HASH_SECRET_BYTES = 32;
|
||||
const MIN_AUDIT_CHAIN_SECRET_BYTES = 32;
|
||||
const REQUIRED_PRODUCTION_DEPENDENCIES = ["DATABASE_URL", "REDIS_URL"] as const;
|
||||
|
||||
export function loadMcpRuntimeConfig(env: NodeJS.ProcessEnv = process.env): McpRuntimeConfig {
|
||||
const config: McpRuntimeConfig = {
|
||||
@@ -42,6 +48,9 @@ export function loadMcpRuntimeConfig(env: NodeJS.ProcessEnv = process.env): McpR
|
||||
authorizationServerUrl: trimTrailingSlash(env.MCP_AUTHORIZATION_SERVER_URL) ?? DEFAULT_AUTHORIZATION_SERVER_URL,
|
||||
tokenHashSecret: nonEmpty(env.MCP_OAUTH_TOKEN_HASH_SECRET) ?? nonEmpty(env.API_KEY_HASH_SECRET),
|
||||
},
|
||||
audit: {
|
||||
chainSecret: nonEmpty(env.AUDIT_CHAIN_SECRET),
|
||||
},
|
||||
security: {
|
||||
allowedHosts: parseCsv(env.MCP_ALLOWED_HOSTS, DEFAULT_ALLOWED_HOSTS),
|
||||
allowedOrigins: parseCsv(env.MCP_ALLOWED_ORIGINS, DEFAULT_ALLOWED_ORIGINS),
|
||||
@@ -56,11 +65,31 @@ export function loadMcpRuntimeConfig(env: NodeJS.ProcessEnv = process.env): McpR
|
||||
// fallback) is what both the web issuer and this validator use, so requiring
|
||||
// it here is sufficient — the legacy API-key path cannot validate any real
|
||||
// key on the fallback constant anyway.
|
||||
if (config.nodeEnv === "production" && !config.oauth.tokenHashSecret) {
|
||||
if (
|
||||
config.nodeEnv === "production" &&
|
||||
(!config.oauth.tokenHashSecret || Buffer.byteLength(config.oauth.tokenHashSecret, "utf8") < MIN_TOKEN_HASH_SECRET_BYTES)
|
||||
) {
|
||||
throw new Error(
|
||||
"MCP runtime config is missing the production token hash secret: set MCP_OAUTH_TOKEN_HASH_SECRET (or API_KEY_HASH_SECRET) to the same value the web app uses. Refusing to boot on the built-in hash-secret fallback.",
|
||||
"MCP runtime config is missing a strong production token hash secret: set MCP_OAUTH_TOKEN_HASH_SECRET (or API_KEY_HASH_SECRET) to at least 32 bytes and to the same value the web app uses. Refusing to boot on a weak or built-in hash-secret fallback.",
|
||||
);
|
||||
}
|
||||
if (
|
||||
config.nodeEnv === "production" &&
|
||||
(!config.audit.chainSecret || Buffer.byteLength(config.audit.chainSecret, "utf8") < MIN_AUDIT_CHAIN_SECRET_BYTES)
|
||||
) {
|
||||
throw new Error(
|
||||
"MCP runtime config is missing a strong production audit-chain secret: set AUDIT_CHAIN_SECRET to at least 32 bytes. Refusing to boot with forgeable audit evidence.",
|
||||
);
|
||||
}
|
||||
if (config.nodeEnv === "production") {
|
||||
for (const name of REQUIRED_PRODUCTION_DEPENDENCIES) {
|
||||
if (!nonEmpty(env[name])) {
|
||||
throw new Error(
|
||||
`MCP runtime config is missing required production dependency ${name}. Refusing to report healthy before the dependency is configured.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user