wallet: Wallet name validation does not reject filesystem-invalid/reserved/directory characters #35907

issue vicjuma opened this issue on August 5, 2026
  1. vicjuma commented at 7:38 PM on August 5, 2026: contributor

    Problem

    Wallet names that eventually may act as directory names have a somewhat lenient validation ("", "..", "./"). This may seem to be a minor issue, arguably, cause it somehow works out, but it may probably lead to inconsistencies (loosely speaking) when a reserved character is mistakenly used. It may really help to add a pattern check against reserved/invalid directory names when creating a wallet just to prevent such situations. I created a PR for only a single pattern #35768 (all spaces). But seems there are more such patterns currently being accepted.

    Demonstrations

    Nested wallets

    These are wallet names that contain a /

    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ ./bitcoin-cli createwallet "tests/wallets/wallet1"
    {
      "name": "tests/wallets/wallet1"
    }
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ tree ~/.bitcoin/regtest/wallets/
    /home/ratedg/.bitcoin/regtest/wallets/
    └── tests
        └── wallets
            └── wallet1
                ├── wallet.dat
                └── wallet.dat-journal
    
    4 directories, 2 files
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$
    

    Empty wallet names

    These are wallets with no other characters but spaces

    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ ./bitcoin-cli createwallet " " &&  ./bitcoin-cli createwallet "  " && ./bitcoin-cli createwallet "   "
    {
      "name": " "
    }
    {
      "name": "  "
    }
    {
      "name": "   "
    }
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ tree ~/.bitcoin/regtest/wallets/
    /home/ratedg/.bitcoin/regtest/wallets/
    ├──  
    │   ├── wallet.dat
    │   └── wallet.dat-journal
    ├──   
    │   ├── wallet.dat
    │   └── wallet.dat-journal
    └──    
        ├── wallet.dat
        └── wallet.dat-journal
    
    4 directories, 6 files
    

    UI display

    <img width="877" height="278" alt="Image" src="https://github.com/user-attachments/assets/ad2c1220-c9e3-4500-9194-05b89b339517" />

    Hidden folder names

    These are wallet names beginning with a .

    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ ./bitcoin-cli createwallet ".testwallet"
    {
      "name": ".testwallet"
    }
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ tree ~/.bitcoin/regtest/wallets/
    /home/ratedg/.bitcoin/regtest/wallets/
    
    0 directories, 0 files
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ tree -a ~/.bitcoin/regtest/wallets/
    /home/ratedg/.bitcoin/regtest/wallets/
    └── .testwallet
        ├── wallet.dat
        └── wallet.dat-journal
    
    2 directories, 2 files
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ 
    

    Windows path separator

    These are wallet names that contain a \

    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ ./bitcoin-cli createwallet "\\\\"
    {
      "name": "\\\\"
    }
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$ tree ~/.bitcoin/regtest/wallets/
    /home/ratedg/.bitcoin/regtest/wallets/
    └── \\
        ├── wallet.dat
        └── wallet.dat-journal
    
    2 directories, 2 files
    ratedg@0xratedg:~/projects/contributions/bitcoin/build/bin$
    

    Probably this change may not be urgent, but it might be necessary

    Proposed solution

    Validate wallet names against an agreed pattern. Following maflcko's comment, only the create path should be validated for now.

    Conclusion

    If this is expected behavior or not considered worth addressing, please feel free to close this issue. I wanted to raise the observation in case it is useful or was previously overlooked.

  2. willcl-ark added the label Wallet on Aug 13, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-14 18:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me