FrankenNetworkX

Guide/Evidence

Security Doctrine

1 min readFrom the README

The project defends against:

  • Malformed graph ingestion. Every parser (fnx-readwrite) is cargo-fuzz hardened with 33 corpus-seeded targets covering edgelist, adjlist, GraphML, GML, JSON, Pajek, GEXF, node-link, attribute-value, and multigraph variants.
  • Attribute confusion. CgseValue is a typed serde-compatible value with a controlled set of variants. GraphML/GML parsers validate keys, scope attributes, reject empty keys, escape # in edgelist attrs, and enforce typed parsing (so bool=0/1 doesn't become an integer downstream).
  • Algorithmic denial vectors. Algorithms follow NetworkX on non-finite weights (NaN, ±∞) in every mode — shortest-path kernels route such inputs to NetworkX-exact paths rather than guess. The readers fail closed in strict mode on malformed or unknown input (malformed directed flags, namespace-prefix abuse, unknown GraphML attribute types) and apply bounded, logged recovery in hardened mode. Generator size budgets (100,000 nodes; 20,000 for G(n, p)-style random generators; 2,000-node or 1,999,000-edge dense graphs) apply in hardened mode only, where an over-budget size is clamped to the budget with a Python RuntimeWarning naming the clamp: strict mode builds every size NetworkX builds, and only a size that overflows usize fails closed.
  • Stack-safety on deep graphs. Traversal-heavy algorithms (DFS, planarity, transitive closure) avoid unbounded recursion.

The minimum security bar (per AGENTS.md):

  1. Threat-model notes for each major subsystem.
  2. Fail-closed behavior for unknown incompatible features.
  3. Adversarial fixture coverage and fuzz/property tests for high-risk parsers and state transitions.
  4. Deterministic audit logs for recoveries and policy overrides.