Updated transitive dependencies
This commit is contained in:
parent
7344437e3e
commit
72967395e1
4
go.mod
4
go.mod
|
@ -7,11 +7,11 @@ require (
|
||||||
github.com/klauspost/compress v1.16.0
|
github.com/klauspost/compress v1.16.0
|
||||||
github.com/spf13/cobra v1.6.1
|
github.com/spf13/cobra v1.6.1
|
||||||
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
|
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
|
||||||
golang.org/x/image v0.5.0
|
golang.org/x/image v0.6.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
golang.org/x/net v0.7.0 // indirect
|
golang.org/x/net v0.8.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
15
go.sum
15
go.sum
|
@ -16,30 +16,37 @@ github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4/go.mod h1:+ccdNT0xMY
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
|
golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4=
|
||||||
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
|
golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||||
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|
|
@ -92,6 +92,21 @@ example, to process each anchor node in depth-first order:
|
||||||
The relevant specifications include:
|
The relevant specifications include:
|
||||||
https://html.spec.whatwg.org/multipage/syntax.html and
|
https://html.spec.whatwg.org/multipage/syntax.html and
|
||||||
https://html.spec.whatwg.org/multipage/syntax.html#tokenization
|
https://html.spec.whatwg.org/multipage/syntax.html#tokenization
|
||||||
|
|
||||||
|
# Security Considerations
|
||||||
|
|
||||||
|
Care should be taken when parsing and interpreting HTML, whether full documents
|
||||||
|
or fragments, within the framework of the HTML specification, especially with
|
||||||
|
regard to untrusted inputs.
|
||||||
|
|
||||||
|
This package provides both a tokenizer and a parser. Only the parser constructs
|
||||||
|
a DOM according to the HTML specification, resolving malformed and misplaced
|
||||||
|
tags where appropriate. The tokenizer simply tokenizes the HTML presented to it,
|
||||||
|
and as such does not resolve issues that may exist in the processed HTML,
|
||||||
|
producing a literal interpretation of the input.
|
||||||
|
|
||||||
|
If your use case requires semantically well-formed HTML, as defined by the
|
||||||
|
WHATWG specifiction, the parser should be used rather than the tokenizer.
|
||||||
*/
|
*/
|
||||||
package html // import "golang.org/x/net/html"
|
package html // import "golang.org/x/net/html"
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,87 @@ func lower(b []byte) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// escapeComment is like func escape but escapes its input bytes less often.
|
||||||
|
// Per https://github.com/golang/go/issues/58246 some HTML comments are (1)
|
||||||
|
// meaningful and (2) contain angle brackets that we'd like to avoid escaping
|
||||||
|
// unless we have to.
|
||||||
|
//
|
||||||
|
// "We have to" includes the '&' byte, since that introduces other escapes.
|
||||||
|
//
|
||||||
|
// It also includes those bytes (not including EOF) that would otherwise end
|
||||||
|
// the comment. Per the summary table at the bottom of comment_test.go, this is
|
||||||
|
// the '>' byte that, per above, we'd like to avoid escaping unless we have to.
|
||||||
|
//
|
||||||
|
// Studying the summary table (and T actions in its '>' column) closely, we
|
||||||
|
// only need to escape in states 43, 44, 49, 51 and 52. State 43 is at the
|
||||||
|
// start of the comment data. State 52 is after a '!'. The other three states
|
||||||
|
// are after a '-'.
|
||||||
|
//
|
||||||
|
// Our algorithm is thus to escape every '&' and to escape '>' if and only if:
|
||||||
|
// - The '>' is after a '!' or '-' (in the unescaped data) or
|
||||||
|
// - The '>' is at the start of the comment data (after the opening "<!--").
|
||||||
|
func escapeComment(w writer, s string) error {
|
||||||
|
// When modifying this function, consider manually increasing the
|
||||||
|
// maxSuffixLen constant in func TestComments, from 6 to e.g. 9 or more.
|
||||||
|
// That increase should only be temporary, not committed, as it
|
||||||
|
// exponentially affects the test running time.
|
||||||
|
|
||||||
|
if len(s) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop:
|
||||||
|
// - Grow j such that s[i:j] does not need escaping.
|
||||||
|
// - If s[j] does need escaping, output s[i:j] and an escaped s[j],
|
||||||
|
// resetting i and j to point past that s[j] byte.
|
||||||
|
i := 0
|
||||||
|
for j := 0; j < len(s); j++ {
|
||||||
|
escaped := ""
|
||||||
|
switch s[j] {
|
||||||
|
case '&':
|
||||||
|
escaped = "&"
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
if j > 0 {
|
||||||
|
if prev := s[j-1]; (prev != '!') && (prev != '-') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
escaped = ">"
|
||||||
|
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < j {
|
||||||
|
if _, err := w.WriteString(s[i:j]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err := w.WriteString(escaped); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
i = j + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < len(s) {
|
||||||
|
if _, err := w.WriteString(s[i:]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// escapeCommentString is to EscapeString as escapeComment is to escape.
|
||||||
|
func escapeCommentString(s string) string {
|
||||||
|
if strings.IndexAny(s, "&>") == -1 {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
escapeComment(&buf, s)
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
const escapedChars = "&'<>\"\r"
|
const escapedChars = "&'<>\"\r"
|
||||||
|
|
||||||
func escape(w writer, s string) error {
|
func escape(w writer, s string) error {
|
||||||
|
|
|
@ -85,7 +85,7 @@ func render1(w writer, n *Node) error {
|
||||||
if _, err := w.WriteString("<!--"); err != nil {
|
if _, err := w.WriteString("<!--"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := escape(w, n.Data); err != nil {
|
if err := escapeComment(w, n.Data); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.WriteString("-->"); err != nil {
|
if _, err := w.WriteString("-->"); err != nil {
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (t Token) String() string {
|
||||||
case SelfClosingTagToken:
|
case SelfClosingTagToken:
|
||||||
return "<" + t.tagString() + "/>"
|
return "<" + t.tagString() + "/>"
|
||||||
case CommentToken:
|
case CommentToken:
|
||||||
return "<!--" + EscapeString(t.Data) + "-->"
|
return "<!--" + escapeCommentString(t.Data) + "-->"
|
||||||
case DoctypeToken:
|
case DoctypeToken:
|
||||||
return "<!DOCTYPE " + EscapeString(t.Data) + ">"
|
return "<!DOCTYPE " + EscapeString(t.Data) + ">"
|
||||||
}
|
}
|
||||||
|
@ -598,10 +598,10 @@ scriptDataDoubleEscapeEnd:
|
||||||
// readComment reads the next comment token starting with "<!--". The opening
|
// readComment reads the next comment token starting with "<!--". The opening
|
||||||
// "<!--" has already been consumed.
|
// "<!--" has already been consumed.
|
||||||
func (z *Tokenizer) readComment() {
|
func (z *Tokenizer) readComment() {
|
||||||
// When modifying this function, consider manually increasing the suffixLen
|
// When modifying this function, consider manually increasing the
|
||||||
// constant in func TestComments, from 6 to e.g. 9 or more. That increase
|
// maxSuffixLen constant in func TestComments, from 6 to e.g. 9 or more.
|
||||||
// should only be temporary, not committed, as it exponentially affects the
|
// That increase should only be temporary, not committed, as it
|
||||||
// test running time.
|
// exponentially affects the test running time.
|
||||||
|
|
||||||
z.data.start = z.raw.end
|
z.data.start = z.raw.end
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
|
@ -25,14 +25,14 @@ github.com/spf13/pflag
|
||||||
# github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
|
# github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
|
||||||
## explicit
|
## explicit
|
||||||
github.com/yosssi/gohtml
|
github.com/yosssi/gohtml
|
||||||
# golang.org/x/image v0.5.0
|
# golang.org/x/image v0.6.0
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
golang.org/x/image/bmp
|
golang.org/x/image/bmp
|
||||||
golang.org/x/image/riff
|
golang.org/x/image/riff
|
||||||
golang.org/x/image/vp8
|
golang.org/x/image/vp8
|
||||||
golang.org/x/image/vp8l
|
golang.org/x/image/vp8l
|
||||||
golang.org/x/image/webp
|
golang.org/x/image/webp
|
||||||
# golang.org/x/net v0.7.0
|
# golang.org/x/net v0.8.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/net/html
|
golang.org/x/net/html
|
||||||
golang.org/x/net/html/atom
|
golang.org/x/net/html/atom
|
||||||
|
|
Loading…
Reference in New Issue