Advisory

GHSA-4qq2-2j2x-x62c

Details, part 2 of 2. The advisory

Details

Recommended:

  1. For authenticate policies, call policy.auth.validate(token) whenever it is provided, regardless of auth.method.
  2. If no validator is provided, only fall back to validateApiKey() for api-key when that behavior is explicitly intended.
  3. For bearer and oauth, require a validator or a server-side token validation implementation; otherwise deny with a configuration error.
  4. For basic, decode the Basic credential safely and pass the decoded username/password or raw credential to a validator; if no validator exists, deny.
  5. Treat unknown or unsupported methods as denied, not allowed.
  6. Return authenticated context from check() after a successful authenticate policy instead of replacing it with { authenticated: false }.
  7. Add regression tests proving invalid credentials are rejected for api-key, bearer, basic, and oauth, 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/main validated: 1ad58ca02975ff1398efeda694ea2ab78f20cf3e
  • src/praisonai-ts/package.json at origin/main: praisonai 1.7.1

Suggested affected range:

npm:praisonai >= 1.5.1, <= 1.7.1

All published npm 1.x versions were swept locally:

  • 1.0.0 through 1.5.0: the tested root export was unavailable or MCPSecurity was not exported as a constructor.
  • 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6.0, 1.7.0, and 1.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-hvq5 affects the PyPI package and Python OAuthManager.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.

Sources & licences