mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-05 19:30:58 +00:00
[v11.0/forgejo] fix: don't allow credentials in migrate/push mirror URL (#9065)
**Backport: https://codeberg.org/forgejo/forgejo/pulls/9064** It is no longer possible to specify the user and password when providing a URL for migrating a repository, the fields dedicated to that purpose on the form must be used instead. This is to prevent that those credentials are displayed in the repository settings that are visible by the repository admins, in the case where the migration is a mirror. Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu> Co-authored-by: Gusted <postmaster@gusted.xyz> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9065 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
a040ef4b0d
commit
79e5e20bea
12 changed files with 171 additions and 1 deletions
|
@ -121,6 +121,7 @@ type ErrInvalidCloneAddr struct {
|
|||
IsInvalidPath bool
|
||||
IsProtocolInvalid bool
|
||||
IsPermissionDenied bool
|
||||
HasCredentials bool
|
||||
LocalPath bool
|
||||
}
|
||||
|
||||
|
@ -143,6 +144,9 @@ func (err *ErrInvalidCloneAddr) Error() string {
|
|||
if err.IsURLError {
|
||||
return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided url is invalid", err.Host)
|
||||
}
|
||||
if err.HasCredentials {
|
||||
return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided url contains credentials", err.Host)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("migration/cloning from '%s' is not allowed", err.Host)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue