You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
address: add optional id field for unique tracking of recycled PID/TID lifecycles
Adds an optional `id` field to `ProcessAddress` and `ThreadAddress` that
sandbox backends can populate with a sandbox-specific unique identifier
(e.g. VMRay monitor_id, or a sequential counter for CAPE). When set, this
field becomes part of equality/hashing so that two process or thread
instances that share the same OS-assigned PID/TID are treated as distinct
addresses throughout capa's pipeline.
This comprehensively fixes the ValueError crash in render (#2619) by solving
the root uniqueness problem described in #2361: rather than merging recycled
lifecycles into a single entry, each instance now gets its own identity.
Changes:
- address.py: add optional `id` to ProcessAddress and ThreadAddress; update
__eq__, __hash__, __lt__, __repr__ accordingly; backward-compatible (id=None
by default)
- freeze/__init__.py: extend from_capa/to_capa to encode/decode the new id
fields using extended tuple lengths; old 2/3/4-element tuples still decoded
correctly for backward compatibility
- vmray/extractor.py: pass monitor_id as id to both ProcessAddress and
ThreadAddress so each VMRay monitor instance is uniquely tracked
- cape/file.py: detect PID reuse via two-pass counting and assign sequential
ids; processes with unique PIDs keep id=None (no behavior change)
- render/verbose.py: add _format_process_fields / _format_thread_fields helpers
that include the id in rendered output when present
- tests/test_address_uniqueness.py: 35 unit tests covering identity, hashing,
sorting, freeze roundtrip (incl. backward compat), and compute_dynamic_layout
behavior for both recycled TIDs and recycled PIDs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments