Harden MCP rules path handling, knowledge-store identifiers, and legacy API auth defaults
Committed by MervinPraison
fix(security): harden MCP rules path handling, knowledge-store identifiers, and legacy API auth defaults (#1598)
- mcp_server/adapters/cli_tools.py: validate rule_name is a single
filename inside ~/.praison/rules. Rejects path separators, traversal
tokens, NUL bytes, and leading dots so an MCP caller cannot drop a
.pth file in user site-packages (GHSA-9mqq-jqxf-grvw).
- persistence/knowledge/{base,singlestore_vector,pgvector,cassandra}.py:
add validate_identifier() to base and call it on every collection /
schema / keyspace / table_prefix value before it is interpolated into
DDL/DML, blocking SQL/CQL injection (GHSA-3643-7v76-5cj2).
- api_server.py and deploy/{api,models,schema}.py: enable bearer-token
authentication by default, generate a random token if none is set,
use constant-time compare, and bind to 127.0.0.1 by default. The
legacy fail-open behaviour now requires explicit
PRAISONAI_API_AUTH=disabled (GHSA-6rmh-7xcm-cpxj).
- bump version to 4.6.34
- regression tests under tests/unit/{mcp,persistence}/ and
tests/unit/test_api_server_auth_default.py
Co-authored-by: Cascade <[email protected]>Editor assessment
This commit patches CVE-2026-44336. The body is genuinely informative: it names three distinct fixes, each with file paths and its own GHSA reference, from traversal rejection in the MCP rules loader through identifier validation before DDL/DML interpolation to bearer-token auth becoming the default with a constant-time compare and a loopback bind. It also records regression-test locations and the version bump. What holds it back is the header, which strings three separate changes into a subject well past a readable length and then appends a PR number, so it reads as a batch note rather than one coherent change. A scope beyond `security` and a shorter lead subject would let this excellent body carry a higher grade.