Disallow refs starting with a non-letter or digit
Change the regexp for validating refs to require at least one letter or digit
before allowing the other special chars in the set `[.-_]`. Names that start
with `.` are traditionally Unix hidden files; let's ignore them under the
assumption they're metadata for some other tool, and we don't want to
potentially conflict with the special `.` and `..` Unix directory entries.
Further, names starting with `-` are problematic for Unix cmdline option
processing; there's no good reason to support that. Finally, disallow `_` just
on general principle - it's simpler to say that ref identifiers must start with
a letter or digit.
We also ignore any existing files (that might be previously created refs) that
start with `.` in the `refs/` directory - there's a Red Hat tool for content
management that injects `.rsync` files, which is why this patch was first
written.
V1: Update to ban all refs starting with a non-letter/digit, and
also add another call to `ostree_validate_rev` in the pull
code.
Closes: https://github.com/ostreedev/ostree/issues/1285
Closes: #1286
Approved by: jlebon
This commit is contained in:
1 parent
3f3d3d64ac
commit
e466e482b1
5 files changed
+69
-2
No files matched your search
@@ -128,6 +128,11 @@ static inline char * _ostree_get_commitpartial_path (const char *checksum)
|
||||
return g_strconcat ("state/", checksum, ".commitpartial", NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_validate_ref_fragment (const char *fragment,
|
||||
GError **error);
|
||||
|
||||
|
||||
gboolean
|
||||
_ostree_validate_bareuseronly_mode (guint32 mode,
|
||||
const char *checksum,
|
||||
|
||||
Reference in new issue
Block a user