forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
* upstream/main: Add popup to hashed comments/pull requests/issues in file editing/adding preview tab (go-gitea#24040) Use reactive store to share data between components (go-gitea#23996) [skip ci] Updated translations via Crowdin Fix accidental overwriting of LDAP team memberships (go-gitea#24050) Add cardtype to org/user level project on creation, edit and view (go-gitea#24043) Fix branch protection priority (go-gitea#24045) Update documentation to explain which projects allow Gitea to host static pages (go-gitea#23993) Fix date display bug (go-gitea#24047) Fine tune markdown editor toolbar (go-gitea#24046) Add tooltips for MD editor buttons and add `muted` class for buttons (go-gitea#23896) Prefer native parser for SSH public key parsing (go-gitea#23798)
- Loading branch information
Showing
56 changed files
with
343 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,7 +345,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a | |
- `SSH_SERVER_MACS`: **[email protected], hmac-sha2-256, hmac-sha1**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect | ||
- `SSH_SERVER_HOST_KEYS`: **ssh/gitea.rsa, ssh/gogs.rsa**: For the built-in SSH server, choose the keypairs to offer as the host key. The private key should be at `SSH_SERVER_HOST_KEY` and the public `SSH_SERVER_HOST_KEY.pub`. Relative paths are made absolute relative to the `APP_DATA_PATH`. If no key exists a 4096 bit RSA key will be created for you. | ||
- `SSH_KEY_TEST_PATH`: **/tmp**: Directory to create temporary files in when testing public keys using ssh-keygen, default is the system temporary directory. | ||
- `SSH_KEYGEN_PATH`: **ssh-keygen**: Path to ssh-keygen, default is 'ssh-keygen' which means the shell is responsible for finding out which one to call. | ||
- `SSH_KEYGEN_PATH`: **\<empty\>**: Use `ssh-keygen` to parse public SSH keys. The value is passed to the shell. By default, Gitea does the parsing itself. | ||
- `SSH_EXPOSE_ANONYMOUS`: **false**: Enable exposure of SSH clone URL to anonymous visitors, default is false. | ||
- `SSH_PER_WRITE_TIMEOUT`: **30s**: Timeout for any write to the SSH connections. (Set to | ||
-1 to disable all timeouts.) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package git | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestBranchRuleMatchPriority(t *testing.T) { | ||
kases := []struct { | ||
Rules []string | ||
BranchName string | ||
ExpectedMatchIdx int | ||
}{ | ||
{ | ||
Rules: []string{"release/*", "release/v1.17"}, | ||
BranchName: "release/v1.17", | ||
ExpectedMatchIdx: 1, | ||
}, | ||
{ | ||
Rules: []string{"release/v1.17", "release/*"}, | ||
BranchName: "release/v1.17", | ||
ExpectedMatchIdx: 0, | ||
}, | ||
{ | ||
Rules: []string{"release/**/v1.17", "release/test/v1.17"}, | ||
BranchName: "release/test/v1.17", | ||
ExpectedMatchIdx: 1, | ||
}, | ||
{ | ||
Rules: []string{"release/test/v1.17", "release/**/v1.17"}, | ||
BranchName: "release/test/v1.17", | ||
ExpectedMatchIdx: 0, | ||
}, | ||
{ | ||
Rules: []string{"release/**", "release/v1.0.0"}, | ||
BranchName: "release/v1.0.0", | ||
ExpectedMatchIdx: 1, | ||
}, | ||
{ | ||
Rules: []string{"release/v1.0.0", "release/**"}, | ||
BranchName: "release/v1.0.0", | ||
ExpectedMatchIdx: 0, | ||
}, | ||
{ | ||
Rules: []string{"release/**", "release/v1.0.0"}, | ||
BranchName: "release/v2.0.0", | ||
ExpectedMatchIdx: 0, | ||
}, | ||
{ | ||
Rules: []string{"release/*", "release/v1.0.0"}, | ||
BranchName: "release/1/v2.0.0", | ||
ExpectedMatchIdx: -1, | ||
}, | ||
} | ||
|
||
for _, kase := range kases { | ||
var pbs ProtectedBranchRules | ||
for _, rule := range kase.Rules { | ||
pbs = append(pbs, &ProtectedBranch{RuleName: rule}) | ||
} | ||
pbs.sort() | ||
matchedPB := pbs.GetFirstMatched(kase.BranchName) | ||
if matchedPB == nil { | ||
if kase.ExpectedMatchIdx >= 0 { | ||
assert.Error(t, fmt.Errorf("no matched rules but expected %s[%d]", kase.Rules[kase.ExpectedMatchIdx], kase.ExpectedMatchIdx)) | ||
} | ||
} else { | ||
assert.EqualValues(t, kase.Rules[kase.ExpectedMatchIdx], matchedPB.RuleName) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ var SSH = struct { | |
ServerCiphers: []string{"[email protected]", "aes128-ctr", "aes192-ctr", "aes256-ctr", "[email protected]", "[email protected]"}, | ||
ServerKeyExchanges: []string{"curve25519-sha256", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group14-sha256", "diffie-hellman-group14-sha1"}, | ||
ServerMACs: []string{"[email protected]", "hmac-sha2-256", "hmac-sha1"}, | ||
KeygenPath: "ssh-keygen", | ||
KeygenPath: "", | ||
MinimumKeySizeCheck: true, | ||
MinimumKeySizes: map[string]int{"ed25519": 256, "ed25519-sk": 256, "ecdsa": 256, "ecdsa-sk": 256, "rsa": 2047}, | ||
ServerHostKeys: []string{"ssh/gitea.rsa", "ssh/gogs.rsa"}, | ||
|
@@ -134,7 +134,7 @@ func loadSSHFrom(rootCfg ConfigProvider) { | |
} | ||
} | ||
|
||
SSH.KeygenPath = sec.Key("SSH_KEYGEN_PATH").MustString("ssh-keygen") | ||
SSH.KeygenPath = sec.Key("SSH_KEYGEN_PATH").String() | ||
SSH.Port = sec.Key("SSH_PORT").MustInt(22) | ||
SSH.ListenPort = sec.Key("SSH_LISTEN_PORT").MustInt(SSH.Port) | ||
SSH.UseProxyProtocol = sec.Key("SSH_SERVER_USE_PROXY_PROTOCOL").MustBool(false) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.