Skip to content

Commit

Permalink
commit cloud: forbid sharing for workspaces with non-ascii characters
Browse files Browse the repository at this point in the history
Summary: Nonascii characters don't play well with ACL names, so let's do that validation before attempting to create an ACL in the first place

Reviewed By: muirdm

Differential Revision: D68024940

fbshipit-source-id: 25f544b4316a2e4f09f3f8f203958355bedb3540
  • Loading branch information
lmvasquezg authored and facebook-github-bot committed Jan 13, 2025
1 parent d7fcd0a commit bb38a71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eden/mononoke/commit_cloud/helpers/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn decorate_workspace_name_to_valid_acl_name(name: &str) -> String {
workspace_decorated = workspace_decorated
.chars()
.map(|c| {
if c.is_alphanumeric() || allowed_punctuation.contains(&c) {
if c.is_ascii_alphanumeric() || allowed_punctuation.contains(&c) {
c
} else {
'_'
Expand Down Expand Up @@ -133,5 +133,9 @@ mod test {
),
"user/testuser_oculus.com/other_name_with_spaces"
);
assert_eq!(
decorate_workspace_name_to_valid_acl_name("user/testuser/秘密项目"),
"user/testuser/____"
);
}
}

0 comments on commit bb38a71

Please sign in to comment.