Documentation
¶
Overview ¶
Package xmlroundtrip rejects XML documents that encoding/xml would change if it decoded and re-encoded them.
Go's encoding/xml does not round-trip some namespace prefixes on elements and attributes, or some directives, unchanged (CVE-2020-29509, CVE-2020-29510, CVE-2020-29511). This package rejects any document with a token that is not stable under such a round trip. It makes the same check as github.com/mattermost/xml-roundtrip-validator, but without allocating a new encoder and decoder for every token, so the memory it allocates is a small multiple of the size of its input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct {
// Line and Column give the position (1-based) of the start of the token.
Line, Column int64
Err error
}
Error reports the token of a document that does not survive a round trip, or that could not be checked.
type RoundTripError ¶
RoundTripError reports a token that encoding/xml decodes differently after encoding it.
func (*RoundTripError) Error ¶
func (e *RoundTripError) Error() string