GitHub advisory · PyPI
PraisonAI: ContextGatherer include resolution permits absolute and traversal reads outside the workspace
Description
PraisonAI's praisonai.ui.context.ContextGatherer treats the configured directory as the project workspace, but project-controlled .praisoncontext and .praisoninclude files can name absolute paths or .. traversal paths. When context gathering runs, PraisonAI opens those outside paths and appends their contents to the generated context bundle. An attacker who can supply or modify a workspace repository can therefore cause process-readable files outside the intended project root to be sent to the caller or model as project context.
ContextGatherer.get_include_paths() reads include entries directly from .praisoncontext and .praisoninclude under the configured workspace. It stores each non-comment line as a raw include path:
include_file = os.path.join(self.directory, '.praisoncontext')
if os.path.exists(include_file):
with open(include_file, 'r') as f:
include_paths.extend(
line.strip() for line in f
if line.strip() and not line.startswith('#')
)
When .praisoncontext is present, gather_context() passes every include entry through os.path.join(self.directory, include_path) and then processes the result:
for include_path in self.include_paths:
full_path = os.path.join(self.directory, include_path)
process_path(full_path)
The .praisoninclude path has the same unsafe join after first processing the workspace:
process_path(self.directory)
for include_path in self.include_paths:
full_path = os.path.join(self.directory, include_path)
process_path(full_path)
There is no canonicalization or containment check before process_path() opens files or recursively walks directories. In Python, os.path.join(workspace, absolute_path) returns the absolute path and discards workspace; `os.path.join(workspace,…
Manual fix · PyPI
pip install --upgrade "praisonai>=4.6.78"Sources