Details
Recommended:
- For
authenticatepolicies, callpolicy.auth.validate(token)whenever it is provided, regardless ofauth.method. - If no validator is provided, only fall back to
validateApiKey()forapi-keywhen that behavior is explicitly intended. - For
bearerandoauth, require a validator or a server-side token validation implementation; otherwise deny with a configuration error. - For
basic, decode the Basic credential safely and pass the decoded username/password or raw credential to a validator; if no validator exists, deny. - Treat unknown or unsupported methods as denied, not allowed.
- Return authenticated context from
check()after a successful authenticate policy instead of replacing it with{ authenticated: false }. - Add regression tests proving invalid credentials are rejected for
api-key,bearer,basic, andoauth, and that each configured validator is called.
Minimal fail-closed shape:
if (policy.type === 'authenticate') {
if (!policy.auth) return { allowed: false, reason: 'Authentication policy is not configured' };
const token = request.headers ? this.extractToken(request.headers) : null;
if (!token) return { allowed: false, reason: 'Authentication required' };
if (policy.auth.validate) {
const valid = await policy.auth.validate(token);
return valid
? { allowed: true, context: { authenticated: true } }
: { allowed: false, reason: 'Invalid credentials' };
}
if (policy.auth.method === 'api-key') {
return this.validateApiKey(token)
? { allowed: true, context: { authenticated: true } }
: { allowed: false, reason: 'Invalid credentials' };
}
return { allowed: false, reason: 'Authentication validator required' };
}
Affected Package/Versions
- Repository:
MervinPraison/PraisonAI - Ecosystem:
npm - Package:
praisonai - Component: TypeScript MCP security helper
src/praisonai-ts/src/mcp/security.ts - Published dist path:
node_modules/praisonai/dist/mcp/security.js - Latest npm package validated:
1.7.1 - Current
origin/mainvalidated:1ad58ca02975ff1398efeda694ea2ab78f20cf3e src/praisonai-ts/package.jsonatorigin/main:praisonai1.7.1
Suggested affected range:
npm:praisonai >= 1.5.1, <= 1.7.1
All published npm 1.x versions were swept locally:
1.0.0through1.5.0: the tested root export was unavailable orMCPSecuritywas not exported as a constructor.1.5.1,1.5.2,1.5.3,1.5.4,1.6.0,1.7.0, and1.7.1: vulnerable.
The package root re-exports this helper:
export {
MCPClient, createMCPClient, getMCPTools,
MCPServer, createMCPServer,
MCPSession as MCPSessionManager, createMCPSession,
MCPSecurity, createMCPSecurity, createApiKeyPolicy, createRateLimitPolicy,
type MCPClientConfig, type MCPSession, type MCPTransportType,
type MCPServerConfig, type MCPServerTool,
type SecurityPolicy, type SecurityResult
} from './mcp';
Advisory History
Visible PraisonAI advisories and prior submissions were checked. The closest public advisory is GHSA-98f9-fqg5-hvq5 / CVE-2026-34953, but that issue is distinct:
GHSA-98f9-fqg5-hvq5affects the PyPI package and PythonOAuthManager.validate_token().- This report affects the npm package and TypeScript
src/praisonai-ts/src/mcp/security.ts. - The prior issue accepts arbitrary Bearer tokens because an empty Python token store falls through to
True. - This issue accepts invalid Basic/OAuth credentials because the TypeScript validator callback is never called for those advertised methods.
- The affected ranges and patched surfaces are different.
The earlier npm MCPServer report is also distinct: it covers missing auth in the HTTP transport by default. This report covers a fail-open branch in the separate exported MCPSecurity helper when users attempt to add Basic/OAuth authentication.