Описание
PraisonAI: Authentication fail-open in Recipe server allows unauthenticated access when API key or JWT auth is configured without a secret
Summary
The PraisonAI Recipe HTTP server silently allows unauthenticated requests when auth is configured as api-key or jwt but the corresponding secret is missing.
This creates an authentication fail-open condition. An operator can start the Recipe server with authentication enabled, including on a non-localhost interface, but the server still accepts unauthenticated requests if no API key or JWT secret is provided.
The issue is especially risky because the CLI safety check for non-localhost binding only verifies that auth != "none". It does not verify that an actual API key or JWT secret exists.
Details
The Recipe server documents the following authentication modes:
noneapi-keyjwt
Relevant source locations:
src/praisonai/praisonai/recipe/serve.pysrc/praisonai/praisonai/cli/features/recipe.py
In create_auth_middleware(), the API key middleware resolves the expected key as:
This means auth: api-key does not enforce authentication if api_key / PRAISONAI_API_KEY is missing.
The JWT middleware has the same fail-open behavior:
The auth middleware is still attached when auth is configured:
The CLI path makes this externally reachable in a misconfigured deployment. In cmd_serve, the non-localhost safety check only verifies that auth is not "none":
Therefore, this command passes the safety check:
However, if no --api-key or PRAISONAI_API_KEY is configured, requests are still accepted without authentication.
Affected endpoints include:
POST /v1/recipes/runPOST /v1/recipes/streamPOST /v1/recipes/validate- optional
POST /admin/reloadwhenenable_adminis true
PoC
The following local PoC verifies that api-key and jwt authentication fail open when the corresponding secret is missing.
Run from the repository root with test dependencies installed:
poc_recipe_auth_fail_open.py:
Observed output:
The important result is that auth=api-key without a configured key allows requests to protected endpoints, while the same endpoint correctly returns 401 when a key is configured and missing/wrong.
Impact
In an exposed deployment, an unauthenticated attacker can access Recipe server endpoints even though the operator selected api-key or jwt authentication.
This gives unauthenticated access to recipe execution endpoints such as:
POST /v1/recipes/runPOST /v1/recipes/stream
If admin endpoints are enabled, the attacker can also access:
POST /admin/reload
The impact depends on the available recipes and deployment configuration. In the worst case, unauthenticated users can trigger recipe workflows or administrative reload operations on an externally bound Recipe server.
Пакеты
PraisonAI
< 4.6.58
4.6.58
Связанные уязвимости
PraisonAI is a multi-agent teams system. Prior to praisonai 4.6.58, create_auth_middleware() allows requests when auth=api-key lacks PRAISONAI_API_KEY or JWT authentication lacks PRAISONAI_JWT_SECRET. An externally bound Recipe server can therefore accept unauthenticated POST /v1/recipes/run requests despite authentication being enabled. This issue is fixed in version 4.6.58.