-
Notifications
You must be signed in to change notification settings - Fork 105
fix(deploy-on-aws): defusedxml.ElementTree compatibility in fixers #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
f76bb4f
07cfca7
6245729
9c84ed7
1437369
9f8c715
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,21 @@ | |
|
|
||
| import argparse | ||
| import defusedxml.ElementTree as ET | ||
| # defusedxml.ElementTree re-exports the secure parsing helpers | ||
| # (parse, fromstring) but does NOT re-export the type aliases Element / | ||
| # ElementTree, nor the indent() pretty-printer added in Python 3.9. This | ||
| # script's annotations and pretty-print step both reach for those, so we | ||
| # pull them in from the stdlib while keeping defusedxml's parse() as the | ||
| # actual XML entry point. Filed against awslabs/agent-plugins as #154 | ||
| # (Element / ElementTree) and #167 (indent). | ||
| from xml.etree.ElementTree import ( # nosec B405 # nosemgrep: python.lang.security.use-defused-xml.use-defused-xml,gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 | ||
| Element as _Element, | ||
| ElementTree as _ElementTree, | ||
| indent as _indent, | ||
Check failureCode scanning / Semgrep OSS Semgrep Finding: gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 Error
Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE)
attacks. The Python documentation recommends the 'defusedxml' library instead. Use 'defusedxml'. See https://github.com/tiran/defusedxml for more information. Check failureCode scanning / Semgrep OSS Semgrep Finding: python.lang.security.use-defused-xml.use-defused-xml Error
The Python documentation recommends using defusedxml instead of xml because the native Python xml library is vulnerable to XML External Entity (XXE) attacks. These attacks can leak confidential data and "XML bombs" can cause denial of service.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| ) | ||
| ET.Element = _Element # type: ignore[attr-defined] | ||
| ET.ElementTree = _ElementTree # type: ignore[attr-defined] | ||
| ET.indent = _indent # type: ignore[attr-defined] | ||
|
|
||
| # Broken shape names → correct shape names | ||
| SHAPE_RENAMES: dict[str, str] = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,21 @@ | |
|
|
||
| import argparse | ||
| import defusedxml.ElementTree as ET | ||
| # defusedxml.ElementTree re-exports the secure parsing helpers | ||
| # (parse, fromstring) but does NOT re-export the type aliases Element / | ||
| # ElementTree, nor the indent() pretty-printer added in Python 3.9. This | ||
| # script's annotations and pretty-print step both reach for those, so we | ||
| # pull them in from the stdlib while keeping defusedxml's parse() as the | ||
| # actual XML entry point. Filed against awslabs/agent-plugins as #154 | ||
| # (Element / ElementTree) and #167 (indent). | ||
| from xml.etree.ElementTree import ( # nosec B405 # nosemgrep: python.lang.security.use-defused-xml.use-defused-xml,gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 | ||
| Element as _Element, | ||
| ElementTree as _ElementTree, | ||
| indent as _indent, | ||
Check failureCode scanning / Semgrep OSS Semgrep Finding: gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 Error
Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE)
attacks. The Python documentation recommends the 'defusedxml' library instead. Use 'defusedxml'. See https://github.com/tiran/defusedxml for more information. Check failureCode scanning / Semgrep OSS Semgrep Finding: python.lang.security.use-defused-xml.use-defused-xml Error
The Python documentation recommends using defusedxml instead of xml because the native Python xml library is vulnerable to XML External Entity (XXE) attacks. These attacks can leak confidential data and "XML bombs" can cause denial of service.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| ) | ||
| ET.Element = _Element # type: ignore[attr-defined] | ||
| ET.ElementTree = _ElementTree # type: ignore[attr-defined] | ||
| ET.indent = _indent # type: ignore[attr-defined] | ||
|
|
||
|
|
||
| def get_style_dict(style_str: str) -> dict[str, str]: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,21 @@ | |
| import math | ||
| import re | ||
| import defusedxml.ElementTree as ET | ||
| # defusedxml.ElementTree re-exports the secure parsing helpers | ||
| # (parse, fromstring) but does NOT re-export the type aliases Element / | ||
| # ElementTree, nor the indent() pretty-printer added in Python 3.9. This | ||
| # script's annotations and pretty-print step both reach for those, so we | ||
| # pull them in from the stdlib while keeping defusedxml's parse() as the | ||
| # actual XML entry point. Filed against awslabs/agent-plugins as #154 | ||
| # (Element / ElementTree) and #167 (indent). | ||
| from xml.etree.ElementTree import ( # nosec B405 # nosemgrep: python.lang.security.use-defused-xml.use-defused-xml,gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 | ||
| Element as _Element, | ||
| ElementTree as _ElementTree, | ||
| indent as _indent, | ||
Check failureCode scanning / Semgrep OSS Semgrep Finding: gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 Error
Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE)
attacks. The Python documentation recommends the 'defusedxml' library instead. Use 'defusedxml'. See https://github.com/tiran/defusedxml for more information. Check failureCode scanning / Semgrep OSS Semgrep Finding: python.lang.security.use-defused-xml.use-defused-xml Error
The Python documentation recommends using defusedxml instead of xml because the native Python xml library is vulnerable to XML External Entity (XXE) attacks. These attacks can leak confidential data and "XML bombs" can cause denial of service.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| ) | ||
| ET.Element = _Element # type: ignore[attr-defined] | ||
| ET.ElementTree = _ElementTree # type: ignore[attr-defined] | ||
| ET.indent = _indent # type: ignore[attr-defined] | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,21 @@ | |
| import os | ||
| import sys | ||
| import defusedxml.ElementTree as ET | ||
| # defusedxml.ElementTree re-exports the secure parsing helpers | ||
| # (parse, fromstring) but does NOT re-export the type aliases Element / | ||
| # ElementTree, nor the indent() pretty-printer added in Python 3.9. This | ||
| # script's annotations and pretty-print step both reach for those, so we | ||
| # pull them in from the stdlib while keeping defusedxml's parse() as the | ||
| # actual XML entry point. Filed against awslabs/agent-plugins as #154 | ||
| # (Element / ElementTree) and #167 (indent). | ||
| from xml.etree.ElementTree import ( # nosec B405 # nosemgrep: python.lang.security.use-defused-xml.use-defused-xml,gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 | ||
| Element as _Element, | ||
| ElementTree as _ElementTree, | ||
| indent as _indent, | ||
Check failureCode scanning / Semgrep OSS Semgrep Finding: gitlab.bandit.B313.B314.B315.B316.B318.B319.B320.B405.B406.B407.B408.B409.B410 Error
Found use of the native Python XML libraries, which is vulnerable to XML external entity (XXE)
attacks. The Python documentation recommends the 'defusedxml' library instead. Use 'defusedxml'. See https://github.com/tiran/defusedxml for more information. Check failureCode scanning / Semgrep OSS Semgrep Finding: python.lang.security.use-defused-xml.use-defused-xml Error
The Python documentation recommends using defusedxml instead of xml because the native Python xml library is vulnerable to XML External Entity (XXE) attacks. These attacks can leak confidential data and "XML bombs" can cause denial of service.
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| ) | ||
| ET.Element = _Element # type: ignore[attr-defined] | ||
| ET.ElementTree = _ElementTree # type: ignore[attr-defined] | ||
| ET.indent = _indent # type: ignore[attr-defined] | ||
| from pathlib import Path | ||
|
|
||
| MAX_FILE_SIZE = 2 * 1024 * 1024 # 2 MB | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.