Skip to content

[Phase 1.1.2] Sanitize file download filenames and URLs #15

@richard-devbot

Description

@richard-devbot

Phase

Phase 1 — Critical Security | Track 1.1 — Input Boundary Enforcement | Priority: P0 HIGH

Vulnerability Details

File: operator_use/web/tools/browser.py:272-284
CWE: CWE-22, CWE-20

The download browser action has three vulnerabilities:

  1. Path traversal in filenamefilename can be ../../.bashrc
  2. No URL scheme validation — accepts file://, ftp://, gopher://
  3. No size limits — can cause disk exhaustion

Fix

  • Validate URL scheme (http/https only)
  • Sanitize filename with os.path.basename(), reject ..
  • Verify resolved download path stays within downloads directory
  • Add configurable max download size (default 100MB)
  • Check Content-Length header before downloading

Acceptance Criteria

  • URL scheme validated (http/https only)
  • Filename sanitized, path traversal blocked
  • Download size limit enforced
  • Security tests cover all three vectors
  • Guardrail registered in guardrails module

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions