Skip to content

store keystore-relative names in wallets.key_path#661

Merged
parkan merged 2 commits intomainfrom
fix/keystore-relative-paths
Apr 14, 2026
Merged

store keystore-relative names in wallets.key_path#661
parkan merged 2 commits intomainfrom
fix/keystore-relative-paths

Conversation

@parkan
Copy link
Copy Markdown
Collaborator

@parkan parkan commented Apr 14, 2026

KeyStore.Put returned an absolute path that got written into wallets.key_path. Get/Has/Delete then did raw os.ReadFile on the stored path, ignoring ks.dir. DB was non-portable across hosts with different keystore roots.

  • Put now returns the basename; Get/Has/Delete resolve against ks.dir
  • validateName rejects separators/./.. so legacy absolute paths error out loudly
  • KeyInfo.Path -> KeyInfo.Name

No compat shim. Existing deployments need UPDATE wallets SET key_path = address;.

parkan added 2 commits April 14, 2026 18:16
KeyStore.Put previously returned an absolute filesystem path which got
written verbatim into wallets.key_path. Get/Has/Delete then did raw
os.ReadFile/os.Stat on that stored path, ignoring ks.dir entirely. This
made the DB non-portable -- a wallet imported on one host could not be
loaded on another host with a different keystore root, even when the key
file itself had been copied over.

Put now returns just the basename (the address), and Get/Has/Delete
resolve it against ks.dir. A validateName guard rejects separators and
. / .. so a DB with legacy absolute paths surfaces as a clear error
rather than a silent path-escape. KeyInfo.Path renamed to .Name.

Callers updated; no compat shim -- any deployment that already ran
export-keys needs a one-shot UPDATE wallets SET key_path = address.
@parkan parkan merged commit 25407a0 into main Apr 14, 2026
1 check passed
@parkan parkan deleted the fix/keystore-relative-paths branch April 14, 2026 16:49
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