Skip to content

t/14_serializer/04_request_xml.t seems buggy #1239

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

Closed
gregoa opened this issue Jan 3, 2023 · 2 comments
Closed

t/14_serializer/04_request_xml.t seems buggy #1239

gregoa opened this issue Jan 3, 2023 · 2 comments

Comments

@gregoa
Copy link

gregoa commented Jan 3, 2023

Building 1.3520 for Debian, I noticed failures in t/14_serializer/04_request_xml.t:

When running t/14_serializer/04_request_xml.t during the package build (so basically make test in a chroot):

Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.

#   Failed test 'No XXE SSRF vulnerability in our XML handling'
#   at t/14_serializer/04_request_xml.t line 134.
#          got: '2'
#     expected: '1'
# access_line: Accessed at Tue Jan  3 19:26:43 2023
# access_line: Accessed at Tue Jan  3 19:26:43 2023
# Looks like you failed 1 test of 11.
t/14_serializer/04_request_xml.t ....................
1..11
ok 1
ok 2
ok 3
ok 4
ok 5 - data is correctly deserialized
ok 6 - goodcontent type set in response
ok 7
ok 8
ok 9
ok 10
HTTP::Server::Simple::PSGI: You can connect to your server at http://localhost:42441/
not ok 11 - No XXE SSRF vulnerability in our XML handling
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/11 subtests

When running t/14_serializer/04_request_xml.t manually after the failure above:

# prove --blib t/14_serializer/04_request_xml.t
t/14_serializer/04_request_xml.t .. 1/11 Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.
Warning: 'ParserOpts' is deprecated, contact the author if you need it at /build/libdancer-perl-1.3520+dfsg/blib/lib/Dancer/Serializer/XML.pm line 99.

#   Failed test 'No XXE SSRF vulnerability in our XML handling'
#   at t/14_serializer/04_request_xml.t line 134.
#          got: '0'
#     expected: '1'
# Looks like you failed 1 test of 11.
t/14_serializer/04_request_xml.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/11 subtests 

Note that got has one time 2 and the other time 0 but never 1.

This can also be seen on CPAN testers:
https://www.cpantesters.org/cpan/report/0e1d41ba-8af0-11ed-957b-f9c6f25c7232 (got: 2)
https://www.cpantesters.org/cpan/report/b97bb9a4-8ad4-11ed-9e3f-bc476c93ce5e (got: 3)
https://www.cpantesters.org/cpan/report/eeb26912-8ad2-11ed-8424-ca7bf01f4358 (got: 3)

The history of t/14_serializer/04_request_xml.t in git is also interesting: It first checks for 1 line, then for 4 (adding a comment and diag output), and then for 1 again (leaving the-now incorrect-comment about the four lines). All examples I've seen are neither 1 nor 4 :)

No idea what's going on there exactly but this test looks not perfect …

Cheers,
gregor

@cromedome
Copy link
Contributor

I pushed a fix that addresses most of these cases. It's not pretty, but should cover any case > 0. I'll release a new version ASAP.

cromedome added a commit that referenced this issue Feb 5, 2023
We see a different number of responses in the access file, but there
should always be at least one line. Change the test to account for any
case > 1.

The error report shows that 0 was returned when the test was run
individually. Can't reproduce this locally, so added a TODO item to
potentially investigate later.
@gregoa
Copy link
Author

gregoa commented Feb 10, 2023

Thanks, 1.3521 uploaded to Debian/unstable.

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

No branches or pull requests

2 participants