Skip to content

Commit fd0deb9

Browse files
committed
Allow paths to contain *
From theupdateframework#377, the [TUF spec] allows for paths to contain `*`. According to @lukesteensen, this is routinely used in delegations. Note though this does not attempt to implement delegation path globs. That will be implemented in theupdateframework#388. [TUF spec]: https://theupdateframework.github.io/specification/latest/#targetpath
1 parent fdc11e6 commit fd0deb9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tuf/src/metadata.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static PATH_ILLEGAL_STRINGS: &[&str] = &[
6666
"\"",
6767
"|",
6868
"?",
69-
"*",
7069
// control characters, all illegal in FAT
7170
"\u{000}",
7271
"\u{001}",
@@ -2314,6 +2313,23 @@ mod test {
23142313
}
23152314
}
23162315

2316+
#[test]
2317+
fn allow_asterisk_in_target_path() {
2318+
let good_paths = &[
2319+
"*",
2320+
"*/some/path",
2321+
"*/some/path/",
2322+
"some/*/path",
2323+
"some/*/path/*",
2324+
];
2325+
2326+
for path in good_paths.iter() {
2327+
assert!(safe_path(path).is_ok());
2328+
assert!(TargetPath::new(path.to_string()).is_ok());
2329+
assert!(MetadataPath::new(path.to_string()).is_ok());
2330+
}
2331+
}
2332+
23172333
#[test]
23182334
fn path_matches_chain() {
23192335
let test_cases: &[(bool, &str, &[&[&str]])] = &[

0 commit comments

Comments
 (0)