Skip to content

Fix knowledge file path traversal#294

Open
3em0 wants to merge 1 commit into
ragapp:mainfrom
3em0:fix-knowledge-file-path-traversal
Open

Fix knowledge file path traversal#294
3em0 wants to merge 1 commit into
ragapp:mainfrom
3em0:fix-knowledge-file-path-traversal

Conversation

@3em0
Copy link
Copy Markdown

@3em0 3em0 commented May 27, 2026

Summary

  • reject knowledge file names that contain path separators, absolute paths, or traversal components
  • resolve upload and delete targets through a shared safe data-directory helper
  • add regression tests for traversal upload/delete attempts

Fixes #293

Tests

  • UV_PROJECT_ENVIRONMENT=/tmp/ragapp-test-venv uv run --with pytest --with fastapi --with pydantic --with pydantic-settings --with python-dotenv --with pyyaml --with llama-parse --with llama-index pytest backend/tests/test_files.py -q
  • UV_PROJECT_ENVIRONMENT=/tmp/ragapp-test-venv uv run python -m py_compile backend/controllers/files.py backend/routers/management/files.py backend/tests/test_files.py

Note: full backend/tests collection is currently blocked in this checkout by missing generated create_llama/app modules and dependency-version mismatches outside this change.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

⚠️ No Changeset found

Latest commit: 8675c8d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path traversal in knowledge file upload allows writing files outside data

1 participant