Skip to content

Commit fbbf688

Browse files
authored
Merge pull request #2785 from testssl/stderr
Ensure that stderr is caught / $prg=testssl.sh
2 parents 75d8f8a + ba360ba commit fbbf688

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

.github/workflows/unit_tests_macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
5252
- name: run it
5353
run: |
54-
prove -v t
54+
prove -v t 2>&1

.github/workflows/unit_tests_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ jobs:
5757
5858
- name: run it
5959
run: |
60-
prove -v t
60+
prove -v t 2>&1

t/23_client_simulation.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ $uri="google.com";
3131

3232
# unlink "tmp.json";
3333
printf "\n%s\n", "Client simulations unit test via sockets --> $uri ...";
34-
$socket_out = `./testssl.sh $check2run $uri 2>&1`;
34+
$socket_out = `$prg $check2run $uri 2>&1`;
3535
# $socket_json = json('tmp.json');
3636
unlike($socket_out, qr/$socket_regex_bl/, "");
3737
$tests++;
3838

3939
# unlink "tmp.json";
4040
printf "\n%s\n", "Client simulations unit test via OpenSSL --> $uri ...";
41-
$openssl_out = `./testssl.sh $check2run --ssl-native $uri 2>&1`;
41+
$openssl_out = `$prg $check2run --ssl-native $uri 2>&1`;
4242
# $openssl_json = json('tmp.json');
4343
unlike($openssl_out, qr/$openssl_regex_bl/, "");
4444
$tests++;
@@ -48,7 +48,7 @@ $uri="smtp-relay.gmail.com:587";
4848

4949
# unlink "tmp.json";
5050
printf "\n%s\n", "STARTTLS: Client simulations unit test via sockets --> $uri ...";
51-
$socket_out = `./testssl.sh $check2run -t smtp $uri 2>&1`;
51+
$socket_out = `$prg $check2run -t smtp $uri 2>&1`;
5252
# $socket_json = json('tmp.json');
5353
unlike($socket_out, qr/$socket_regex_bl/, "");
5454
$tests++;

t/31_isJSON_valid.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ unlink 'tmp.json';
2929

3030
#1
3131
printf "%s\n", ".. plain JSON --> $uri ";
32-
$out = `./testssl.sh $check2run --jsonfile tmp.json $uri`;
32+
$out = `$prg $check2run --jsonfile tmp.json $uri`;
3333
$json = json('tmp.json');
3434
unlink 'tmp.json';
3535
my @errors=eval { decode_json($json) };
@@ -39,7 +39,7 @@ $tests++;
3939

4040
#2
4141
printf "%s\n", ".. pretty JSON --> $uri ";
42-
$out = `./testssl.sh $check2run --jsonfile-pretty tmp.json $uri`;
42+
$out = `$prg $check2run --jsonfile-pretty tmp.json $uri`;
4343
$json = json('tmp.json');
4444
unlink 'tmp.json';
4545
@errors=eval { decode_json($json) };
@@ -50,7 +50,7 @@ $tests++;
5050
#3
5151
my $uri = "smtp-relay.gmail.com:587";
5252
printf "%s\n", " .. plain JSON and STARTTLS --> $uri ...";
53-
$out = `./testssl.sh --jsonfile tmp.json $check2run -t smtp $uri`;
53+
$out = `$prg --jsonfile tmp.json $check2run -t smtp $uri`;
5454
$json = json('tmp.json');
5555
unlink 'tmp.json';
5656
@errors=eval { decode_json($json) };
@@ -65,7 +65,7 @@ if ( $os eq "linux" ){
6565
# This testssl.sh run deliberately does NOT work as github actions block port 25 egress.
6666
# but the output should be fine. The idea is to have a unit test for a failed connection.
6767
printf "%s\n", ".. plain JSON for a failed run: '--mx $uri' ...";
68-
$out = `./testssl.sh --ssl-native --openssl-timeout=10 $check2run --jsonfile tmp.json --mx $uri`;
68+
$out = `$prg --ssl-native --openssl-timeout=10 $check2run --jsonfile tmp.json --mx $uri`;
6969
$json = json('tmp.json');
7070
unlink 'tmp.json';
7171
@errors=eval { decode_json($json) };
@@ -75,7 +75,7 @@ if ( $os eq "linux" ){
7575
#5
7676
# Same as above but with pretty JSON
7777
printf "%s\n", ".. pretty JSON for a failed run '--mx $uri' ...";
78-
$out = `./testssl.sh --ssl-native --openssl-timeout=10 $check2run --jsonfile-pretty tmp.json --mx $uri`;
78+
$out = `$prg --ssl-native --openssl-timeout=10 $check2run --jsonfile-pretty tmp.json --mx $uri`;
7979
$json = json('tmp.json');
8080
unlink 'tmp.json';
8181
@errors=eval { decode_json($json) };

t/32_isHTML_valid.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ $tests++;
5757
#2
5858
printf "%s\n", " .. running again $prg against \"$uri\", now with --debug 4 to create HTML output (may take another ~2 minutes)";
5959
# Redirect stderr to /dev/null in order to avoid some unexplained "date: invalid date" error messages
60-
$out = `TERM_WIDTH=120 $prg $check2run --debug 4 $uri 2> /dev/null`;
60+
$out = `TERM_WIDTH=120 $prg $check2run --debug 4 $uri 2>/dev/null`;
6161
$debughtml = `cat $htmlfile`;
6262
unlink $htmlfile;
6363

t/51_badssl.com.t

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use Data::Dumper;
66
use JSON;
77

88
my $tests = 0;
9+
my $prg="./testssl.sh";
910

1011
my (
1112
$out,
@@ -14,14 +15,14 @@ my (
1415
);
1516
# OK
1617
pass("Running testssl.sh against badssl.com to create a baseline (may take 2~3 minutes)"); $tests++;
17-
my $okout = `./testssl.sh -S -e --freak --logjam --drown --rc4 --sweet32 --breach --winshock --crime --jsonfile tmp.json --color 0 badssl.com`;
18+
my $okout = `$prg -S -e --freak --logjam --drown --rc4 --sweet32 --breach --winshock --crime --jsonfile tmp.json --color 0 badssl.com`;
1819
my $okjson = json('tmp.json');
1920
unlink 'tmp.json';
2021
cmp_ok(@$okjson,'>',10,"We should have more then 10 findings"); $tests++;
2122

2223
# Expiration
2324
pass("Running testssl against expired.badssl.com"); $tests++;
24-
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 expired.badssl.com`;
25+
$out = `$prg -S --jsonfile tmp.json --color 0 expired.badssl.com`;
2526
like($out, qr/Chain of trust\s+NOT ok \(expired\)/,"The chain of trust should be expired"); $tests++;
2627
like($out, qr/Certificate Validity \(UTC\)\s+expired/,"The certificate should be expired"); $tests++;
2728
$json = json('tmp.json');
@@ -39,7 +40,7 @@ is($found,1,"We should have a finding for this in the JSON output"); $tests++;
3940

4041
# Self signed and not-expired
4142
pass("Running testssl against self-signed.badssl.com"); $tests++;
42-
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 self-signed.badssl.com`;
43+
$out = `$prg -S --jsonfile tmp.json --color 0 self-signed.badssl.com`;
4344
unlike($out, qr/Certificate Validity \(UTC\)s+expired/,"The certificate should not be expired"); $tests++;
4445
$json = json('tmp.json');
4546
unlink 'tmp.json';
@@ -98,7 +99,7 @@ is($found,1,"We should have a finding for this in the JSON output"); $tests++;
9899

99100
# Incomplete chain
100101
pass("Running testssl against incomplete-chain.badssl.com"); $tests++;
101-
$out = `./testssl.sh -S --jsonfile tmp.json --color 0 incomplete-chain.badssl.com`;
102+
$out = `$prg -S --jsonfile tmp.json --color 0 incomplete-chain.badssl.com`;
102103
like($out, qr/Chain of trust.*?NOT ok\s+\(chain incomplete\)/,"Chain of trust should fail because of incomplete"); $tests++;
103104
$json = json('tmp.json');
104105
unlink 'tmp.json';

t/baseline_data/default_testssl.csvfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@
8181
"cookie_count","testssl.sh/81.169.166.184","443","INFO","0 at '/'","",""
8282
"X-Frame-Options","testssl.sh/81.169.166.184","443","OK","DENY","",""
8383
"X-Content-Type-Options","testssl.sh/81.169.166.184","443","OK","nosniff","",""
84-
"Content-Security-Policy","testssl.sh/81.169.166.184","443","OK","script-src 'unsafe-inline'; style-src 'unsafe-inline' 'self'; object-src 'self'; base-uri 'none'; form-action 'none'; img-src 'self' ; default-src 'self'; frame-ancestors 'self'; upgrade-insecure-requests;","",""
84+
"Content-Security-Policy","testssl.sh/81.169.166.184","443","OK","script-src 'unsafe-inline'; style-src 'unsafe-inline' 'self'; object-src 'self'; base-uri 'none'; form-action 'none'; img-src 'self' ; default-src 'self'; frame-ancestors 'self'; upgrade-insecure-requests; form-action 'none'","",""
8585
"Cross-Origin-Opener-Policy","testssl.sh/81.169.166.184","443","INFO","same-origin-allow-popups","",""
8686
"Cross-Origin-Resource-Policy","testssl.sh/81.169.166.184","443","INFO","same-site","",""
87+
"Cross-Origin-Embedder-Policy","testssl.sh/81.169.166.184","443","INFO","require-corp","",""
8788
"banner_reverseproxy","testssl.sh/81.169.166.184","443","INFO","--","","CWE-200"
8889
"heartbleed","testssl.sh/81.169.166.184","443","OK","not vulnerable, no heartbeat extension","CVE-2014-0160","CWE-119"
8990
"CCS","testssl.sh/81.169.166.184","443","OK","not vulnerable","CVE-2014-0224","CWE-310"

0 commit comments

Comments
 (0)