mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
remove % from forbidden characters in git URLs
This commit is contained in:
parent
ac1d98f603
commit
7b6bc41d5b
1 changed files with 8 additions and 2 deletions
|
|
@ -31,7 +31,7 @@ class ValidGitRepositoryUrl implements ValidationRule
|
|||
$dangerousChars = [
|
||||
';', '|', '&', '$', '`', '(', ')', '{', '}',
|
||||
'[', ']', '<', '>', '\n', '\r', '\0', '"', "'",
|
||||
'\\', '!', '?', '*', '^', '%', '=', '+',
|
||||
'\\', '!', '?', '*', '^', '=', '+',
|
||||
'#', // Comment character that could hide commands
|
||||
];
|
||||
|
||||
|
|
@ -85,11 +85,17 @@ class ValidGitRepositoryUrl implements ValidationRule
|
|||
}
|
||||
|
||||
// Validate SSH URL format (git@host:user/repo.git)
|
||||
if (! preg_match('/^git@[a-zA-Z0-9\.\-]+:[a-zA-Z0-9\-_\/\.~]+$/', $value)) {
|
||||
if (! preg_match('/^git@[a-zA-Z0-9\.\-]+:[a-zA-Z0-9\-_\/\.~%]+$/', $value)) {
|
||||
$fail('The :attribute is not a valid SSH repository URL.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure any percent signs are valid percent-encodings like %20
|
||||
if (! empty($path) && preg_match('/%(?![0-9A-Fa-f]{2})/', $path)) {
|
||||
$fail('The :attribute path contains invalid percent encoding.');
|
||||
return;
|
||||
}
|
||||
} elseif (str_starts_with($value, 'http://') || str_starts_with($value, 'https://')) {
|
||||
// Validate HTTP(S) URL
|
||||
if (! filter_var($value, FILTER_VALIDATE_URL)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue