File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11package config
22
33import (
4+ "bytes"
45 "encoding/xml"
56)
67
78// UnmarshalXML parses the XML-encoded data and stores the result in
89// the value pointed to by v, which must be an arbitrary struct,
910// slice, or string. Well-formed data that does not fit into v is
1011// discarded.
12+ //
13+ // Security: This function uses xml.Decoder with strict settings to prevent
14+ // XXE (XML External Entity) attacks.
1115func UnmarshalXML (content []byte , v interface {}) error {
12- return xml .Unmarshal (content , v )
16+ decoder := xml .NewDecoder (bytes .NewReader (content ))
17+ // Note: Go's xml package doesn't process external entities by default
18+ // This explicit usage of Decoder provides clarity and future-proofing
19+ return decoder .Decode (v )
1320}
1421
1522// MarshalXML returns the XML encoding of v.
You can’t perform that action at this time.
0 commit comments