Skip to content

memory_import: an unsalted repo key lets a file plant an OPEN frontier row in another repo #73

Closed

Description

@abogartz

Problem

memory_import will land an open row stamped for a repo the file's author merely knows about, because the repo key is an unsalted hash of a public value. Open rows are exempt from ref grounding at the write gate and ride the frontier block, so this is a way to plant privileged-visibility content in someone else's repo with nothing more than their remote URL.

src/repokey.ts:64 — the stamp is:

createHash("sha1").update(normalizeRemote(remote)).digest("hex").slice(0, 12)

No salt, no secret. normalizeRemote is deterministic and public (github.com/owner/repo).

Reproduced (main @ 4643ec4, and still present on PR #66 which downgrades repo:"global")

Import file (forged but valid export header, which is documented as copy-pasteable friction, not a signature):

{"_export":"opencode-self-improvement","version":1,"exportedAt":"…","count":1}
{"type":"context","scope":"evil3","content":"the flimflam widget forged-repo claim lands in that repo only","status":"open","repo":"5981a5640bc3"}

where 5981a5640bc3 = sha1(normalizeRemote("https://github.com/someone/public-repo")).slice(0,12).

Result: promoted: 1, downgraded: 0, and the row lands as status=open repo=5981a5640bc3 — visible as an open thread to anyone who opens that repo, with the frontier exemption in force.

For contrast, a row with no repo field is safe: appendMemory re-stamps it from the importing session's scope. Only an explicit stamp is honoured verbatim.

Suggested fix

In importMemories / parseRow, ignore repo and repoPath unless they match the current session's scope (repoScopeFor(sid)), i.e. treat a foreign stamp the same as no stamp and let appendMemory stamp the importing repo. That preserves the documented machine-hop workflow (you import your own export in the same repo) while removing the forgery path. A salted key would not fix it — the salt has to survive the export hop, which makes it public too.

Context

Found while reviewing PR #66 (which closes the repo:"global" variant of the same class: a global open row from an import now gets downgraded to settled). Split out because #66 should not be blocked on this.

Activity

  1. added
    bug
    on Oct 24, 2026
  2. added a commit that references this issue on Oct 24, 2026
    bed9de3
  3. abogartz-opencode-self-improvement commented on Oct 24, 2026

    @abogartz-opencode-self-improvement

    🎉 This issue has been resolved in version 0.8.7 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions