Skip to content

Commit 46b678e

Browse files
committed
Add msftidy check for datastore option DEBUG usage
1 parent ab94f15 commit 46b678e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tools/msftidy.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,21 @@ def check_print_debug
613613
# Check for modules registering the DEBUG datastore option
614614
#
615615
# @see https://github.com/rapid7/metasploit-framework/issues/3816
616-
def check_datastore_debug
616+
def check_register_datastore_debug
617617
if @source =~ /Opt.*\.new\(["'](?i)DEBUG(?-i)["']/
618618
error('Please don\'t register a DEBUG datastore option, it has an special meaning and is used for development')
619619
end
620620
end
621621

622+
# Check for modules using the DEBUG datastore option
623+
#
624+
# @see https://github.com/rapid7/metasploit-framework/issues/3816
625+
def check_use_datastore_debug
626+
if @source =~ /datastore\[["'](?i)DEBUG(?-i)["']\]/
627+
error('Please don\'t use the DEBUG datastore option in production, it has an special meaning and is used for development')
628+
end
629+
end
630+
622631
private
623632

624633
def load_file(file)
@@ -669,7 +678,8 @@ def run_checks(full_filepath)
669678
tidy.check_udp_sock_get
670679
tidy.check_invalid_url_scheme
671680
tidy.check_print_debug
672-
tidy.check_datastore_debug
681+
tidy.check_register_datastore_debug
682+
tidy.check_use_datastore_debug
673683
return tidy
674684
end
675685

0 commit comments

Comments
 (0)