Require an API key before exposing an MCP HTTP-stream server
You will start your PraisonAI MCP HTTP-stream server only with an explicitly set API key and confirm that unauthenticated requests are rejected. This closes a gap where an unset key left the server open to callers.
- Upgrade praisonaiUse 4.6.78 or later
- Set an API keyPass it explicitly, never rely on the default
- Bind to localhostExpose remotely only behind TLS
- Test rejectionUnauthenticated requests must fail
Why it matters
PraisonAI's MCP HTTP-stream server only checked authentication when an API key was configured, and the CLI defaulted --api-key to None, so a plain serve command left it open (GHSA-hc5v-gxvj-58wh (opens external site)). Anyone who could reach the port could enumerate tools and send tool-call arguments that were not validated against their input schema. This was rated CVSS 7.3 (GHSA-hc5v-gxvj-58wh (opens external site)), and the fix shipped in praisonai 4.6.78 (GHSA-hc5v-gxvj-58wh (opens external site)).
Steps
- Upgrade praisonai to 4.6.78 or later before you run any HTTP-stream server.
- Generate a long random key and store it in your secret manager or an environment variable, not in a script, a committed config file, or shell history.
- Start the server with the key passed explicitly through
--api-keyinstead of relying on the default, which isNone:
praisonai mcp serve --transport http-stream --api-key <your-key>
- Bind the server to localhost unless remote clients truly need it. If they do, put a TLS reverse proxy in front of it and keep the key check enforced at the server.
- Send a request without the key and confirm it is rejected. Then send one with the correct key and confirm it succeeds.
- Limit the tools the server exposes to what your clients actually call, so a misused call has a smaller blast radius.
- If the server ever ran without a key on a reachable network, treat that key as compromised, rotate it, and review which tools were called.
Common mistakes
- Assuming an internal host is protected. Any reachable port can be used by anyone on that network.
- Dropping the key flag from a deployment script after an upgrade, which quietly returns you to the unset default.
- Storing the key in a systemd unit or config file that other users on the machine can read.
- Checking the key only at startup instead of on every request.
Checklist
0 of 8 done