Skip to content
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

Add support for NUnit files #289

Merged
merged 4 commits into from Jun 21, 2022
Merged

Add support for NUnit files #289

merged 4 commits into from Jun 21, 2022

Conversation

EnricoMi
Copy link
Owner

No description provided.

@EnricoMi EnricoMi changed the title Add support for NUnit Add support for NUnit files May 23, 2022


with (pathlib.Path(__file__).parent / 'xslt' / 'nunit-to-junit.xslt').open('r', encoding='utf-8') as r:
transform_nunit_to_junit = etree.XSLT(etree.parse(r))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]



with (pathlib.Path(__file__).parent / 'xslt' / 'trx-to-junit.xslt').open('r', encoding='utf-8') as r:
transform_trx_to_junit = etree.XSLT(etree.parse(r))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]



with (pathlib.Path(__file__).parent / 'xslt' / 'xunit-to-junit.xslt').open('r', encoding='utf-8') as r:
transform_xunit_to_junit = etree.XSLT(etree.parse(r))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

return Exception(f'File is empty.')

try:
trx = etree.parse(path)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

return Exception(f'File is empty.')

try:
trx = etree.parse(path)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

return Exception(f'File is empty.')

try:
trx = etree.parse(path)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt.semgrep.python.lang.security.use-defused-xml.use-defused-xml: 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 if the XML being
loaded is untrusted.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt.semgrep.python.lang.security.use-defused-xml.use-defused-xml: 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 if the XML being
loaded is untrusted.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

from typing import Iterable, Tuple, Union

from junitparser import JUnitXml
from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt.semgrep.python.lang.security.use-defused-xml.use-defused-xml: 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 if the XML being
loaded is untrusted.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (macOS 12 python installed)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (macOS python installed)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Dockerfile)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Docker Image)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (macOS python 3.6)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Linux python 3.6)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Linux python installed)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Linux 22.04 python installed)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (Windows python installed)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2022

Test Results (reference)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@EnricoMi EnricoMi force-pushed the branch-add-nunit branch 2 times, most recently from 8af4c8b to c1fd6af Compare May 24, 2022 12:45
import pathlib
import unittest

from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

class TestXunit(unittest.TestCase):
def test_transform(self):
result_file = str(test_files_path / 'xunit.xml')
trx = etree.parse(str(result_file))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


def test_transform(self):
result_file = str(test_files_path / 'mstest.trx')
trx = etree.parse(str(result_file))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

import pathlib
import unittest

from lxml import etree
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blacklist: Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

locale.setlocale(locale.LC_ALL, encoding)
locale_set = True
break
except:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try_except_pass: Try, Except, Pass detected.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


base=$(dirname "$0")

python $base/../test_junit.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2086: Double quote to prevent globbing and word splitting.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


python $base/../test_junit.py
python $base/../test_nunit.py
python $base/../test_xunit.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2086: Double quote to prevent globbing and word splitting.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

base=$(dirname "$0")

python $base/../test_junit.py
python $base/../test_nunit.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2086: Double quote to prevent globbing and word splitting.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

python $base/../test_junit.py
python $base/../test_nunit.py
python $base/../test_xunit.py
python $base/../test_trx.py
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SC2086: Double quote to prevent globbing and word splitting.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@EnricoMi EnricoMi changed the base branch from master to development May 28, 2022 08:54
@EnricoMi EnricoMi changed the base branch from development to development-2.0 May 28, 2022 08:56
@EnricoMi EnricoMi force-pushed the devel-2.0 branch 2 times, most recently from 36c4754 to 57463e0 Compare June 6, 2022 18:26
@github-actions

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Jun 7, 2022

Test Results (Test File)

97 tests  ±0   80 ✔️ ±0   3m 25s ⏱️ ±0s
  1 suites ±0   17 💤 ±0 
  1 files   ±0     0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

♻️ This comment has been updated with latest results.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Test Results (setup-python)

       69 files  ±    0         69 suites  ±0   27m 25s ⏱️ + 3m 55s
     305 tests +    2       305 ✔️ +    2      0 💤 ±0  0 ±0 
21 045 runs  +138  20 505 ✔️ +138  540 💤 ±0  0 ±0 

Results for commit fc8cfbe. ± Comparison against base commit 7d18cf0.

@EnricoMi EnricoMi merged commit 8898aba into devel-2.0 Jun 21, 2022
@EnricoMi EnricoMi deleted the branch-add-nunit branch June 21, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant