Host identity: avoid collapsing unresolved hostnames onto empty-IP document IDs #9

Open
opened 2026-08-16 05:32:47 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-08-16 05:32:47 +00:00 (Migrated from github.com)

Problem

starintel:host currently computes its deterministic document ID from host-ip only. An unresolved host with an empty IP therefore hashes the empty string, causing every unresolved hostname to collide on the same canonical ID.

This was exposed while integrating Hackmode's typed local assets with canonical star-cl documents. Hackmode now refuses to project unresolved hosts rather than create corrupt central identity.

Current behavior

In src/hosts.lisp:

(defmethod set-id ((doc host))
  (when (document-id-missing-p doc)
    (hash-id doc (host-ip doc)))
  (doc-id doc))

Resolved hosts are fine. Unresolved hostnames are not.

Desired behavior

Define a deterministic host identity rule that preserves existing resolved-host compatibility where possible while giving unresolved hostname-only records distinct canonical IDs.

Candidate policy:

  • non-empty IP: preserve current IP-based identity
  • empty IP + non-empty hostname: hash a tagged hostname identity, e.g. host|hostname|<canonical-hostname> or another explicitly versioned scheme
  • both empty: reject/leave unidentifiable rather than mint the same digest for every object

Do not silently change IDs for existing resolved hosts unless a schema-version migration is deliberately designed.

Dependencies

This blocks safe projection of unresolved Hackmode host assets and similar recon pipelines into central StarIntel documents.

Acceptance criteria

  • two different unresolved hostnames receive different IDs
  • same hostname under documented normalization receives the same ID
  • existing resolved host ID fixtures remain unchanged unless a migration is explicitly approved
  • empty hostname + empty IP is handled explicitly
  • v0.9 JSON encode/decode round-trip preserves identity
  • tests cover resolved, unresolved, and invalid host cases

Verification

Extend star-cl document/host tests with stable expected hashes and round-trip fixtures. After merge, update Hackmode's projection test to allow unresolved hosts and remove the temporary projection guard.

## Problem `starintel:host` currently computes its deterministic document ID from `host-ip` only. An unresolved host with an empty IP therefore hashes the empty string, causing every unresolved hostname to collide on the same canonical ID. This was exposed while integrating Hackmode's typed local assets with canonical `star-cl` documents. Hackmode now refuses to project unresolved hosts rather than create corrupt central identity. ## Current behavior In `src/hosts.lisp`: ```lisp (defmethod set-id ((doc host)) (when (document-id-missing-p doc) (hash-id doc (host-ip doc))) (doc-id doc)) ``` Resolved hosts are fine. Unresolved hostnames are not. ## Desired behavior Define a deterministic host identity rule that preserves existing resolved-host compatibility where possible while giving unresolved hostname-only records distinct canonical IDs. Candidate policy: - non-empty IP: preserve current IP-based identity - empty IP + non-empty hostname: hash a tagged hostname identity, e.g. `host|hostname|<canonical-hostname>` or another explicitly versioned scheme - both empty: reject/leave unidentifiable rather than mint the same digest for every object Do not silently change IDs for existing resolved hosts unless a schema-version migration is deliberately designed. ## Dependencies This blocks safe projection of unresolved Hackmode host assets and similar recon pipelines into central StarIntel documents. ## Acceptance criteria - two different unresolved hostnames receive different IDs - same hostname under documented normalization receives the same ID - existing resolved host ID fixtures remain unchanged unless a migration is explicitly approved - empty hostname + empty IP is handled explicitly - v0.9 JSON encode/decode round-trip preserves identity - tests cover resolved, unresolved, and invalid host cases ## Verification Extend `star-cl` document/host tests with stable expected hashes and round-trip fixtures. After merge, update Hackmode's projection test to allow unresolved hosts and remove the temporary projection guard.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/star-cl#9
No description provided.