Skip to content

cmd/fscrypt: accept non-ASCII mountpoints in MOUNTPOINT:ID flags - #460

Open
rootkiller6788 wants to merge 1 commit into
google:masterfrom
rootkiller6788:fix-metadata-flag-unicode-mountpoint
Open

cmd/fscrypt: accept non-ASCII mountpoints in MOUNTPOINT:ID flags#460
rootkiller6788 wants to merge 1 commit into
google:masterfrom
rootkiller6788:fix-metadata-flag-unicode-mountpoint

Conversation

@rootkiller6788

Copy link
Copy Markdown

Fixes #446.

The MOUNTPOINT:ID flag regex (idFlagRegex in cmd/fscrypt/flags.go) matched the mountpoint with [[:print:]], which in Go's regexp is ASCII-only. As a result, flags such as --protector=/mnt/miroir-données:... or --policy=/mnt/naïve:... were rejected with "does not have format MOUNTPOINT:ID", even though setup accepts the same mountpoint as a positional argument.

This change matches the mountpoint with [^\p{Cc}] (any non-control Unicode character), which is a strict superset of the old ASCII printable set. The descriptor group is unchanged ([[:alnum:]]+), and malformed values (missing separator, empty descriptor, control characters) are still rejected.

Verified locally on Linux: go build ./..., go test ./... (all packages pass), go vet, staticcheck, and gofmt/goimports are clean.

The idFlagRegex only allowed ASCII printable characters in the mountpoint
portion, so flags like --protector=/mnt/miroir-données:d77aa788ff9d1931
were rejected even though the filesystem path is valid. Use a character
class that accepts any non-control Unicode character instead.

Fixes google#446
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.

support accents in mountpoint add-protector-to-policy subcommand

1 participant