Unsanitized user input in XML External Entity
- Rule ID: go_lang_xml_external_entity_vulnerability
- Languages: go
- Source: xml_external_entity_vulnerability.yml
Description
Avoid parsing untrusted data as XML. Such data could include URIs that resolve to resources that are outside of the current context, leading to XML External Entity (XXE) injection.
Remediations
-
Do use Go’s standard
encoding/xmlpackage, which does not process external entities by default. -
Do always validate and sanitize user-provided XML input.
-
Do not use third-party XML parsers or custom configurations that enable entity expansion or DTD parsing.
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=go_lang_xml_external_entity_vulnerability
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=go_lang_xml_external_entity_vulnerability