@@ -19,12 +19,12 @@ describe('changeHistory', () => {
19
19
it ( 'removes URI having Mongo from history' , ( ) => {
20
20
const i = [ 'm = new Mongo(\'mongodb://anna:[email protected] :27017/test\')' , 'db.shipwrecks.findOne()' , 'use ships' ] ;
21
21
changeHistory ( i ) ;
22
- expect ( i ) . to . deep . equal ( [ 'm = new Mongo(\'mongodb://<credentials>@127.0.0.1:27017/test\')' ] . concat ( history ) ) ;
22
+ expect ( i ) . to . deep . equal ( history ) ;
23
23
} ) ;
24
24
it ( 'removes URI having Mongo from history for srv' , ( ) => {
25
25
const i = [ 'm = new Mongo(\'mongodb+srv://admin:[email protected] /admin\')' , 'db.shipwrecks.findOne()' , 'use ships' ] ;
26
26
changeHistory ( i ) ;
27
- expect ( i ) . to . deep . equal ( [ 'm = new Mongo(\'mongodb+srv://admin:[email protected] /admin\')' ] . concat ( history ) ) ;
27
+ expect ( i ) . to . deep . equal ( history ) ;
28
28
} ) ;
29
29
30
30
it ( 'leaves history as is if command is not sensitive' , ( ) => {
@@ -57,6 +57,12 @@ describe('changeHistory', () => {
57
57
expect ( i ) . to . deep . equal ( history ) ;
58
58
} ) ;
59
59
60
+ it ( 'removes sensitive raw commands from history' , ( ) => {
61
+ const i = [ 'db.runCommand({createUser: "reportUser256", pwd: "pwd", roles: {] })' , 'db.shipwrecks.findOne()' , 'use ships' ] ;
62
+ changeHistory ( i , true ) ;
63
+ expect ( i ) . to . deep . equal ( history ) ;
64
+ } ) ;
65
+
60
66
it ( 'leaves history as is if command is not sensitive' , ( ) => {
61
67
const i = [ 'db.shipwrecks.find({quasou: "depth unknown"})' , 'db.shipwrecks.findOne()' , 'use ships' ] ;
62
68
const cloned = Array . from ( i ) ;
0 commit comments