fix(ci,canvas): restore v2.6.0 hardened backend + cache-bust courier-canvas.js?v=2.6.1 and keep configs static route
CI / Build & Quality Check (push) Waiting to run

This commit is contained in:
Amirul Islam Redwan71
2026-11-12 22:08:27 +06:00
parent c37ae2f441
commit 6c1db1a068
29 changed files with 1473 additions and 251 deletions
+15 -6
View File
@@ -12,6 +12,7 @@ declare global {
namespace Express {
interface Request {
auraAuth?: AuraAuthContext;
rawBody?: string | Buffer;
}
}
}
@@ -23,10 +24,16 @@ export interface AuditEntry {
outcome: "ok" | "denied" | "error";
}
export declare const auditLogBuffer: AuditEntry[];
/**
* F10 Fix: Accept BYOK credentials STRICTLY from request headers.
* Query parameters are completely ignored to avoid leaking secrets in proxy/access logs.
*/
export declare function hasByokCredentials(req: Request): boolean;
export declare function extractBearerToken(req: Request): string | undefined;
export declare function registerApiKey(token: string, tenantId: string, scopes?: AuthScope[], isAdmin?: boolean): void;
/**
* Resolve bearer token into tenant context and scopes (read / write).
* F01 Fix: Cryptographic Token Resolution without prefix bypass.
* Prefix matching (aura_rw_*, aura_tenant_*) is strictly abolished.
*/
export declare function resolveAuthContext(req: Request): AuraAuthContext;
/**
@@ -34,12 +41,13 @@ export declare function resolveAuthContext(req: Request): AuraAuthContext;
*/
export declare function optionalAuthMiddleware(req: Request, _res: Response, next: NextFunction): void;
/**
* Strict /mcp Authentication & Per-Key Rate Limit Guard (T1)
* Missing or invalid Bearer token -> HTTP 401 + UNAUTHORIZED envelope
* Strict /mcp Authentication & Per-Key Rate Limit Guard
* Allows unauthenticated discovery handshakes (initialize, notifications/initialized, tools/list, ping, list_couriers)
* so AI agent connectors (Claude Desktop, Cursor, Glama, LibreChat, Smithery) can connect seamlessly.
*/
export declare function requireMcpAuth(req: Request, res: Response, next: NextFunction): void;
/**
* Verify scope permission for a specific tool and record a privacy-safe audit log entry (T1)
* Verify scope permission for a specific tool and record a privacy-safe audit log entry
*/
export declare function isActionPermitted(req: Request, toolName: string, args?: Record<string, any>): {
permitted: boolean;
@@ -50,7 +58,8 @@ export declare function isActionPermitted(req: Request, toolName: string, args?:
*/
export declare function recordAuditLog(tenant: string, tool: string, args: Record<string, any> | undefined, outcome: "ok" | "denied" | "error"): void;
/**
* Verify inbound courier webhook authentication / signature (T1)
* Rejects unsigned/invalid webhook calls with HTTP 401/403.
* F09 Fix: Native Carrier Webhook HMAC-SHA256 & Token Verification.
* Pathao uses HMAC-SHA256 with PATHAO_CLIENT_SECRET over raw request body.
* Steadfast uses secret key header comparison.
*/
export declare function verifyWebhookSignature(req: Request, provider: string): boolean;