镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Private ABI: seed borrowed-string and heap-snapshot interning #763

Closed

Description

@chrisbbreuer

Parents: #493, #495
Related: #759, #762

Problem

Private ABI borrowed ZigString views and heap-snapshot string tables still place runtime/host-controlled exact bytes in default-seeded native string maps. Predictable placement lets adversarial property names, URLs, source text, and diagnostic edge names force collision-heavy work at private embedding and heap-inspection boundaries.

Scope

  • Generalize the C/private-ABI lazy secure exact-byte map introduced by C API: harden host and private property-name deduplication #762 so memberships and value maps share one reviewed implementation.
  • Give each context-group borrowed-view store, the mutex-protected context-free borrowed-view store, and each heap-snapshot string table its own lazily installed unpredictable Wyhash context.
  • Keep empty/look-up-only paths entropy- and allocation-free; publish a context only after the first successful native-table mutation.
  • Preserve borrowed-view pointer stability, Latin-1/UTF-16 tagging and ownership, embedded-NUL equality, snapshot string indices/order/schema, and existing OOM/error publication.
  • Make duplicate insertion cleanup and snapshot item/map rollback explicit and leak-free.

No-workaround rules

  • No input/property/depth caps, deterministic fallback seeds, hash-only equality, skipped strings/edges, reordered output, swallowed allocation failure, or weakened ABI lifetime behavior.
  • No stack, queue, job, Promise, Worker, or Map/Set iterator implementation changes.

Acceptance

  • All three private ABI string-map lifetimes use lazy independent secure contexts through one exact-byte primitive.
  • Empty, duplicate, embedded-NUL, non-Latin-1, and 4 KiB cases preserve exact behavior and stable borrowed results.
  • Entropy and allocation failures leave the first mutation unpublished and all owned buffers reclaimed.
  • Focused normal and TSan tests pass with zero leaks/races.
  • Exact-parent private ABI fixtures and relevant heap-snapshot/property-name tests have nonzero accounting and zero regressions.

Activity

  1. chrisbbreuer commented on Aug 25, 2026

    @chrisbbreuer
    MemberAuthor

    Implemented and pushed to main in fix(private-abi): seed borrowed string interning (#763). Group/global borrowed views and each heap-snapshot table now use independent lazy secure exact-byte contexts, group access has a leaf lock outside optional API-lock scopes, and all ownership/OOM rollbacks are explicit. Normal/TSan are 7/7; exact-parent private fixtures and 155 relevant Test262 cases show 0 regressions.

  2. chrisbbreuer commented on Aug 25, 2026

    @chrisbbreuer
    MemberAuthor

    Follow-up #764 is complete in fix(strings): randomize intern table placement (#764). The private borrowed-view maps from #763 and the shared InternTable now both avoid predictable attacker-controlled placement, without changing canonical string identity or ABI behavior.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions