Skip to content

Harden local structured input loading - #31

Merged
MarcelT87 merged 11 commits into
mainfrom
fix/local-structure-hardening
Oct 5, 2026
Merged

MarcelT87 merged 11 commits into
mainfrom
fix/local-structure-hardening

Conversation

@MarcelT87

Copy link
Copy Markdown
Owner

Summary

Apply the same bounded structured-input handling used by bundle verification to local state, context, profile and system-identity files.

The public bundle path was already hardened in #27. Local beginner-facing files could still surface a raw Python RecursionError or reach recursive processing when given pathologically nested data.

Changes

  • centralize the existing structure limits in a small shared helper;
  • preserve the current bundle limits and behavior;
  • apply the same limits to:
    • local evidence state JSON;
    • local context metadata JSON;
    • explicit/local YAML profiles;
    • local system identity JSON;
  • translate JSON/YAML recursion failures into the existing domain errors:
    • StateError;
    • ContextError;
    • ProfileError;
    • SystemIdentityError.

Current limits remain:

  • maximum nesting depth: 64;
  • maximum traversed structure size: 1,000,000 nodes;
  • repeated/cyclic container references are rejected.

Tests

Adds regression coverage for:

  • deeply nested local state;
  • deeply nested local context metadata;
  • deeply nested local profile;
  • cyclic YAML alias profile;
  • deeply nested local system identity.

Existing bundle hardening tests continue to exercise the same limits through the shared helper.

Scope

Robustness and beginner-facing error handling only.

No eBUS parser, transport framing, Evidence semantics, profile content, bundle schema, submission policy or heating-system behavior changes.

@MarcelT87
MarcelT87 merged commit 42ca39d into main Oct 5, 2026
5 checks passed
@MarcelT87
MarcelT87 deleted the fix/local-structure-hardening branch October 5, 2026 13:13
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.

1 participant