Skip to content

fix(parsers): provider detection ordering + broad exception catches #477

Closed

Description

@Sinity

Problems

Provider detection trivially spoofable

sources/dispatch.py:80-95 — chatgpt.looks_like (checks "mapping": {}) and claude.looks_like_ai (checks "chat_messages": []) run BEFORE the more specific codex.looks_like and claude.looks_like_code checks. A Claude Code or Codex record with a stray "mapping": {} key is misidentified as ChatGPT and dispatched to the wrong parser.

Bare except Exception masks MemoryError in Gemini parser

sources/parsers/drive.py:197 catches bare Exception (including MemoryError, KeyboardInterrupt) for defense-in-depth on Pydantic validation. Should catch only (ValidationError, TypeError, ValueError).

Non-deterministic parsing path from transient JSONL probe failure

pipeline/services/ingest_worker.py:409-418 — _build_stream_parse_plan() catches broad Exception during JSONL probing and returns None, causing fallback to a different parsing path. Transient I/O error or memory pressure can cause the same file to produce different parse results across runs.

No file size limit during blob acquisition

sources/source_acquisition_components.py:210-224 — files are streamed into the blob store without any size check. Multi-GB files are fully persisted before any size gate engages.

Affected code

  • sources/dispatch.py:80-95 — detection ordering
  • sources/parsers/drive.py:197 — bare except Exception
  • pipeline/services/ingest_worker.py:409-418 — non-deterministic probe
  • sources/source_acquisition_components.py:210-224 — no size limits

Discovered during adversarial audit 2026-04-26.

Activity

  1. Sinity commented on Apr 26, 2026

    @Sinity
    OwnerAuthor

    Partially addressed by #489. Remaining items tracked in this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parsertype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions