Skip to content

feat: normalizeAgentId — pubkey-safe agent ids, traversal closed (#79 Phase 0) - #81

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-79-phase0-agentid
Jun 12, 2026
Merged

melvincarvalho merged 1 commit into
gh-pagesfrom
issue-79-phase0-agentid

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Phase 0 of #79. Ports openclaw's normalizeAgentId slugifier verbatim (lowercase, non-[a-z0-9_-] runs → -, trim, empty → main) and applies it at every boundary agentId enters — gateway (chat.send, memory.*), channel routing, bin runAgent, CLI — plus a defensive net at the filesystem chokepoint (runContainerAgent, memory.js).

Two payoffs, both verified live:

  • Pubkey-as-agentId: a 64-char nostr pubkey hex (and npub) passes through unchanged → agents/<pubkey>/ created cleanly and answered. This is the identity keystone: one keypair can key the folder, the Nostr DM identity, card.jsonld#me, and the gitmark anchor.
  • Path traversal closed: agentId: '../../../tmp/pwned' did not escape (no /tmp/pwned); slugified to agents/tmp-pwned. A latent RCE-adjacent hole, gone.

Tests 164/164 (5 new: slug cases, pubkey/npub passthrough, URI slugify, traversal neutralization, mount-can't-escape).

…79 Phase 0)

Ports openclaw's normalizeAgentId (slugify-on-input: lowercase,
collapse disallowed runs to '-', trim, default 'main'). Applied at
every boundary agentId enters (gateway chat.send/memory.*, channel
routing, bin runAgent, CLI) plus a defensive net in runContainerAgent
and memory.js. Admits 64-char nostr pubkey hex and npub unchanged —
enabling pubkey-as-agentId — and neutralizes path traversal
(../.. -> safe slug).
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