File tree Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1919 "htmlparser2" : " ^7.1.2" ,
2020 "lint" : " ^0.7.0" ,
2121 "node-fetch" : " ^2.6.0" ,
22+ "ssl-checker" : " ^2.0.7" ,
2223 "uglify-js" : " ^3.6.1" ,
2324 "xml2js" : " ^0.4.22"
2425 },
Original file line number Diff line number Diff line change 1+ import sslChecker from 'ssl-checker' ;
2+ import Test , { TestParameters , Result } from '../Test' ;
3+ import logger from '../logger' ;
4+
5+ class SSL extends Test {
6+ public name = 'SSL' ;
7+
8+ public async test ( { url } : TestParameters ) : Promise < Result > {
9+ logger . info ( 'Starting SSL test...' ) ;
10+ const hostname = ( new URL ( url ) ) . hostname ;
11+ const sslDetails = await sslChecker ( hostname ) ;
12+
13+ if ( ! sslDetails . valid ) {
14+ return {
15+ status : 'ERROR' ,
16+ title : this . name ,
17+ description : 'SSL certificate is not valid!' ,
18+ } ;
19+ }
20+
21+ if ( sslDetails . daysRemaining <= 7 ) {
22+ return {
23+ status : 'WARNING' ,
24+ title : this . name ,
25+ description : 'SSL certificate is valid for 7 or less days!' ,
26+ } ;
27+ }
28+
29+ return {
30+ status : 'SUCCESS' ,
31+ title : this . name ,
32+ description : `SSL certificate is valid until ${ sslDetails . validTo } .` ,
33+ } ;
34+ }
35+ }
36+
37+ export default SSL ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Cookies from './Cookies';
1111import ReferrerPolicy from './ReferrerPolicy' ;
1212import RobotsTXT from './RobotsTXT' ;
1313import PermissionsPolicy from './PermissionsPolicy' ;
14+ import SSL from './SSL' ;
1415
1516export default class Security extends Test {
1617 public name = 'Security' ;
@@ -30,6 +31,7 @@ export default class Security extends Test {
3031 new HTTPVersion ( ) ,
3132 new ContentEncoding ( ) ,
3233 new RobotsTXT ( ) ,
34+ new SSL ( ) ,
3335 ] ;
3436 }
3537
Original file line number Diff line number Diff line change @@ -3338,6 +3338,11 @@ sshpk@^1.7.0:
33383338 safer-buffer "^2.0.2"
33393339 tweetnacl "~0.14.0"
33403340
3341+ ssl-checker@^2.0.7 :
3342+ version "2.0.7"
3343+ resolved "https://registry.yarnpkg.com/ssl-checker/-/ssl-checker-2.0.7.tgz#031feef44a0b53bd22a29bdad0687f69fb262e9a"
3344+ integrity sha512-/fc379/SD4Ov5zWM2heUAZIHTijW45tD33BPCXU+FLhP4TGD8LHm5HbMYqvy/Hwzxv3RmXXqxC8ahlv0rKv0MA==
3345+
33413346stack-utils@^2.0.3 :
33423347 version "2.0.5"
33433348 resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5"
You can’t perform that action at this time.
0 commit comments