• Steven Allen's avatar
    fix: be explicit about key limitations · 4ca877d4
    Steven Allen authored
    Only allow keys of the form `/[0-9A-Z+-_=]`. That is, upper-case alphanumeric
    keys in the root namespace (plus some special characters).
    
    Why? We don't encode keys before writing them to the filesystem. This change
    ensures that:
    
    1. Case sensitivity doesn't matter because we only allow upper-case keys.
    2. Path separators and special characters doesn't matter.
    
    For context, go-ipfs only uses flatfs for storing blocks. Every block CID is
    encoded as uppercase alphanumeric text (specifically, uppercase base32).
    
    We could be less restrictive, but this is safer and easier to understand.
    Unfortunately, we _can't_ allow mixed case (Windows) and can't allow lowercase
    because we're already using uppercase keys.
    
    fixes #23
    4ca877d4
flatfs_test.go 24.5 KB