diff --git a/go.mod b/go.mod index 1d105f246..10f02d8c6 100644 --- a/go.mod +++ b/go.mod @@ -172,7 +172,7 @@ require ( go.yaml.in/yaml/v2 v2.4.5 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/mod v0.41.0 // indirect - golang.org/x/net v0.60.0 // indirect + golang.org/x/net v0.62.0 // indirect golang.org/x/oauth2 v0.36.0 // indirect golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.49.0 // indirect diff --git a/go.sum b/go.sum index 7a7ac7f4a..41bdef7f3 100644 --- a/go.sum +++ b/go.sum @@ -564,8 +564,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 165b6108d..a99cee665 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -51,6 +51,9 @@ type parser struct { // context is the context element when parsing an HTML fragment // (section 12.4). context *Node + // textNodes holds buffers for TextNodes that have had multiple text + // tokens coalesced into them. + textNodes map[*Node][]byte } func (p *parser) top() *Node { @@ -292,7 +295,7 @@ func (p *parser) fosterParent(n *Node) { prev = parent.LastChild } if prev != nil && prev.Type == TextNode && n.Type == TextNode { - prev.Data += n.Data + p.appendText(prev, n.Data) return } @@ -316,7 +319,7 @@ func (p *parser) addText(text string) { t := p.top() if n := t.LastChild; n != nil && n.Type == TextNode { - n.Data += text + p.appendText(n, text) return } p.addChild(&Node{ @@ -325,6 +328,18 @@ func (p *parser) addText(text string) { }) } +func (p *parser) appendText(n *Node, text string) { + if p.textNodes == nil { + p.textNodes = make(map[*Node][]byte) + } + b, ok := p.textNodes[n] + if !ok { + b = []byte(n.Data) + n.Data = "" + } + p.textNodes[n] = append(b, text...) +} + func attrCompare(a, b Attribute) int { return cmp.Or( cmp.Compare(a.Namespace, b.Namespace), @@ -2242,6 +2257,10 @@ func (p *parser) parse() (err error) { } p.parseCurrentToken() } + for n, b := range p.textNodes { + n.Data = string(b) + } + p.textNodes = nil return nil } diff --git a/vendor/golang.org/x/net/html/render.go b/vendor/golang.org/x/net/html/render.go index 767eeae25..f356d48b7 100644 --- a/vendor/golang.org/x/net/html/render.go +++ b/vendor/golang.org/x/net/html/render.go @@ -246,18 +246,17 @@ func childTextNodesAreLiteral(n *Node) bool { switch n.Data { case "iframe", "noembed", "noframes", "noscript", "plaintext", "script", "style", "xmp": - // We need to check if n is a node that was fostered from a HTML namespace - // into a non-HTML namespace (in which case, different rules apply to it). - // We do this by walking up the tree until we find a node with a non-empty - // namespace. If we find such a node, we also have to check if it's - // an HTML integration point. If it isn't, then the node we're currently - // looking at is foster-parented and we should return false. - for p := n.Parent; p != nil; p = p.Parent { - if p.Namespace != "" { - if !htmlIntegrationPoint(p) { - return false - } - break + // n's text is literal only if the parser would keep n in the HTML + // namespace when the output is re-parsed. An ancestor may have been + // fostered under a foreign element (such as an HTML under + // ) where the parser would instead create it, and its + // descendants, in that element's namespace. We walk up the whole tree + // and check that every transition out of a non-HTML namespace happens + // at an HTML integration point. This is stricter than the parser, so + // some text that would be safe literally is escaped. + for c, p := n, n.Parent; p != nil; c, p = p, p.Parent { + if p.Namespace != "" && p.Namespace != c.Namespace && !htmlIntegrationPoint(p) { + return false } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 63e84b3fb..1fa44eb6d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -868,7 +868,7 @@ golang.org/x/crypto/ssh/knownhosts golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.60.0 +# golang.org/x/net v0.62.0 ## explicit; go 1.26.0 golang.org/x/net/context golang.org/x/net/html