Commit Graph

8 Commits (dcc6c1956ac7d6d5cf4781cb00a1055dee47d599)

Author SHA1 Message Date
Ferdinand Thiessen 35a27b5fd5
fix(FilenameValidator): use `_` as default replacement for invalid chars
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-06-18 09:44:57 +07:00
Ferdinand Thiessen 6cf1870322
feat(FilenameValidator): allow to sanitize filenames
Share the filename sanitizing with the OCP filename validator.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-13 14:14:17 +07:00
Ferdinand Thiessen 254dd85664
fix(IFilenameValidator): correctly handle case insensitivity
- forbidden names and forbidden base names are case **insensitive**
  so we need to check all lowercase here.
- add test that config value is also read case insensitive.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-03-21 01:00:58 +07:00
Ferdinand Thiessen 17f011f7c5 fix: Also validate parent path in `verifyPath`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-28 17:22:20 +07:00
Ferdinand Thiessen b9cc7bcec7
fix: `FilenameValidator::isForbidden` should only check forbidden files
And not forbidden basenames as this is used for different purposes.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-21 04:16:14 +07:00
Ferdinand Thiessen 69341e4306
refactor: Migrate filename validation logic from `Storage` to `FilenameValidator`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-07-16 12:49:09 +07:00
Ferdinand Thiessen bdbeabafa7
feat: Add `forbidden_filename_basenames` config option
This allows to configure forbidden filenames (the full filename like `.htaccess`)
and also forbidden basenames like `com0` where `com0`, `com0.txt` and `com0.tar.gz` will match.
We need this as only using basenames was too restrictive and will cause problems on some systems when updating.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-07-15 19:39:18 +07:00
Ferdinand Thiessen 46f1efac41
feat: Add `IFilenameValidator` to have one consistent place for filename validation
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-07-09 15:04:34 +07:00