Skip to content

Bound YAML graph normalization and merge expansion in Core #1892

Closed

Description

@phernandez

Problem

Follow-up from the reviewed CodeRabbit deep scan (K6 K15 K16 K22 K44). This ticket tracks one distinct fix; duplicate scan rows are consolidated here.

Reviewed evidence and scope

  • K6 (scan ID bdd818fb-e2ec-4ce0-9b29-fb3484a25f2e, review D, Medium): Shared YAML graph expansion; consolidate with K22/K44 and Cloud C12/C28.
    Source at current baseline: src/basic_memory/picoschema/parser.py:272.
  • K15 (scan ID 4c5ec225-956a-4008-af23-505338181fd8, review D, Medium): YAML identity metadata revisited as trees; consolidate graph/alias policy with K22/K44.
    Source at current baseline: src/basic_memory/okf/render.py:53.
  • K16 (scan ID 446a563e-2c02-45dd-982a-5776643076cd, review D, Medium): YAML merge-flattening expansion; same parser-resource policy, cover OKF import/export adapter.
    Source at current baseline: src/basic_memory/okf/validation.py:78.
  • K22 (scan ID dad1c54b-aede-4038-8783-15b1e70b35a5, review A, Medium): Recursive normalization expands shared YAML containers and lacks cycle/work tracking. Anchor policy at parse/normalization boundary, cover aliases, merges and cycles.
    Source at current baseline: src/basic_memory/markdown/entity_parser.py:84.
  • K44 (scan ID 2faedb82-80cd-45e2-b30b-a02144335f6a, review D, Medium): Core YAML safe_load is the same unbounded merge/alias policy family as K22/Cloud C12. safe_load prevents object construction attacks, not expansion cost.
    Source at current baseline: src/basic_memory/file_utils.py:454.

Fix and validation

  • Bound YAML graph normalization and merge expansion in Core.
  • Recheck current callers and supported behavior before choosing the smallest complete fix.
  • Add a bounded regression at the affected public or service boundary; demonstrate it fails without the fix.
  • Preserve legitimate inputs and tenant/project boundaries. Run focused tests plus repository static/type checks.

The scan/review establishes the code-level concern described above; it does not establish production exploitation. Conditional branches and local/tooling-only exposure must retain that scope.

Activity

  1. added
    security
    on Oct 28, 2026
  2. claude commented on Oct 28, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 17s —— View job


    Triage

    • Type: bug (resource-exhaustion hardening; labeled bug, security kept)
    • Priority: Medium. The scan establishes a code-level concern, not production exploitation. Exposure is mainly local or tooling, through parsing user-supplied markdown frontmatter and OKF import/export.
    • Component: Core (Markdown parsing, Picoschema, OKF, file_utils). It is not Cloud-specific, so no cloud label. Cloud C12/C28 are tracked separately.
    • Complexity: Medium. The fix needs a shared, bounded YAML load/normalize policy covering aliases, merge keys, cycles and total node/work limits. It is applied at the parse boundary and reused by the five call sites (K6, K15, K16, K22, K44). Legitimate inputs must keep working, and the regression tests need to show failure without the fix.
    • Duplicates: none found. The gh search issues queries for YAML alias/merge/safe_load returned nothing.

    This is a triage-only pass. I haven't made any code changes.

  3. added
    bug
    on Oct 28, 2026
  4. added a commit that references this issue on Oct 29, 2026
    d0a7fbc
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

    bugsecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions