@ttsc/darwin-arm64 0.7.2 → 0.8.0-dev.20260505

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/bin/go/VERSION +2 -2
  2. package/bin/go/bin/go +0 -0
  3. package/bin/go/bin/gofmt +0 -0
  4. package/bin/go/pkg/tool/darwin_arm64/asm +0 -0
  5. package/bin/go/pkg/tool/darwin_arm64/cgo +0 -0
  6. package/bin/go/pkg/tool/darwin_arm64/compile +0 -0
  7. package/bin/go/pkg/tool/darwin_arm64/cover +0 -0
  8. package/bin/go/pkg/tool/darwin_arm64/fix +0 -0
  9. package/bin/go/pkg/tool/darwin_arm64/link +0 -0
  10. package/bin/go/pkg/tool/darwin_arm64/preprofile +0 -0
  11. package/bin/go/pkg/tool/darwin_arm64/vet +0 -0
  12. package/bin/go/src/archive/tar/format.go +6 -0
  13. package/bin/go/src/archive/tar/reader.go +24 -4
  14. package/bin/go/src/builtin/builtin.go +13 -4
  15. package/bin/go/src/crypto/tls/conn.go +7 -3
  16. package/bin/go/src/crypto/tls/handshake_client_tls13.go +2 -2
  17. package/bin/go/src/crypto/tls/handshake_server_tls13.go +2 -2
  18. package/bin/go/src/crypto/x509/constraints.go +33 -33
  19. package/bin/go/src/crypto/x509/verify.go +28 -13
  20. package/bin/go/src/html/template/attr_string.go +3 -2
  21. package/bin/go/src/html/template/context.go +21 -1
  22. package/bin/go/src/html/template/element_string.go +3 -2
  23. package/bin/go/src/html/template/escape.go +16 -2
  24. package/bin/go/src/html/template/state_string.go +5 -3
  25. package/bin/go/src/html/template/transition.go +41 -6
  26. package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
  27. package/bin/go/src/internal/godebugs/table.go +1 -0
  28. package/bin/go/src/internal/poll/fd_windows.go +64 -38
  29. package/bin/go/src/internal/poll/fstatat_unix.go +22 -0
  30. package/bin/go/src/internal/poll/sendfile_windows.go +3 -1
  31. package/bin/go/src/internal/syscall/unix/at.go +0 -17
  32. package/bin/go/src/internal/syscall/unix/at_sysnum_linux.go +2 -1
  33. package/bin/go/src/internal/syscall/unix/fchmodat_linux.go +51 -0
  34. package/bin/go/src/internal/syscall/unix/fchmodat_other.go +29 -0
  35. package/bin/go/src/internal/syscall/windows/at_windows.go +20 -3
  36. package/bin/go/src/internal/syscall/windows/syscall_windows.go +4 -0
  37. package/bin/go/src/internal/syscall/windows/types_windows.go +82 -0
  38. package/bin/go/src/internal/syscall/windows/zsyscall_windows.go +27 -0
  39. package/bin/go/src/net/http/doc.go +0 -1
  40. package/bin/go/src/net/sendfile.go +2 -0
  41. package/bin/go/src/net/sendfile_stub.go +2 -0
  42. package/bin/go/src/net/sendfile_windows.go +3 -0
  43. package/bin/go/src/net/url/url.go +21 -16
  44. package/bin/go/src/os/dir_darwin.go +2 -2
  45. package/bin/go/src/os/dir_unix.go +2 -2
  46. package/bin/go/src/os/file.go +0 -3
  47. package/bin/go/src/os/file_unix.go +9 -5
  48. package/bin/go/src/os/root_unix.go +1 -0
  49. package/bin/go/src/os/stat.go +3 -0
  50. package/bin/go/src/os/statat.go +24 -0
  51. package/bin/go/src/os/statat_other.go +12 -0
  52. package/bin/go/src/os/statat_unix.go +20 -0
  53. package/bin/go/src/reflect/value.go +3 -2
  54. package/bin/go/src/runtime/defs_linux_mips64x.go +1 -1
  55. package/bin/go/src/runtime/defs_linux_mipsx.go +1 -1
  56. package/bin/go/src/runtime/metrics/doc.go +5 -0
  57. package/bin/go/src/runtime/print.go +16 -4
  58. package/bin/go/src/runtime/race/README +9 -9
  59. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.patch +63 -0
  60. package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.syso +0 -0
  61. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.patch +63 -0
  62. package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.syso +0 -0
  63. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.patch +63 -0
  64. package/bin/go/src/runtime/race/internal/amd64v1/race_linux.syso +0 -0
  65. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.patch +63 -0
  66. package/bin/go/src/runtime/race/internal/amd64v1/race_windows.syso +0 -0
  67. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.patch +63 -0
  68. package/bin/go/src/runtime/race/internal/amd64v3/race_linux.syso +0 -0
  69. package/bin/go/src/runtime/race/race_darwin_arm64.patch +63 -0
  70. package/bin/go/src/runtime/race/race_darwin_arm64.syso +0 -0
  71. package/bin/go/src/runtime/race/race_linux_arm64.patch +63 -0
  72. package/bin/go/src/runtime/race/race_linux_arm64.syso +0 -0
  73. package/bin/go/src/runtime/race/race_linux_loong64.patch +63 -0
  74. package/bin/go/src/runtime/race/race_linux_loong64.syso +0 -0
  75. package/bin/go/src/runtime/race/race_linux_s390x.patch +63 -0
  76. package/bin/go/src/runtime/race/race_linux_s390x.syso +0 -0
  77. package/bin/ttsc +0 -0
  78. package/package.json +1 -1
package/bin/go/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- go1.26.0
2
- time 2026-02-10T01:22:00Z
1
+ go1.26.2
2
+ time 2026-03-27T21:58:29Z
package/bin/go/bin/go CHANGED
Binary file
package/bin/go/bin/gofmt CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -147,6 +147,12 @@ const (
147
147
  // Max length of a special file (PAX header, GNU long name or link).
148
148
  // This matches the limit used by libarchive.
149
149
  maxSpecialFileSize = 1 << 20
150
+
151
+ // Maximum number of sparse file entries.
152
+ // We should never actually hit this limit
153
+ // (every sparse encoding will first be limited by maxSpecialFileSize),
154
+ // but this adds an additional layer of defense.
155
+ maxSparseFileEntries = 1 << 20
150
156
  )
151
157
 
152
158
  // blockPadding computes the number of bytes needed to pad offset up to the
@@ -490,7 +490,8 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
490
490
  }
491
491
  s := blk.toGNU().sparse()
492
492
  spd := make(sparseDatas, 0, s.maxEntries())
493
- for {
493
+ totalSize := len(s)
494
+ for totalSize < maxSpecialFileSize {
494
495
  for i := 0; i < s.maxEntries(); i++ {
495
496
  // This termination condition is identical to GNU and BSD tar.
496
497
  if s.entry(i).offset()[0] == 0x00 {
@@ -501,7 +502,11 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
501
502
  if p.err != nil {
502
503
  return nil, p.err
503
504
  }
504
- spd = append(spd, sparseEntry{Offset: offset, Length: length})
505
+ var err error
506
+ spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
507
+ if err != nil {
508
+ return nil, err
509
+ }
505
510
  }
506
511
 
507
512
  if s.isExtended()[0] > 0 {
@@ -510,10 +515,12 @@ func (tr *Reader) readOldGNUSparseMap(hdr *Header, blk *block) (sparseDatas, err
510
515
  return nil, err
511
516
  }
512
517
  s = blk.toSparse()
518
+ totalSize += len(s)
513
519
  continue
514
520
  }
515
521
  return spd, nil // Done
516
522
  }
523
+ return nil, errSparseTooLong
517
524
  }
518
525
 
519
526
  // readGNUSparseMap1x0 reads the sparse map as stored in GNU's PAX sparse format
@@ -586,7 +593,10 @@ func readGNUSparseMap1x0(r io.Reader) (sparseDatas, error) {
586
593
  if err1 != nil || err2 != nil {
587
594
  return nil, ErrHeader
588
595
  }
589
- spd = append(spd, sparseEntry{Offset: offset, Length: length})
596
+ spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
597
+ if err != nil {
598
+ return nil, err
599
+ }
590
600
  }
591
601
  return spd, nil
592
602
  }
@@ -620,12 +630,22 @@ func readGNUSparseMap0x1(paxHdrs map[string]string) (sparseDatas, error) {
620
630
  if err1 != nil || err2 != nil {
621
631
  return nil, ErrHeader
622
632
  }
623
- spd = append(spd, sparseEntry{Offset: offset, Length: length})
633
+ spd, err = appendSparseEntry(spd, sparseEntry{Offset: offset, Length: length})
634
+ if err != nil {
635
+ return nil, err
636
+ }
624
637
  sparseMap = sparseMap[2:]
625
638
  }
626
639
  return spd, nil
627
640
  }
628
641
 
642
+ func appendSparseEntry(spd sparseDatas, ent sparseEntry) (sparseDatas, error) {
643
+ if len(spd) >= maxSparseFileEntries {
644
+ return nil, errSparseTooLong
645
+ }
646
+ return append(spd, ent), nil
647
+ }
648
+
629
649
  // Read reads from the current file in the tar archive.
630
650
  // It returns (0, io.EOF) when it reaches the end of that file,
631
651
  // until [Next] is called to advance to the next file.
@@ -122,6 +122,10 @@ type Type int
122
122
  // invocation.
123
123
  type Type1 int
124
124
 
125
+ // TypeOrExpr is here for the purposes of documentation only. It is a stand-in
126
+ // for either a Go type or an expression.
127
+ type TypeOrExpr int
128
+
125
129
  // IntegerType is here for the purposes of documentation only. It is a stand-in
126
130
  // for any integer type: int, uint, int8 etc.
127
131
  type IntegerType int
@@ -220,10 +224,15 @@ func max[T cmp.Ordered](x T, y ...T) T
220
224
  // min will return NaN.
221
225
  func min[T cmp.Ordered](x T, y ...T) T
222
226
 
223
- // The new built-in function allocates memory. The first argument is a type,
224
- // not a value, and the value returned is a pointer to a newly
225
- // allocated zero value of that type.
226
- func new(Type) *Type
227
+ // The built-in function new allocates a new, initialized variable and returns
228
+ // a pointer to it. It accepts a single argument, which may be either a type
229
+ // or an expression.
230
+ // If the argument is a type T, then new(T) allocates a variable of type T
231
+ // initialized to its zero value.
232
+ // Otherwise, the argument is an expression x and new(x) allocates a variable
233
+ // of the type of x initialized to the value of x. If that value is an untyped
234
+ // constant, it is first implicitly converted to its default type.
235
+ func new(TypeOrExpr) *Type
227
236
 
228
237
  // The complex built-in function constructs a complex value from two
229
238
  // floating-point values. The real and imaginary parts must be of the same
@@ -1363,7 +1363,7 @@ func (c *Conn) handleKeyUpdate(keyUpdate *keyUpdateMsg) error {
1363
1363
  }
1364
1364
 
1365
1365
  newSecret := cipherSuite.nextTrafficSecret(c.in.trafficSecret)
1366
- if err := c.setReadTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret); err != nil {
1366
+ if err := c.setReadTrafficSecret(cipherSuite, QUICEncryptionLevelInitial, newSecret, keyUpdate.updateRequested); err != nil {
1367
1367
  return err
1368
1368
  }
1369
1369
 
@@ -1683,12 +1683,16 @@ func (c *Conn) VerifyHostname(host string) error {
1683
1683
  // setReadTrafficSecret sets the read traffic secret for the given encryption level. If
1684
1684
  // being called at the same time as setWriteTrafficSecret, the caller must ensure the call
1685
1685
  // to setWriteTrafficSecret happens first so any alerts are sent at the write level.
1686
- func (c *Conn) setReadTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte) error {
1686
+ func (c *Conn) setReadTrafficSecret(suite *cipherSuiteTLS13, level QUICEncryptionLevel, secret []byte, locked bool) error {
1687
1687
  // Ensure that there are no buffered handshake messages before changing the
1688
1688
  // read keys, since that can cause messages to be parsed that were encrypted
1689
1689
  // using old keys which are no longer appropriate.
1690
1690
  if c.hand.Len() != 0 {
1691
- c.sendAlert(alertUnexpectedMessage)
1691
+ if locked {
1692
+ c.sendAlertLocked(alertUnexpectedMessage)
1693
+ } else {
1694
+ c.sendAlert(alertUnexpectedMessage)
1695
+ }
1692
1696
  return errors.New("tls: handshake buffer not empty before setting read traffic secret")
1693
1697
  }
1694
1698
  c.in.setTrafficSecret(suite, level, secret)
@@ -492,7 +492,7 @@ func (hs *clientHandshakeStateTLS13) establishHandshakeKeys() error {
492
492
  clientSecret := handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript)
493
493
  c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret)
494
494
  serverSecret := handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript)
495
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret); err != nil {
495
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret, false); err != nil {
496
496
  return err
497
497
  }
498
498
 
@@ -711,7 +711,7 @@ func (hs *clientHandshakeStateTLS13) readServerFinished() error {
711
711
 
712
712
  hs.trafficSecret = hs.masterSecret.ClientApplicationTrafficSecret(hs.transcript)
713
713
  serverSecret := hs.masterSecret.ServerApplicationTrafficSecret(hs.transcript)
714
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret); err != nil {
714
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, serverSecret, false); err != nil {
715
715
  return err
716
716
  }
717
717
 
@@ -752,7 +752,7 @@ func (hs *serverHandshakeStateTLS13) sendServerParameters() error {
752
752
  serverSecret := hs.handshakeSecret.ServerHandshakeTrafficSecret(hs.transcript)
753
753
  c.setWriteTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, serverSecret)
754
754
  clientSecret := hs.handshakeSecret.ClientHandshakeTrafficSecret(hs.transcript)
755
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret); err != nil {
755
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelHandshake, clientSecret, false); err != nil {
756
756
  return err
757
757
  }
758
758
 
@@ -1136,7 +1136,7 @@ func (hs *serverHandshakeStateTLS13) readClientFinished() error {
1136
1136
  return errors.New("tls: invalid client finished hash")
1137
1137
  }
1138
1138
 
1139
- if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret); err != nil {
1139
+ if err := c.setReadTrafficSecret(hs.suite, QUICEncryptionLevelApplication, hs.trafficSecret, false); err != nil {
1140
1140
  return err
1141
1141
  }
1142
1142
 
@@ -58,11 +58,11 @@ import (
58
58
  // of nameConstraintsSet, to handle constraints which define full email
59
59
  // addresses (i.e. 'test@example.com'). For bare domain constraints, we use the
60
60
  // dnsConstraints type described above, querying the domain portion of the email
61
- // address. For full email addresses, we also hold a map of email addresses that
62
- // map the local portion of the email to the domain. When querying full email
63
- // addresses we then check if the local portion of the email is present in the
64
- // map, and if so case insensitively compare the domain portion of the
65
- // email.
61
+ // address. For full email addresses, we also hold a map of email addresses with
62
+ // the domain portion of the email lowercased, since it is case insensitive. When
63
+ // looking up an email address in the constraint set, we first check the full
64
+ // email address map, and if we don't find anything, we check the domain portion
65
+ // of the email address against the dnsConstraints.
66
66
 
67
67
  type nameConstraintsSet[T *net.IPNet | string, V net.IP | string] struct {
68
68
  set []T
@@ -351,6 +351,7 @@ func newDNSConstraints(l []string, permitted bool) interface{ query(string) (str
351
351
  if !permitted {
352
352
  parentConstraints := map[string]string{}
353
353
  for _, name := range nc.constraints.set {
354
+ name = strings.ToLower(name)
354
355
  trimmedName := trimFirstLabel(name)
355
356
  if trimmedName == "" {
356
357
  continue
@@ -375,7 +376,8 @@ func (dnc *dnsConstraints) query(s string) (string, bool) {
375
376
  return constraint, true
376
377
  }
377
378
 
378
- if !dnc.permitted && s[0] == '*' {
379
+ if !dnc.permitted && len(s) > 0 && s[0] == '*' {
380
+ s = strings.ToLower(s)
379
381
  trimmed := trimFirstLabel(s)
380
382
  if constraint, found := dnc.parentConstraints[trimmed]; found {
381
383
  return constraint, true
@@ -387,16 +389,22 @@ func (dnc *dnsConstraints) query(s string) (string, bool) {
387
389
  type emailConstraints struct {
388
390
  dnsConstraints interface{ query(string) (string, bool) }
389
391
 
390
- fullEmails map[string]string
392
+ // fullEmails is map of rfc2821Mailboxs that are fully specified in the
393
+ // constraints, which we need to check for separately since they don't
394
+ // follow the same matching rules as the domain-based constraints. The
395
+ // domain portion of the rfc2821Mailbox has been lowercased, since the
396
+ // domain portion is case insensitive. When checking the map for an email,
397
+ // the domain portion of the query should also be lowercased.
398
+ fullEmails map[rfc2821Mailbox]struct{}
391
399
  }
392
400
 
393
401
  func newEmailConstraints(l []string, permitted bool) interface {
394
- query(parsedEmail) (string, bool)
402
+ query(rfc2821Mailbox) (string, bool)
395
403
  } {
396
404
  if len(l) == 0 {
397
405
  return nil
398
406
  }
399
- exactMap := map[string]string{}
407
+ exactMap := map[rfc2821Mailbox]struct{}{}
400
408
  var domains []string
401
409
  for _, c := range l {
402
410
  if !strings.ContainsRune(c, '@') {
@@ -411,7 +419,8 @@ func newEmailConstraints(l []string, permitted bool) interface {
411
419
  // certificate since parsing.
412
420
  continue
413
421
  }
414
- exactMap[parsed.local] = parsed.domain
422
+ parsed.domain = strings.ToLower(parsed.domain)
423
+ exactMap[parsed] = struct{}{}
415
424
  }
416
425
  ec := &emailConstraints{
417
426
  fullEmails: exactMap,
@@ -422,16 +431,16 @@ func newEmailConstraints(l []string, permitted bool) interface {
422
431
  return ec
423
432
  }
424
433
 
425
- func (ec *emailConstraints) query(s parsedEmail) (string, bool) {
426
- if len(ec.fullEmails) > 0 && strings.ContainsRune(s.email, '@') {
427
- if domain, ok := ec.fullEmails[s.mailbox.local]; ok && strings.EqualFold(domain, s.mailbox.domain) {
428
- return ec.fullEmails[s.email] + "@" + s.mailbox.domain, true
434
+ func (ec *emailConstraints) query(s rfc2821Mailbox) (string, bool) {
435
+ if len(ec.fullEmails) > 0 {
436
+ if _, ok := ec.fullEmails[s]; ok {
437
+ return fmt.Sprintf("%s@%s", s.local, s.domain), true
429
438
  }
430
439
  }
431
440
  if ec.dnsConstraints == nil {
432
441
  return "", false
433
442
  }
434
- constraint, found := ec.dnsConstraints.query(s.mailbox.domain)
443
+ constraint, found := ec.dnsConstraints.query(s.domain)
435
444
  return constraint, found
436
445
  }
437
446
 
@@ -441,7 +450,7 @@ type constraints[T any, V any] struct {
441
450
  excluded interface{ query(V) (T, bool) }
442
451
  }
443
452
 
444
- func checkConstraints[T string | *net.IPNet, V any, P string | net.IP | parsedURI | parsedEmail](c constraints[T, V], s V, p P) error {
453
+ func checkConstraints[T string | *net.IPNet, V any, P string | net.IP | parsedURI | rfc2821Mailbox](c constraints[T, V], s V, p P) error {
445
454
  if c.permitted != nil {
446
455
  if _, found := c.permitted.query(s); !found {
447
456
  return fmt.Errorf("%s %q is not permitted by any constraint", c.constraintType, p)
@@ -459,13 +468,13 @@ type chainConstraints struct {
459
468
  ip constraints[*net.IPNet, net.IP]
460
469
  dns constraints[string, string]
461
470
  uri constraints[string, string]
462
- email constraints[string, parsedEmail]
471
+ email constraints[string, rfc2821Mailbox]
463
472
 
464
473
  index int
465
474
  next *chainConstraints
466
475
  }
467
476
 
468
- func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []parsedEmail, ips []net.IP) error {
477
+ func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []rfc2821Mailbox, ips []net.IP) error {
469
478
  for _, ip := range ips {
470
479
  if err := checkConstraints(cc.ip, ip, ip); err != nil {
471
480
  return err
@@ -488,8 +497,8 @@ func (cc *chainConstraints) check(dns []string, uris []parsedURI, emails []parse
488
497
  }
489
498
  }
490
499
  for _, e := range emails {
491
- if !domainNameValid(e.mailbox.domain, false) {
492
- return fmt.Errorf("x509: cannot parse rfc822Name %q", e.mailbox)
500
+ if !domainNameValid(e.domain, false) {
501
+ return fmt.Errorf("x509: cannot parse rfc822Name %q", e)
493
502
  }
494
503
  if err := checkConstraints(cc.email, e, e); err != nil {
495
504
  return err
@@ -509,7 +518,7 @@ func checkChainConstraints(chain []*Certificate) error {
509
518
  ip: constraints[*net.IPNet, net.IP]{"IP address", newIPNetConstraints(c.PermittedIPRanges), newIPNetConstraints(c.ExcludedIPRanges)},
510
519
  dns: constraints[string, string]{"DNS name", newDNSConstraints(c.PermittedDNSDomains, true), newDNSConstraints(c.ExcludedDNSDomains, false)},
511
520
  uri: constraints[string, string]{"URI", newDNSConstraints(c.PermittedURIDomains, true), newDNSConstraints(c.ExcludedURIDomains, false)},
512
- email: constraints[string, parsedEmail]{"email address", newEmailConstraints(c.PermittedEmailAddresses, true), newEmailConstraints(c.ExcludedEmailAddresses, false)},
521
+ email: constraints[string, rfc2821Mailbox]{"email address", newEmailConstraints(c.PermittedEmailAddresses, true), newEmailConstraints(c.ExcludedEmailAddresses, false)},
513
522
  index: i,
514
523
  }
515
524
  if currentConstraints == nil {
@@ -592,24 +601,15 @@ func parseURIs(uris []*url.URL) ([]parsedURI, error) {
592
601
  return parsed, nil
593
602
  }
594
603
 
595
- type parsedEmail struct {
596
- email string
597
- mailbox *rfc2821Mailbox
598
- }
599
-
600
- func (e parsedEmail) String() string {
601
- return e.mailbox.local + "@" + e.mailbox.domain
602
- }
603
-
604
- func parseMailboxes(emails []string) ([]parsedEmail, error) {
605
- parsed := make([]parsedEmail, 0, len(emails))
604
+ func parseMailboxes(emails []string) ([]rfc2821Mailbox, error) {
605
+ parsed := make([]rfc2821Mailbox, 0, len(emails))
606
606
  for _, email := range emails {
607
607
  mailbox, ok := parseRFC2821Mailbox(email)
608
608
  if !ok {
609
609
  return nil, fmt.Errorf("cannot parse rfc822Name %q", email)
610
610
  }
611
611
  mailbox.domain = strings.ToLower(mailbox.domain)
612
- parsed = append(parsed, parsedEmail{strings.ToLower(email), &mailbox})
612
+ parsed = append(parsed, mailbox)
613
613
  }
614
614
  return parsed, nil
615
615
  }
@@ -253,6 +253,10 @@ type rfc2821Mailbox struct {
253
253
  local, domain string
254
254
  }
255
255
 
256
+ func (s rfc2821Mailbox) String() string {
257
+ return fmt.Sprintf("%s@%s", s.local, s.domain)
258
+ }
259
+
256
260
  // parseRFC2821Mailbox parses an email address into local and domain parts,
257
261
  // based on the ABNF for a “Mailbox” from RFC 2821. According to RFC 5280,
258
262
  // Section 4.2.1.6 that's correct for an rfc822Name from a certificate: “The
@@ -716,6 +720,8 @@ func alreadyInChain(candidate *Certificate, chain []*Certificate) bool {
716
720
  // for failed checks due to different intermediates having the same Subject.
717
721
  const maxChainSignatureChecks = 100
718
722
 
723
+ var errSignatureLimit = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
724
+
719
725
  func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, opts *VerifyOptions) (chains [][]*Certificate, err error) {
720
726
  var (
721
727
  hintErr error
@@ -723,16 +729,16 @@ func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, o
723
729
  )
724
730
 
725
731
  considerCandidate := func(certType int, candidate potentialParent) {
726
- if candidate.cert.PublicKey == nil || alreadyInChain(candidate.cert, currentChain) {
727
- return
728
- }
729
-
730
732
  if sigChecks == nil {
731
733
  sigChecks = new(int)
732
734
  }
733
735
  *sigChecks++
734
736
  if *sigChecks > maxChainSignatureChecks {
735
- err = errors.New("x509: signature check attempts limit reached while verifying certificate chain")
737
+ err = errSignatureLimit
738
+ return
739
+ }
740
+
741
+ if candidate.cert.PublicKey == nil || alreadyInChain(candidate.cert, currentChain) {
736
742
  return
737
743
  }
738
744
 
@@ -773,11 +779,20 @@ func (c *Certificate) buildChains(currentChain []*Certificate, sigChecks *int, o
773
779
  }
774
780
  }
775
781
 
776
- for _, root := range opts.Roots.findPotentialParents(c) {
777
- considerCandidate(rootCertificate, root)
778
- }
779
- for _, intermediate := range opts.Intermediates.findPotentialParents(c) {
780
- considerCandidate(intermediateCertificate, intermediate)
782
+ candidateLoop:
783
+ for _, parents := range []struct {
784
+ certType int
785
+ potentials []potentialParent
786
+ }{
787
+ {rootCertificate, opts.Roots.findPotentialParents(c)},
788
+ {intermediateCertificate, opts.Intermediates.findPotentialParents(c)},
789
+ } {
790
+ for _, parent := range parents.potentials {
791
+ considerCandidate(parents.certType, parent)
792
+ if err == errSignatureLimit {
793
+ break candidateLoop
794
+ }
795
+ }
781
796
  }
782
797
 
783
798
  if len(chains) > 0 {
@@ -1280,12 +1295,12 @@ func policiesValid(chain []*Certificate, opts VerifyOptions) bool {
1280
1295
  } else {
1281
1296
  // 6.1.4 (b) (3) (i) -- as updated by RFC 9618
1282
1297
  pg.deleteLeaf(mapping.IssuerDomainPolicy)
1283
-
1284
- // 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
1285
- pg.prune()
1286
1298
  }
1287
1299
  }
1288
1300
 
1301
+ // 6.1.4 (b) (3) (ii) -- as updated by RFC 9618
1302
+ pg.prune()
1303
+
1289
1304
  for issuerStr, subjectPolicies := range mappings {
1290
1305
  // 6.1.4 (b) (1) -- as updated by RFC 9618
1291
1306
  if matching := pg.leafWithPolicy(OID{der: []byte(issuerStr)}); matching != nil {
@@ -14,11 +14,12 @@ func _() {
14
14
  _ = x[attrStyle-3]
15
15
  _ = x[attrURL-4]
16
16
  _ = x[attrSrcset-5]
17
+ _ = x[attrMetaContent-6]
17
18
  }
18
19
 
19
- const _attr_name = "attrNoneattrScriptattrScriptTypeattrStyleattrURLattrSrcset"
20
+ const _attr_name = "attrNoneattrScriptattrScriptTypeattrStyleattrURLattrSrcsetattrMetaContent"
20
21
 
21
- var _attr_index = [...]uint8{0, 8, 18, 32, 41, 48, 58}
22
+ var _attr_index = [...]uint8{0, 8, 18, 32, 41, 48, 58, 73}
22
23
 
23
24
  func (i attr) String() string {
24
25
  if i >= attr(len(_attr_index)-1) {
@@ -6,6 +6,7 @@ package template
6
6
 
7
7
  import (
8
8
  "fmt"
9
+ "slices"
9
10
  "text/template/parse"
10
11
  )
11
12
 
@@ -37,7 +38,7 @@ func (c context) String() string {
37
38
  if c.err != nil {
38
39
  err = c.err
39
40
  }
40
- return fmt.Sprintf("{%v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.attr, c.element, err)
41
+ return fmt.Sprintf("{%v %v %v %v %v %v %v %v}", c.state, c.delim, c.urlPart, c.jsCtx, c.jsBraceDepth, c.attr, c.element, err)
41
42
  }
42
43
 
43
44
  // eq reports whether two contexts are equal.
@@ -46,6 +47,7 @@ func (c context) eq(d context) bool {
46
47
  c.delim == d.delim &&
47
48
  c.urlPart == d.urlPart &&
48
49
  c.jsCtx == d.jsCtx &&
50
+ slices.Equal(c.jsBraceDepth, d.jsBraceDepth) &&
49
51
  c.attr == d.attr &&
50
52
  c.element == d.element &&
51
53
  c.err == d.err
@@ -68,6 +70,9 @@ func (c context) mangle(templateName string) string {
68
70
  if c.jsCtx != jsCtxRegexp {
69
71
  s += "_" + c.jsCtx.String()
70
72
  }
73
+ if c.jsBraceDepth != nil {
74
+ s += fmt.Sprintf("_jsBraceDepth(%v)", c.jsBraceDepth)
75
+ }
71
76
  if c.attr != attrNone {
72
77
  s += "_" + c.attr.String()
73
78
  }
@@ -77,6 +82,13 @@ func (c context) mangle(templateName string) string {
77
82
  return s
78
83
  }
79
84
 
85
+ // clone returns a copy of c with the same field values.
86
+ func (c context) clone() context {
87
+ clone := c
88
+ clone.jsBraceDepth = slices.Clone(c.jsBraceDepth)
89
+ return clone
90
+ }
91
+
80
92
  // state describes a high-level HTML parser state.
81
93
  //
82
94
  // It bounds the top of the element stack, and by extension the HTML insertion
@@ -156,6 +168,10 @@ const (
156
168
  // stateError is an infectious error state outside any valid
157
169
  // HTML/CSS/JS construct.
158
170
  stateError
171
+ // stateMetaContent occurs inside a HTML meta element content attribute.
172
+ stateMetaContent
173
+ // stateMetaContentURL occurs inside a "url=" tag in a HTML meta element content attribute.
174
+ stateMetaContentURL
159
175
  // stateDead marks unreachable code after a {{break}} or {{continue}}.
160
176
  stateDead
161
177
  )
@@ -267,6 +283,8 @@ const (
267
283
  elementTextarea
268
284
  // elementTitle corresponds to the RCDATA <title> element.
269
285
  elementTitle
286
+ // elementMeta corresponds to the HTML <meta> element.
287
+ elementMeta
270
288
  )
271
289
 
272
290
  //go:generate stringer -type attr
@@ -288,4 +306,6 @@ const (
288
306
  attrURL
289
307
  // attrSrcset corresponds to a srcset attribute.
290
308
  attrSrcset
309
+ // attrMetaContent corresponds to the content attribute in meta HTML element.
310
+ attrMetaContent
291
311
  )
@@ -13,11 +13,12 @@ func _() {
13
13
  _ = x[elementStyle-2]
14
14
  _ = x[elementTextarea-3]
15
15
  _ = x[elementTitle-4]
16
+ _ = x[elementMeta-5]
16
17
  }
17
18
 
18
- const _element_name = "elementNoneelementScriptelementStyleelementTextareaelementTitle"
19
+ const _element_name = "elementNoneelementScriptelementStyleelementTextareaelementTitleelementMeta"
19
20
 
20
- var _element_index = [...]uint8{0, 11, 24, 36, 51, 63}
21
+ var _element_index = [...]uint8{0, 11, 24, 36, 51, 63, 74}
21
22
 
22
23
  func (i element) String() string {
23
24
  if i >= element(len(_element_index)-1) {
@@ -166,6 +166,8 @@ func (e *escaper) escape(c context, n parse.Node) context {
166
166
 
167
167
  var debugAllowActionJSTmpl = godebug.New("jstmpllitinterp")
168
168
 
169
+ var htmlmetacontenturlescape = godebug.New("htmlmetacontenturlescape")
170
+
169
171
  // escapeAction escapes an action template node.
170
172
  func (e *escaper) escapeAction(c context, n *parse.ActionNode) context {
171
173
  if len(n.Pipe.Decl) != 0 {
@@ -223,6 +225,18 @@ func (e *escaper) escapeAction(c context, n *parse.ActionNode) context {
223
225
  default:
224
226
  panic(c.urlPart.String())
225
227
  }
228
+ case stateMetaContent:
229
+ // Handled below in delim check.
230
+ case stateMetaContentURL:
231
+ if htmlmetacontenturlescape.Value() != "0" {
232
+ s = append(s, "_html_template_urlfilter")
233
+ } else {
234
+ // We don't have a great place to increment this, since it's hard to
235
+ // know if we actually escape any urls in _html_template_urlfilter,
236
+ // since it has no information about what context it is being
237
+ // executed in etc. This is probably the best we can do.
238
+ htmlmetacontenturlescape.IncNonDefault()
239
+ }
226
240
  case stateJS:
227
241
  s = append(s, "_html_template_jsvalescaper")
228
242
  // A slash after a value starts a div operator.
@@ -509,7 +523,7 @@ func (e *escaper) escapeBranch(c context, n *parse.BranchNode, nodeName string)
509
523
  if nodeName == "range" {
510
524
  e.rangeContext = &rangeContext{outer: e.rangeContext}
511
525
  }
512
- c0 := e.escapeList(c, n.List)
526
+ c0 := e.escapeList(c.clone(), n.List)
513
527
  if nodeName == "range" {
514
528
  if c0.state != stateError {
515
529
  c0 = joinRange(c0, e.rangeContext)
@@ -540,7 +554,7 @@ func (e *escaper) escapeBranch(c context, n *parse.BranchNode, nodeName string)
540
554
  return c0
541
555
  }
542
556
  }
543
- c1 := e.escapeList(c, n.ElseList)
557
+ c1 := e.escapeList(c.clone(), n.ElseList)
544
558
  return join(c0, c1, n, nodeName)
545
559
  }
546
560
 
@@ -36,12 +36,14 @@ func _() {
36
36
  _ = x[stateCSSBlockCmt-25]
37
37
  _ = x[stateCSSLineCmt-26]
38
38
  _ = x[stateError-27]
39
- _ = x[stateDead-28]
39
+ _ = x[stateMetaContent-28]
40
+ _ = x[stateMetaContentURL-29]
41
+ _ = x[stateDead-30]
40
42
  }
41
43
 
42
- const _state_name = "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSTmplLitstateJSRegexpstateJSBlockCmtstateJSLineCmtstateJSHTMLOpenCmtstateJSHTMLCloseCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateDead"
44
+ const _state_name = "stateTextstateTagstateAttrNamestateAfterNamestateBeforeValuestateHTMLCmtstateRCDATAstateAttrstateURLstateSrcsetstateJSstateJSDqStrstateJSSqStrstateJSTmplLitstateJSRegexpstateJSBlockCmtstateJSLineCmtstateJSHTMLOpenCmtstateJSHTMLCloseCmtstateCSSstateCSSDqStrstateCSSSqStrstateCSSDqURLstateCSSSqURLstateCSSURLstateCSSBlockCmtstateCSSLineCmtstateErrorstateMetaContentstateMetaContentURLstateDead"
43
45
 
44
- var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, 118, 130, 142, 156, 169, 184, 198, 216, 235, 243, 256, 269, 282, 295, 306, 322, 337, 347, 356}
46
+ var _state_index = [...]uint16{0, 9, 17, 30, 44, 60, 72, 83, 92, 100, 111, 118, 130, 142, 156, 169, 184, 198, 216, 235, 243, 256, 269, 282, 295, 306, 322, 337, 347, 363, 382, 391}
45
47
 
46
48
  func (i state) String() string {
47
49
  if i >= state(len(_state_index)-1) {