Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -13,6 +13,7 @@ const publicOperationAllowlist = new Set([
|
||||
"GET /v1/docs",
|
||||
"GET /v1/openapi.json",
|
||||
"POST /v1/auth/login",
|
||||
"POST /v1/billing/mollie/webhooks",
|
||||
]);
|
||||
const optionalAnonymousAllowlist = new Set(["POST /v1/api-keys/validate"]);
|
||||
|
||||
@@ -83,18 +84,6 @@ function hasNonEmptySecurityRequirement(security: unknown) {
|
||||
return Array.isArray(security) && security.some((requirement) => isRecord(requirement) && Object.keys(requirement).length > 0);
|
||||
}
|
||||
|
||||
function usesScheme(operation: OperationObject, schemeName: string) {
|
||||
return securityRequirementSchemeNames(operation.security).includes(schemeName);
|
||||
}
|
||||
|
||||
function isScopedApiKeyPath(path: string) {
|
||||
return /^\/v1\/entities\/\{entity\}\/rows(?:\/\{rowId\})?$/.test(path) || /^\/v1\/relationships(?:\/\{id\})?$/.test(path);
|
||||
}
|
||||
|
||||
function isServiceTokenOnlyMetadataPath(path: string) {
|
||||
return /^\/v1\/entities\/\{entity\}$/.test(path);
|
||||
}
|
||||
|
||||
export function validateOpenApiSecurity(document: OpenApiDocument = openApiDocument): GuardResult {
|
||||
const declaredSchemes = new Set(Object.keys(document.components?.securitySchemes ?? {}));
|
||||
const violations: string[] = [];
|
||||
@@ -139,14 +128,6 @@ export function validateOpenApiSecurity(document: OpenApiDocument = openApiDocum
|
||||
violations.push(`${context}: anonymous security requirement is only allowed for optional-auth allowlisted operations`);
|
||||
}
|
||||
}
|
||||
|
||||
if (isScopedApiKeyPath(entry.path) && usesScheme(operation, "apiKeyHeader") && operation["x-api-key-permissions"] === undefined) {
|
||||
violations.push(`${context}: scoped apiKeyHeader operation must include x-api-key-permissions`);
|
||||
}
|
||||
|
||||
if (isServiceTokenOnlyMetadataPath(entry.path) && operation["x-api-key-permissions"] !== undefined) {
|
||||
violations.push(`${context}: service-token metadata operation must not include x-api-key-permissions`);
|
||||
}
|
||||
}
|
||||
|
||||
return { ok: violations.length === 0, violations };
|
||||
|
||||
Reference in new issue
Block a user