Skip to content

Commit 22278fe

Browse files
authored
Merge branch 'main' into bugfix/svg_side_by_side_comparison
2 parents 8a0fef1 + c1110b8 commit 22278fe

File tree

23 files changed

+517
-162
lines changed

23 files changed

+517
-162
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ require (
8282
github.com/mattn/go-runewidth v0.0.13 // indirect
8383
github.com/mattn/go-sqlite3 v1.14.8
8484
github.com/mholt/archiver/v3 v3.5.0
85-
github.com/microcosm-cc/bluemonday v1.0.15
85+
github.com/microcosm-cc/bluemonday v1.0.16
8686
github.com/miekg/dns v1.1.43 // indirect
8787
github.com/minio/md5-simd v1.1.2 // indirect
8888
github.com/minio/minio-go/v7 v7.0.12

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@ github.com/mholt/acmez v0.1.3 h1:J7MmNIk4Qf9b8mAGqAh4XkNeowv3f1zW816yf4zt7Qk=
869869
github.com/mholt/acmez v0.1.3/go.mod h1:8qnn8QA/Ewx8E3ZSsmscqsIjhhpxuy9vqdgbX2ceceM=
870870
github.com/mholt/archiver/v3 v3.5.0 h1:nE8gZIrw66cu4osS/U7UW7YDuGMHssxKutU8IfWxwWE=
871871
github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc=
872-
github.com/microcosm-cc/bluemonday v1.0.15 h1:J4uN+qPng9rvkBZBoBb8YGR+ijuklIMpSOZZLjYpbeY=
873-
github.com/microcosm-cc/bluemonday v1.0.15/go.mod h1:ZLvAzeakRwrGnzQEvstVzVt3ZpqOF2+sdFr0Om+ce30=
872+
github.com/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc=
873+
github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM=
874874
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
875875
github.com/miekg/dns v1.1.42/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4=
876876
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=

modules/csv/csv.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ func CreateReaderAndGuessDelimiter(rd io.Reader) (*stdcsv.Reader, error) {
3131
var data = make([]byte, 1e4)
3232
size, err := rd.Read(data)
3333
if err != nil {
34+
if err == io.EOF {
35+
return CreateReader(bytes.NewReader([]byte{}), rune(',')), nil
36+
}
3437
return nil, err
3538
}
3639

modules/ssh/ssh.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,66 @@ func Listen(host string, port int, ciphers []string, keyExchanges []string, macs
316316
}
317317
}
318318

319+
// Workaround slightly broken behaviour in x/crypto/ssh/handshake.go:458-463
320+
//
321+
// Fundamentally the issue here is that HostKeyAlgos make the incorrect assumption
322+
// that the PublicKey().Type() matches the signature algorithm.
323+
//
324+
// Therefore we need to add duplicates for the RSA with different signing algorithms.
325+
signers := make([]ssh.Signer, 0, len(srv.HostSigners))
326+
for _, signer := range srv.HostSigners {
327+
if signer.PublicKey().Type() == "ssh-rsa" {
328+
signers = append(signers,
329+
&wrapSigner{
330+
Signer: signer,
331+
algorithm: gossh.SigAlgoRSASHA2512,
332+
},
333+
&wrapSigner{
334+
Signer: signer,
335+
algorithm: gossh.SigAlgoRSASHA2256,
336+
},
337+
)
338+
}
339+
signers = append(signers, signer)
340+
}
341+
srv.HostSigners = signers
342+
319343
go listen(&srv)
320344

321345
}
322346

347+
// wrapSigner wraps a signer and overrides its public key type with the provided algorithm
348+
type wrapSigner struct {
349+
ssh.Signer
350+
algorithm string
351+
}
352+
353+
// PublicKey returns an associated PublicKey instance.
354+
func (s *wrapSigner) PublicKey() gossh.PublicKey {
355+
return &wrapPublicKey{
356+
PublicKey: s.Signer.PublicKey(),
357+
algorithm: s.algorithm,
358+
}
359+
}
360+
361+
// Sign returns raw signature for the given data. This method
362+
// will apply the hash specified for the keytype to the data using
363+
// the algorithm assigned for this key
364+
func (s *wrapSigner) Sign(rand io.Reader, data []byte) (*gossh.Signature, error) {
365+
return s.Signer.(gossh.AlgorithmSigner).SignWithAlgorithm(rand, data, s.algorithm)
366+
}
367+
368+
// wrapPublicKey wraps a PublicKey and overrides its type
369+
type wrapPublicKey struct {
370+
gossh.PublicKey
371+
algorithm string
372+
}
373+
374+
// Type returns the algorithm
375+
func (k *wrapPublicKey) Type() string {
376+
return k.algorithm
377+
}
378+
323379
// GenKeyPair make a pair of public and private keys for SSH access.
324380
// Public key is encoded in the format for inclusion in an OpenSSH authorized_keys file.
325381
// Private Key generated is PEM encoded

routers/private/serv.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,12 @@ func ServCommand(ctx *context.PrivateContext) {
279279
}
280280

281281
// Permissions checking:
282-
if repoExist && (mode > models.AccessModeRead || repo.IsPrivate || setting.Service.RequireSignInView) {
282+
if repoExist &&
283+
(mode > models.AccessModeRead ||
284+
repo.IsPrivate ||
285+
owner.Visibility.IsPrivate() ||
286+
user.IsRestricted ||
287+
setting.Service.RequireSignInView) {
283288
if key.Type == models.KeyTypeDeploy {
284289
if deployKey.Mode < mode {
285290
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
@@ -289,7 +294,7 @@ func ServCommand(ctx *context.PrivateContext) {
289294
return
290295
}
291296
} else {
292-
// Because of special ref "refs/for" .. , need delay write permission check
297+
// Because of the special ref "refs/for" we will need to delay write permission check
293298
if git.SupportProcReceive && unitType == models.UnitTypeCode {
294299
mode = models.AccessModeRead
295300
}

0 commit comments

Comments
 (0)