contrast-agent 3.10.2 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.simplecov +5 -2
- data/ext/build_funchook.rb +13 -17
- data/ext/cs__assess_active_record_named/cs__active_record_named.c +5 -12
- data/ext/cs__assess_active_record_named/extconf.rb +3 -0
- data/ext/cs__assess_array/cs__assess_array.c +3 -5
- data/ext/cs__assess_array/extconf.rb +3 -0
- data/ext/cs__assess_basic_object/cs__assess_basic_object.c +10 -4
- data/ext/cs__assess_basic_object/extconf.rb +3 -0
- data/ext/cs__assess_fiber_track/cs__assess_fiber_track.c +4 -3
- data/ext/cs__assess_fiber_track/cs__assess_fiber_track.h +3 -3
- data/ext/cs__assess_fiber_track/extconf.rb +3 -0
- data/ext/cs__assess_hash/cs__assess_hash.c +40 -17
- data/ext/cs__assess_hash/cs__assess_hash.h +4 -6
- data/ext/cs__assess_hash/extconf.rb +3 -0
- data/ext/cs__assess_kernel/cs__assess_kernel.c +10 -8
- data/ext/cs__assess_kernel/cs__assess_kernel.h +1 -0
- data/ext/cs__assess_kernel/extconf.rb +3 -0
- data/ext/cs__assess_marshal_module/cs__assess_marshal_module.c +3 -6
- data/ext/cs__assess_marshal_module/extconf.rb +3 -0
- data/ext/cs__assess_module/cs__assess_module.c +13 -9
- data/ext/cs__assess_module/extconf.rb +3 -0
- data/ext/cs__assess_regexp/cs__assess_regexp.c +13 -9
- data/ext/cs__assess_regexp/cs__assess_regexp.h +1 -0
- data/ext/cs__assess_regexp/extconf.rb +3 -0
- data/ext/cs__assess_string/cs__assess_string.c +5 -8
- data/ext/cs__assess_string/cs__assess_string.h +2 -1
- data/ext/cs__assess_string/extconf.rb +3 -0
- data/ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c +2 -2
- data/ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.h +3 -3
- data/ext/cs__assess_string_interpolation26/extconf.rb +3 -0
- data/ext/cs__assess_yield_track/cs__assess_yield_track.h +1 -1
- data/ext/cs__assess_yield_track/extconf.rb +3 -0
- data/ext/cs__common/cs__common.c +79 -0
- data/ext/cs__common/cs__common.h +34 -0
- data/ext/cs__common/extconf.rb +9 -8
- data/ext/cs__contrast_patch/cs__contrast_patch.h +1 -6
- data/ext/cs__contrast_patch/extconf.rb +3 -0
- data/ext/cs__protect_kernel/cs__protect_kernel.c +20 -11
- data/ext/cs__protect_kernel/extconf.rb +3 -0
- data/ext/extconf_common.rb +10 -8
- data/funchook/autom4te.cache/output.0 +1 -13
- data/funchook/autom4te.cache/requests +44 -45
- data/funchook/autom4te.cache/traces.0 +0 -3
- data/funchook/config.log +378 -217
- data/funchook/config.status +23 -24
- data/funchook/configure +1 -13
- data/funchook/src/Makefile +7 -7
- data/funchook/src/config.h +2 -2
- data/funchook/src/decoder.o +0 -0
- data/funchook/src/distorm.o +0 -0
- data/funchook/src/funchook.o +0 -0
- data/funchook/src/funchook_io.o +0 -0
- data/funchook/src/funchook_syscall.o +0 -0
- data/funchook/src/funchook_unix.o +0 -0
- data/funchook/src/funchook_x86.o +0 -0
- data/funchook/src/instructions.o +0 -0
- data/funchook/src/insts.o +0 -0
- data/funchook/src/libfunchook.dylib +0 -0
- data/funchook/src/mnemonics.o +0 -0
- data/funchook/src/operands.o +0 -0
- data/funchook/src/os_func.o +0 -0
- data/funchook/src/os_func_unix.o +0 -0
- data/funchook/src/prefix.o +0 -0
- data/funchook/src/printf_base.o +0 -0
- data/funchook/src/textdefs.o +0 -0
- data/funchook/src/wstring.o +0 -0
- data/funchook/test/Makefile +2 -2
- data/funchook/test/funchook_test +0 -0
- data/funchook/test/libfunchook_test.so +0 -0
- data/funchook/test/libfunchook_test.so.dSYM/Contents/Info.plist +20 -0
- data/funchook/test/libfunchook_test.so.dSYM/Contents/Resources/DWARF/libfunchook_test.so +0 -0
- data/funchook/test/test_main.o +0 -0
- data/funchook/test/x86_64_test.o +0 -0
- data/lib/contrast.rb +1 -0
- data/lib/contrast/agent.rb +21 -15
- data/lib/contrast/agent/assess.rb +1 -2
- data/lib/contrast/agent/assess/adjusted_span.rb +3 -1
- data/lib/contrast/agent/assess/contrast_event.rb +16 -62
- data/lib/contrast/agent/assess/events/event_factory.rb +25 -0
- data/lib/contrast/agent/assess/events/source_event.rb +83 -0
- data/lib/contrast/agent/assess/insulator.rb +0 -4
- data/lib/contrast/agent/assess/policy/patcher.rb +5 -2
- data/lib/contrast/agent/assess/policy/policy_node.rb +0 -7
- data/lib/contrast/agent/assess/policy/policy_scanner.rb +1 -1
- data/lib/contrast/agent/assess/policy/preshift.rb +1 -1
- data/lib/contrast/agent/assess/policy/propagation_method.rb +65 -33
- data/lib/contrast/agent/assess/policy/propagation_node.rb +2 -1
- data/lib/contrast/agent/assess/policy/propagator.rb +1 -0
- data/lib/contrast/agent/assess/policy/propagator/match_data.rb +80 -0
- data/lib/contrast/agent/assess/policy/propagator/select.rb +35 -22
- data/lib/contrast/agent/assess/policy/propagator/split.rb +26 -6
- data/lib/contrast/agent/assess/policy/propagator/substitution.rb +2 -0
- data/lib/contrast/agent/assess/policy/rewriter_patch.rb +37 -26
- data/lib/contrast/agent/assess/policy/source_method.rb +20 -20
- data/lib/contrast/agent/assess/policy/source_node.rb +0 -15
- data/lib/contrast/agent/assess/policy/trigger_method.rb +29 -40
- data/lib/contrast/agent/assess/policy/trigger_node.rb +3 -6
- data/lib/contrast/agent/assess/policy/trigger_validation/ssrf_validator.rb +2 -31
- data/lib/contrast/agent/assess/properties.rb +5 -3
- data/lib/contrast/agent/assess/rule/base.rb +1 -5
- data/lib/contrast/agent/assess/rule/csrf/csrf_applicator.rb +2 -22
- data/lib/contrast/agent/assess/rule/csrf/csrf_watcher.rb +5 -1
- data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +2 -2
- data/lib/contrast/agent/assess/rule/redos.rb +4 -4
- data/lib/contrast/agent/assess/tag.rb +24 -14
- data/lib/contrast/agent/at_exit_hook.rb +16 -13
- data/lib/contrast/agent/class_reopener.rb +14 -4
- data/lib/contrast/agent/deadzone/policy/policy.rb +2 -2
- data/lib/contrast/agent/disable_reaction.rb +3 -4
- data/lib/contrast/agent/exclusion_matcher.rb +8 -48
- data/lib/contrast/agent/feature_state.rb +45 -75
- data/lib/contrast/agent/logger.rb +173 -0
- data/lib/contrast/agent/middleware.rb +87 -250
- data/lib/contrast/agent/module_data.rb +2 -1
- data/lib/contrast/agent/patching/policy/after_load_patch.rb +2 -1
- data/lib/contrast/agent/patching/policy/after_load_patcher.rb +21 -4
- data/lib/contrast/agent/patching/policy/method_policy.rb +3 -3
- data/lib/contrast/agent/patching/policy/module_policy.rb +0 -25
- data/lib/contrast/agent/patching/policy/patch.rb +96 -23
- data/lib/contrast/agent/patching/policy/patcher.rb +19 -19
- data/lib/contrast/agent/patching/policy/policy.rb +7 -7
- data/lib/contrast/agent/patching/policy/policy_node.rb +2 -10
- data/lib/contrast/agent/patching/policy/trigger_node.rb +1 -4
- data/lib/contrast/agent/protect/rule/base.rb +14 -33
- data/lib/contrast/agent/protect/rule/base_service.rb +3 -1
- data/lib/contrast/agent/protect/rule/cmd_injection.rb +10 -13
- data/lib/contrast/agent/protect/rule/csrf.rb +2 -1
- data/lib/contrast/agent/protect/rule/csrf/csrf_evaluator.rb +11 -14
- data/lib/contrast/agent/protect/rule/default_scanner.rb +0 -13
- data/lib/contrast/agent/protect/rule/deserialization.rb +2 -0
- data/lib/contrast/agent/protect/rule/http_method_tampering.rb +2 -2
- data/lib/contrast/agent/protect/rule/no_sqli.rb +4 -4
- data/lib/contrast/agent/protect/rule/path_traversal.rb +5 -4
- data/lib/contrast/agent/protect/rule/sqli.rb +1 -0
- data/lib/contrast/agent/protect/rule/unsafe_file_upload.rb +2 -0
- data/lib/contrast/agent/protect/rule/xss.rb +2 -0
- data/lib/contrast/agent/protect/rule/xxe.rb +10 -4
- data/lib/contrast/agent/railtie.rb +2 -8
- data/lib/contrast/agent/reaction_processor.rb +5 -5
- data/lib/contrast/agent/request.rb +9 -12
- data/lib/contrast/agent/request_context.rb +12 -14
- data/lib/contrast/agent/request_handler.rb +35 -0
- data/lib/contrast/agent/response.rb +33 -30
- data/lib/contrast/agent/rewriter.rb +22 -10
- data/lib/contrast/agent/rule_set.rb +49 -0
- data/lib/contrast/agent/scope.rb +0 -6
- data/lib/contrast/agent/service_heartbeat.rb +1 -2
- data/lib/contrast/agent/settings_state.rb +10 -74
- data/lib/contrast/agent/socket_client.rb +17 -11
- data/lib/contrast/agent/static_analysis.rb +42 -0
- data/lib/contrast/agent/thread.rb +1 -1
- data/lib/contrast/agent/tracepoint_hook.rb +1 -5
- data/lib/contrast/agent/version.rb +1 -1
- data/lib/contrast/api.rb +1 -1
- data/lib/contrast/api/decorators.rb +14 -0
- data/lib/contrast/api/decorators/application_settings.rb +37 -0
- data/lib/contrast/api/decorators/application_update.rb +66 -0
- data/lib/contrast/api/decorators/exclusion.rb +20 -0
- data/lib/contrast/api/decorators/input_analysis.rb +17 -0
- data/lib/contrast/api/decorators/server_features.rb +24 -0
- data/lib/contrast/api/speedracer.rb +27 -23
- data/lib/contrast/api/tcp_socket.rb +0 -2
- data/lib/contrast/components/agent.rb +27 -22
- data/lib/contrast/components/app_context.rb +18 -43
- data/lib/contrast/components/config.rb +7 -5
- data/lib/contrast/components/contrast_service.rb +0 -4
- data/lib/contrast/components/heap_dump.rb +12 -8
- data/lib/contrast/components/interface.rb +11 -10
- data/lib/contrast/components/logger.rb +3 -68
- data/lib/contrast/components/sampling.rb +22 -11
- data/lib/contrast/components/settings.rb +18 -5
- data/lib/contrast/config/base_configuration.rb +1 -0
- data/lib/contrast/config/default_value.rb +1 -0
- data/lib/contrast/config/protect_rule_configuration.rb +0 -14
- data/lib/contrast/extensions/framework/rails/action_controller_inheritance.rb +39 -0
- data/lib/contrast/extensions/framework/rails/active_record_named.rb +13 -8
- data/lib/contrast/extensions/ruby_core/assess.rb +1 -2
- data/lib/contrast/extensions/ruby_core/assess/assess_extension.rb +27 -22
- data/lib/contrast/extensions/ruby_core/assess/erb.rb +0 -8
- data/lib/contrast/extensions/ruby_core/assess/exec_trigger.rb +6 -8
- data/lib/contrast/extensions/ruby_core/assess/fiber.rb +88 -100
- data/lib/contrast/extensions/ruby_core/assess/hash.rb +32 -15
- data/lib/contrast/extensions/ruby_core/assess/kernel.rb +28 -27
- data/lib/contrast/extensions/ruby_core/assess/regexp.rb +74 -196
- data/lib/contrast/extensions/ruby_core/assess/string.rb +15 -7
- data/lib/contrast/extensions/ruby_core/assess/tilt_template_trigger.rb +29 -24
- data/lib/contrast/extensions/ruby_core/assess/xpath_library_trigger.rb +2 -2
- data/lib/contrast/extensions/ruby_core/eval_trigger.rb +0 -1
- data/lib/contrast/extensions/ruby_core/inventory/datastores.rb +2 -2
- data/lib/contrast/extensions/ruby_core/protect/applies_command_injection_rule.rb +9 -20
- data/lib/contrast/extensions/ruby_core/protect/applies_deserialization_rule.rb +9 -19
- data/lib/contrast/extensions/ruby_core/protect/applies_no_sqli_rule.rb +10 -27
- data/lib/contrast/extensions/ruby_core/protect/applies_path_traversal_rule.rb +13 -21
- data/lib/contrast/extensions/ruby_core/protect/applies_sqli_rule.rb +11 -23
- data/lib/contrast/extensions/ruby_core/protect/applies_xxe_rule.rb +62 -78
- data/lib/contrast/extensions/ruby_core/protect/rule_applicator.rb +50 -0
- data/lib/contrast/framework/base_support.rb +10 -0
- data/lib/contrast/framework/manager.rb +28 -2
- data/lib/contrast/framework/platform_version.rb +1 -0
- data/lib/contrast/framework/rails_support.rb +16 -0
- data/lib/contrast/framework/sinatra_support.rb +12 -2
- data/lib/contrast/framework/view_technologies_descriptor.rb +1 -0
- data/lib/contrast/tasks/service.rb +2 -8
- data/lib/contrast/utils/assess/sampling_util.rb +4 -9
- data/lib/contrast/utils/assess/tracking_util.rb +7 -1
- data/lib/contrast/utils/boolean_util.rb +2 -2
- data/lib/contrast/utils/cache.rb +0 -11
- data/lib/contrast/utils/class_util.rb +20 -1
- data/lib/contrast/utils/gemfile_reader.rb +5 -3
- data/lib/contrast/utils/hash_digest.rb +0 -4
- data/lib/contrast/utils/heap_dump_util.rb +12 -11
- data/lib/contrast/utils/invalid_configuration_util.rb +1 -1
- data/lib/contrast/utils/inventory_util.rb +2 -2
- data/lib/contrast/utils/io_util.rb +1 -11
- data/lib/contrast/utils/job_servers_running.rb +2 -2
- data/lib/contrast/utils/object_share.rb +1 -27
- data/lib/contrast/utils/os.rb +1 -25
- data/lib/contrast/utils/rack_assess_session_cookie.rb +3 -3
- data/lib/contrast/utils/rails_assess_configuration.rb +3 -3
- data/lib/contrast/utils/service_response_util.rb +27 -53
- data/lib/contrast/utils/service_sender_util.rb +9 -5
- data/lib/contrast/utils/sinatra_helper.rb +0 -6
- data/lib/contrast/utils/stack_trace_utils.rb +86 -182
- data/lib/contrast/utils/string_utils.rb +18 -2
- data/lib/contrast/utils/tag_util.rb +11 -1
- data/lib/contrast/utils/thread_tracker.rb +2 -2
- data/lib/contrast/utils/timer.rb +0 -40
- data/resources/assess/policy.json +33 -21
- data/resources/protect/policy.json +9 -9
- data/ruby-agent.gemspec +6 -3
- metadata +76 -51
- data/ext/cs__assess_regexp_track/cs__assess_regexp_track.c +0 -63
- data/ext/cs__assess_regexp_track/cs__assess_regexp_track.h +0 -29
- data/ext/cs__assess_regexp_track/extconf.rb +0 -2
- data/funchook/src/libfunchook.so +0 -0
- data/lib/contrast/agent/assess/frozen_properties.rb +0 -41
- data/lib/contrast/agent/logger_manager.rb +0 -116
- data/lib/contrast/delegators.rb +0 -9
- data/lib/contrast/delegators/application_update.rb +0 -32
- data/lib/contrast/utils/comment_range.rb +0 -19
- data/lib/contrast/utils/environment_util.rb +0 -81
- data/lib/contrast/utils/performs_logging.rb +0 -152
- data/resources/factory-bot-spec/spec_helper.rb +0 -30
- data/resources/rubocops/kernel/catch_cop.rb +0 -37
- data/resources/rubocops/kernel/require_cop.rb +0 -37
- data/resources/rubocops/kernel/require_relative_cop.rb +0 -33
- data/resources/rubocops/module/autoload_cop.rb +0 -37
- data/resources/rubocops/module/const_defined_cop.rb +0 -37
- data/resources/rubocops/module/const_get_cop.rb +0 -37
- data/resources/rubocops/module/const_set_cop.rb +0 -37
- data/resources/rubocops/module/constants_cop.rb +0 -37
- data/resources/rubocops/module/name_cop.rb +0 -37
- data/resources/rubocops/object/class_cop.rb +0 -37
- data/resources/rubocops/object/freeze_cop.rb +0 -37
- data/resources/rubocops/object/frozen_cop.rb +0 -37
- data/resources/rubocops/object/is_a_cop.rb +0 -37
- data/resources/rubocops/object/method_cop.rb +0 -37
- data/resources/rubocops/object/respond_to_cop.rb +0 -37
- data/resources/rubocops/object/singleton_class_cop.rb +0 -37
- data/resources/rubocops/regexp/spelling_cop.rb +0 -44
- data/resources/rubocops/thread/new_cop.rb +0 -39
- data/resources/ruby-spec/ancestors_spec.rb +0 -70
- data/resources/ruby-spec/modulo_spec.rb +0 -831
- data/resources/ruby-spec/parameters_spec.rb +0 -261
- data/resources/ruby-spec/ruby_spec_spec_helper.rb +0 -35
data/funchook/config.status
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#! /bin/
|
1
|
+
#! /bin/sh
|
2
2
|
# Generated by configure.
|
3
3
|
# Run this file to recreate the current configuration.
|
4
4
|
# Compiler output produced by configure, useful for debugging
|
@@ -8,7 +8,7 @@ debug=false
|
|
8
8
|
ac_cs_recheck=false
|
9
9
|
ac_cs_silent=false
|
10
10
|
|
11
|
-
SHELL=${CONFIG_SHELL-/bin/
|
11
|
+
SHELL=${CONFIG_SHELL-/bin/sh}
|
12
12
|
export SHELL
|
13
13
|
## -------------------- ##
|
14
14
|
## M4sh Initialization. ##
|
@@ -433,7 +433,7 @@ Copyright (C) 2012 Free Software Foundation, Inc.
|
|
433
433
|
This config.status script is free software; the Free Software Foundation
|
434
434
|
gives unlimited permission to copy, distribute and modify it."
|
435
435
|
|
436
|
-
ac_pwd='/
|
436
|
+
ac_pwd='/Users/donaldpropst/Projects/ruby-agent/funchook'
|
437
437
|
srcdir='.'
|
438
438
|
test -n "$AWK" || AWK=awk
|
439
439
|
# The default lists apply if the user does not specify any file.
|
@@ -512,10 +512,10 @@ if $ac_cs_silent; then
|
|
512
512
|
fi
|
513
513
|
|
514
514
|
if $ac_cs_recheck; then
|
515
|
-
set X /bin/
|
515
|
+
set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion
|
516
516
|
shift
|
517
|
-
$as_echo "running CONFIG_SHELL=/bin/
|
518
|
-
CONFIG_SHELL='/bin/
|
517
|
+
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
|
518
|
+
CONFIG_SHELL='/bin/sh'
|
519
519
|
export CONFIG_SHELL
|
520
520
|
exec "$@"
|
521
521
|
fi
|
@@ -604,24 +604,24 @@ echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
|
|
604
604
|
cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&
|
605
605
|
S["LTLIBOBJS"]=""
|
606
606
|
S["LIBOBJS"]=""
|
607
|
-
S["IF_OSX"]="
|
608
|
-
S["IF_LINUX"]=""
|
607
|
+
S["IF_OSX"]=""
|
608
|
+
S["IF_LINUX"]="#"
|
609
609
|
S["IF_WIN32"]="#"
|
610
610
|
S["PIC_CFLAGS"]="-fPIC"
|
611
611
|
S["LINK_SHARED"]="$(CC) -shared"
|
612
|
-
S["LIBFUNCHOOK_SO"]="libfunchook.
|
612
|
+
S["LIBFUNCHOOK_SO"]="libfunchook.dylib"
|
613
613
|
S["FUNCHOOK_OS"]="unix"
|
614
614
|
S["FUNCHOOK_CPU"]="x86_64"
|
615
|
-
S["host_os"]="
|
616
|
-
S["host_vendor"]="
|
615
|
+
S["host_os"]="darwin18.6.0"
|
616
|
+
S["host_vendor"]="apple"
|
617
617
|
S["host_cpu"]="x86_64"
|
618
|
-
S["host"]="x86_64-
|
619
|
-
S["build_os"]="
|
620
|
-
S["build_vendor"]="
|
618
|
+
S["host"]="x86_64-apple-darwin18.6.0"
|
619
|
+
S["build_os"]="darwin18.6.0"
|
620
|
+
S["build_vendor"]="apple"
|
621
621
|
S["build_cpu"]="x86_64"
|
622
|
-
S["build"]="x86_64-
|
623
|
-
S["EGREP"]="/bin/grep -E"
|
624
|
-
S["GREP"]="/bin/grep"
|
622
|
+
S["build"]="x86_64-apple-darwin18.6.0"
|
623
|
+
S["EGREP"]="/usr/bin/grep -E"
|
624
|
+
S["GREP"]="/usr/bin/grep"
|
625
625
|
S["CPP"]="gcc -E"
|
626
626
|
S["OBJEXT"]="o"
|
627
627
|
S["EXEEXT"]=""
|
@@ -633,10 +633,10 @@ S["CC"]="gcc"
|
|
633
633
|
S["target_alias"]=""
|
634
634
|
S["host_alias"]=""
|
635
635
|
S["build_alias"]=""
|
636
|
-
S["LIBS"]="
|
636
|
+
S["LIBS"]=""
|
637
637
|
S["ECHO_T"]=""
|
638
|
-
S["ECHO_N"]="
|
639
|
-
S["ECHO_C"]=""
|
638
|
+
S["ECHO_N"]=""
|
639
|
+
S["ECHO_C"]="\\c"
|
640
640
|
S["DEFS"]="-DHAVE_CONFIG_H"
|
641
641
|
S["mandir"]="${datarootdir}/man"
|
642
642
|
S["localedir"]="${datarootdir}/locale"
|
@@ -649,7 +649,6 @@ S["infodir"]="${datarootdir}/info"
|
|
649
649
|
S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}"
|
650
650
|
S["oldincludedir"]="/usr/include"
|
651
651
|
S["includedir"]="${prefix}/include"
|
652
|
-
S["runstatedir"]="${localstatedir}/run"
|
653
652
|
S["localstatedir"]="${prefix}/var"
|
654
653
|
S["sharedstatedir"]="${prefix}/com"
|
655
654
|
S["sysconfdir"]="${prefix}/etc"
|
@@ -668,7 +667,7 @@ S["PACKAGE_VERSION"]="0.1"
|
|
668
667
|
S["PACKAGE_TARNAME"]="funchook"
|
669
668
|
S["PACKAGE_NAME"]="funchook"
|
670
669
|
S["PATH_SEPARATOR"]=":"
|
671
|
-
S["SHELL"]="/bin/
|
670
|
+
S["SHELL"]="/bin/sh"
|
672
671
|
_ACAWK
|
673
672
|
cat >>"$ac_tmp/subs1.awk" <<_ACAWK &&
|
674
673
|
for (key in S) S_is_set[key] = 1
|
@@ -732,8 +731,8 @@ D["_GNU_SOURCE"]=" 1"
|
|
732
731
|
D["_POSIX_PTHREAD_SEMANTICS"]=" 1"
|
733
732
|
D["_TANDEM_SOURCE"]=" 1"
|
734
733
|
D["SIZEOF_VOIDP"]=" 8"
|
735
|
-
D["HAVE_DECL__SYS_NERR"]="
|
736
|
-
D["HAVE_DECL__SYS_ERRLIST"]="
|
734
|
+
D["HAVE_DECL__SYS_NERR"]=" 0"
|
735
|
+
D["HAVE_DECL__SYS_ERRLIST"]=" 0"
|
737
736
|
D["HAVE_DECL_SYS_NERR"]=" 1"
|
738
737
|
D["HAVE_DECL_SYS_ERRLIST"]=" 1"
|
739
738
|
for (key in D) D_is_set[key] = 1
|
data/funchook/configure
CHANGED
@@ -665,7 +665,6 @@ infodir
|
|
665
665
|
docdir
|
666
666
|
oldincludedir
|
667
667
|
includedir
|
668
|
-
runstatedir
|
669
668
|
localstatedir
|
670
669
|
sharedstatedir
|
671
670
|
sysconfdir
|
@@ -736,7 +735,6 @@ datadir='${datarootdir}'
|
|
736
735
|
sysconfdir='${prefix}/etc'
|
737
736
|
sharedstatedir='${prefix}/com'
|
738
737
|
localstatedir='${prefix}/var'
|
739
|
-
runstatedir='${localstatedir}/run'
|
740
738
|
includedir='${prefix}/include'
|
741
739
|
oldincludedir='/usr/include'
|
742
740
|
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
@@ -989,15 +987,6 @@ do
|
|
989
987
|
| -silent | --silent | --silen | --sile | --sil)
|
990
988
|
silent=yes ;;
|
991
989
|
|
992
|
-
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
993
|
-
| --runstate | --runstat | --runsta | --runst | --runs \
|
994
|
-
| --run | --ru | --r)
|
995
|
-
ac_prev=runstatedir ;;
|
996
|
-
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
997
|
-
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
998
|
-
| --run=* | --ru=* | --r=*)
|
999
|
-
runstatedir=$ac_optarg ;;
|
1000
|
-
|
1001
990
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
1002
991
|
ac_prev=sbindir ;;
|
1003
992
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
@@ -1135,7 +1124,7 @@ fi
|
|
1135
1124
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
1136
1125
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
1137
1126
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
1138
|
-
libdir localedir mandir
|
1127
|
+
libdir localedir mandir
|
1139
1128
|
do
|
1140
1129
|
eval ac_val=\$$ac_var
|
1141
1130
|
# Remove trailing slashes.
|
@@ -1288,7 +1277,6 @@ Fine tuning of the installation directories:
|
|
1288
1277
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
1289
1278
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
1290
1279
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
1291
|
-
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
1292
1280
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
1293
1281
|
--includedir=DIR C header files [PREFIX/include]
|
1294
1282
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
data/funchook/src/Makefile
CHANGED
@@ -7,11 +7,11 @@ VPATH = $(DISTORM3_DIR)/src:$(top_srcdir)/include
|
|
7
7
|
|
8
8
|
CC = gcc
|
9
9
|
CFLAGS = -g -O2 -Wall -fvisibility=hidden -fPIC -g -I. -I$(top_srcdir)/include -I$(DISTORM3_DIR)/include
|
10
|
-
LIBS =
|
10
|
+
LIBS =
|
11
11
|
LINK_SHARED = $(CC) -shared
|
12
12
|
|
13
13
|
#LIBS += -lpsapi
|
14
|
-
|
14
|
+
LDFLAGS += -install_name @rpath/libfunchook.dylib
|
15
15
|
|
16
16
|
FUNCHOOK_OBJS = \
|
17
17
|
os_func.o \
|
@@ -22,8 +22,8 @@ FUNCHOOK_OBJS = \
|
|
22
22
|
funchook_x86.o \
|
23
23
|
funchook_unix.o
|
24
24
|
|
25
|
-
FUNCHOOK_OBJS += funchook_syscall.o
|
26
25
|
#FUNCHOOK_OBJS += funchook_syscall.o
|
26
|
+
FUNCHOOK_OBJS += funchook_syscall.o
|
27
27
|
|
28
28
|
DISTORM3_OBJS = \
|
29
29
|
mnemonics.o \
|
@@ -43,13 +43,13 @@ HEADERS = \
|
|
43
43
|
|
44
44
|
OBJS = $(FUNCHOOK_OBJS) $(DISTORM3_OBJS)
|
45
45
|
|
46
|
-
all: libfunchook.
|
46
|
+
all: libfunchook.dylib
|
47
47
|
|
48
48
|
check:
|
49
49
|
cd ../test && $(MAKE) check
|
50
50
|
|
51
|
-
libfunchook.
|
52
|
-
$(LINK_SHARED) $(LDFLAGS) -o libfunchook.
|
51
|
+
libfunchook.dylib: $(OBJS)
|
52
|
+
$(LINK_SHARED) $(LDFLAGS) -o libfunchook.dylib $(OBJS) $(LIBS)
|
53
53
|
|
54
54
|
funchook.o: funchook.c $(HEADERS)
|
55
55
|
funchook_linux.o: funchook_linux.c $(HEADERS)
|
@@ -64,7 +64,7 @@ insts.o: insts.c
|
|
64
64
|
$(CC) $(CFLAGS) -c -o $@ $< -Wno-missing-braces
|
65
65
|
|
66
66
|
clean:
|
67
|
-
$(RM) libfunchook.
|
67
|
+
$(RM) libfunchook.dylib $(OBJS)
|
68
68
|
|
69
69
|
Makefile config.h: $(srcdir)/Makefile.in $(srcdir)/config.h.in $(top_builddir)/config.status
|
70
70
|
cd $(top_builddir) && ./config.status
|
data/funchook/src/config.h
CHANGED
@@ -11,11 +11,11 @@
|
|
11
11
|
|
12
12
|
/* Define to 1 if you have the declaration of `_sys_errlist', and to 0 if you
|
13
13
|
don't. */
|
14
|
-
#define HAVE_DECL__SYS_ERRLIST
|
14
|
+
#define HAVE_DECL__SYS_ERRLIST 0
|
15
15
|
|
16
16
|
/* Define to 1 if you have the declaration of `_sys_nerr', and to 0 if you
|
17
17
|
don't. */
|
18
|
-
#define HAVE_DECL__SYS_NERR
|
18
|
+
#define HAVE_DECL__SYS_NERR 0
|
19
19
|
|
20
20
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
21
21
|
#define HAVE_INTTYPES_H 1
|
data/funchook/src/decoder.o
CHANGED
Binary file
|
data/funchook/src/distorm.o
CHANGED
Binary file
|
data/funchook/src/funchook.o
CHANGED
Binary file
|
data/funchook/src/funchook_io.o
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/funchook/src/funchook_x86.o
CHANGED
Binary file
|
data/funchook/src/instructions.o
CHANGED
Binary file
|
data/funchook/src/insts.o
CHANGED
Binary file
|
Binary file
|
data/funchook/src/mnemonics.o
CHANGED
Binary file
|
data/funchook/src/operands.o
CHANGED
Binary file
|
data/funchook/src/os_func.o
CHANGED
Binary file
|
data/funchook/src/os_func_unix.o
CHANGED
Binary file
|
data/funchook/src/prefix.o
CHANGED
Binary file
|
data/funchook/src/printf_base.o
CHANGED
Binary file
|
data/funchook/src/textdefs.o
CHANGED
Binary file
|
data/funchook/src/wstring.o
CHANGED
Binary file
|
data/funchook/test/Makefile
CHANGED
@@ -14,7 +14,7 @@ DLLTOOL = $(firstword $(CC:gcc=dlltool))
|
|
14
14
|
SO_OBJS = $(srcdir)/libfunchook_test.c $(srcdir)/libfunchook_test2.c
|
15
15
|
#LDFLAGS += -Wl,--out-implib,funchook_test.lib
|
16
16
|
#FUNCHOOK_TEST_LIB = funchook_test_exe.lib
|
17
|
-
|
17
|
+
LDFLAGS += -Wl,-undefined,dynamic_lookup
|
18
18
|
|
19
19
|
VPATH = ../src
|
20
20
|
|
@@ -24,7 +24,7 @@ test: funchook_test$(EXEEXT)
|
|
24
24
|
# cmp -s $(top_builddir)/src/funchook.dll funchook.dll || cp $(top_builddir)/src/funchook.dll funchook.dll
|
25
25
|
./funchook_test$(EXEEXT)
|
26
26
|
|
27
|
-
funchook_test$(EXEEXT): $(OBJS) libfunchook.
|
27
|
+
funchook_test$(EXEEXT): $(OBJS) libfunchook.dylib libfunchook_test.so
|
28
28
|
$(CC) -o funchook_test$(EXEEXT) $(OBJS) $(LIBS)
|
29
29
|
|
30
30
|
libfunchook_test.so: $(SO_OBJS) $(FUNCHOOK_TEST_LIB)
|
data/funchook/test/funchook_test
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
6
|
+
<string>English</string>
|
7
|
+
<key>CFBundleIdentifier</key>
|
8
|
+
<string>com.apple.xcode.dsym.libfunchook_test.so</string>
|
9
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
10
|
+
<string>6.0</string>
|
11
|
+
<key>CFBundlePackageType</key>
|
12
|
+
<string>dSYM</string>
|
13
|
+
<key>CFBundleSignature</key>
|
14
|
+
<string>????</string>
|
15
|
+
<key>CFBundleShortVersionString</key>
|
16
|
+
<string>1.0</string>
|
17
|
+
<key>CFBundleVersion</key>
|
18
|
+
<string>1</string>
|
19
|
+
</dict>
|
20
|
+
</plist>
|
Binary file
|
data/funchook/test/test_main.o
CHANGED
Binary file
|
data/funchook/test/x86_64_test.o
CHANGED
Binary file
|
data/lib/contrast.rb
CHANGED
data/lib/contrast/agent.rb
CHANGED
@@ -3,11 +3,25 @@
|
|
3
3
|
|
4
4
|
cs__scoped_require 'English'
|
5
5
|
|
6
|
+
# Config interface, also cruft around logger interfaces etc.
|
7
|
+
# this comes early bc legacy.
|
8
|
+
cs__scoped_require 'contrast/agent/feature_state'
|
9
|
+
|
6
10
|
# This must precede other Contrast C extensions
|
7
11
|
cs__scoped_require 'cs__common/cs__common'
|
8
12
|
|
13
|
+
# defining instrumentation, this must precede core extensions
|
14
|
+
# because they need to register their patches
|
15
|
+
cs__scoped_require 'contrast/agent/patching/policy/patcher'
|
16
|
+
cs__scoped_require 'contrast/agent/patching/policy/patch'
|
17
|
+
|
18
|
+
# core extensions
|
19
|
+
cs__scoped_require 'contrast/extensions/ruby_core/assess'
|
9
20
|
cs__scoped_require 'contrast/extensions/ruby_core/delegator'
|
21
|
+
cs__scoped_require 'contrast/extensions/ruby_core/inventory'
|
10
22
|
cs__scoped_require 'contrast/extensions/ruby_core/module'
|
23
|
+
cs__scoped_require 'contrast/extensions/ruby_core/protect'
|
24
|
+
cs__scoped_require 'contrast/extensions/ruby_core/protect/kernel'
|
11
25
|
|
12
26
|
cs__scoped_require 'contrast/utils/object_share'
|
13
27
|
cs__scoped_require 'contrast/utils/boolean_util'
|
@@ -20,20 +34,11 @@ cs__scoped_require 'contrast/common_agent_configuration'
|
|
20
34
|
cs__scoped_require 'contrast/utils/hash_digest'
|
21
35
|
cs__scoped_require 'contrast/utils/invalid_configuration_util'
|
22
36
|
|
23
|
-
cs__scoped_require 'contrast/utils/cache'
|
24
|
-
|
25
37
|
# scoping
|
26
38
|
cs__scoped_require 'contrast/agent/scope'
|
27
39
|
|
28
40
|
cs__scoped_require 'contrast/utils/thread_tracker'
|
29
41
|
|
30
|
-
cs__scoped_require 'contrast/api'
|
31
|
-
|
32
|
-
cs__scoped_require 'contrast/utils/resource_loader'
|
33
|
-
cs__scoped_require 'contrast/utils/duck_utils'
|
34
|
-
cs__scoped_require 'contrast/agent/tracepoint_hook'
|
35
|
-
cs__scoped_require 'contrast/agent/at_exit_hook'
|
36
|
-
|
37
42
|
# Framework support
|
38
43
|
cs__scoped_require 'contrast/framework/manager'
|
39
44
|
|
@@ -50,16 +55,17 @@ module Contrast
|
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
53
|
-
|
54
|
-
|
58
|
+
cs__scoped_require 'contrast/api'
|
59
|
+
|
60
|
+
cs__scoped_require 'contrast/utils/resource_loader'
|
61
|
+
cs__scoped_require 'contrast/utils/duck_utils'
|
62
|
+
cs__scoped_require 'contrast/agent/tracepoint_hook'
|
63
|
+
cs__scoped_require 'contrast/agent/at_exit_hook'
|
55
64
|
|
56
65
|
# communication with contrast service
|
57
66
|
cs__scoped_require 'contrast/agent/exclusion_matcher'
|
58
67
|
cs__scoped_require 'contrast/agent/socket_client'
|
59
68
|
|
60
|
-
# config interface
|
61
|
-
cs__scoped_require 'contrast/agent/feature_state'
|
62
|
-
|
63
69
|
# threads that handle contrast scope
|
64
70
|
cs__scoped_require 'contrast/agent/thread'
|
65
71
|
|
@@ -72,7 +78,7 @@ cs__scoped_require 'contrast/agent/assess'
|
|
72
78
|
# These happen regardless of analysis mode, & should be lightweight.
|
73
79
|
cs__scoped_require 'contrast/utils/rack_assess_session_cookie'
|
74
80
|
cs__scoped_require 'contrast/utils/rails_assess_configuration'
|
75
|
-
|
81
|
+
|
76
82
|
# In Rails, session configuration occurs extremely early & only once.
|
77
83
|
# If we defer our patching of the rails session configuration too long
|
78
84
|
# (i.e., where we normally patch) we will miss the configuration
|
@@ -36,9 +36,8 @@ module Contrast
|
|
36
36
|
# reporting / tracking
|
37
37
|
cs__scoped_require 'contrast/agent/assess/insulator'
|
38
38
|
cs__scoped_require 'contrast/agent/assess/properties'
|
39
|
-
cs__scoped_require 'contrast/agent/assess/frozen_properties'
|
40
39
|
cs__scoped_require 'contrast/agent/assess/tag'
|
41
|
-
cs__scoped_require 'contrast/agent/assess/
|
40
|
+
cs__scoped_require 'contrast/agent/assess/events/event_factory'
|
42
41
|
end
|
43
42
|
end
|
44
43
|
end
|
@@ -14,7 +14,9 @@ module Contrast
|
|
14
14
|
# Note: Unlike ranges, it is assumed that the stop
|
15
15
|
# value is exclusive, not inclusive. [start, end)
|
16
16
|
class AdjustedSpan
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :stop
|
18
|
+
attr_reader :start
|
19
|
+
|
18
20
|
def initialize start = nil, stop = nil
|
19
21
|
@start = start if start
|
20
22
|
@stop = stop if stop
|
@@ -1,8 +1,14 @@
|
|
1
1
|
# Copyright (c) 2020 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
cs__scoped_require 'contrast/utils/assess/tracking_util'
|
4
5
|
cs__scoped_require 'contrast/utils/class_util'
|
6
|
+
cs__scoped_require 'contrast/utils/duck_utils'
|
7
|
+
cs__scoped_require 'contrast/utils/object_share'
|
5
8
|
cs__scoped_require 'contrast/utils/prevent_serialization'
|
9
|
+
cs__scoped_require 'contrast/utils/stack_trace_utils'
|
10
|
+
cs__scoped_require 'contrast/utils/string_utils'
|
11
|
+
cs__scoped_require 'contrast/utils/timer'
|
6
12
|
|
7
13
|
module Contrast
|
8
14
|
module Agent
|
@@ -53,8 +59,7 @@ module Contrast
|
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
56
|
-
|
57
|
-
attr_reader :event_id, :source_type, :parent_ids
|
62
|
+
attr_reader :event_id, :parent_ids
|
58
63
|
|
59
64
|
# We need this to track the parent id's of events to build up a flow
|
60
65
|
# chart of the finding
|
@@ -69,13 +74,13 @@ module Contrast
|
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
72
|
-
def initialize policy_node, tagged, object, ret, args
|
73
|
-
@caller = caller_locations(get_call_start(policy_node, invoked), 10)
|
77
|
+
def initialize policy_node, tagged, object, ret, args
|
74
78
|
@policy_node = policy_node
|
79
|
+
# so long as this event is built in a factory, we know Contrast Code
|
80
|
+
# will be the first three events
|
81
|
+
@caller = caller(3, 20)
|
75
82
|
@time = Contrast::Utils::Timer.now_ms
|
76
83
|
@thread = Thread.current.object_id
|
77
|
-
@source_type = source_type
|
78
|
-
@source_name = source_name
|
79
84
|
|
80
85
|
# These methods rely on the above being set. Don't move them!
|
81
86
|
@event_id = Contrast::Agent::Assess::ContrastEvent.next_atomic_id
|
@@ -86,8 +91,6 @@ module Contrast
|
|
86
91
|
# Parent IDs are the event ids of all the sources of this event which
|
87
92
|
# were tracked prior to this event occurring
|
88
93
|
def find_parent_ids policy_node, object, ret, args
|
89
|
-
return if policy_node.is_a?(Contrast::Agent::Assess::Policy::SourceNode)
|
90
|
-
|
91
94
|
mapped = policy_node.sources.map do |source|
|
92
95
|
value_of_source(source, object, ret, args)
|
93
96
|
end
|
@@ -137,6 +140,8 @@ module Contrast
|
|
137
140
|
# one w/ a dup, but good enough for now. Trying not to make this too
|
138
141
|
# complicated. - HM 8/8/19
|
139
142
|
def save_target_arg target, tagged
|
143
|
+
return if @args.cs__frozen?
|
144
|
+
|
140
145
|
if target.is_a?(Integer)
|
141
146
|
@args[target] = cs__class.safe_dup(tagged)
|
142
147
|
return
|
@@ -172,27 +177,6 @@ module Contrast
|
|
172
177
|
end
|
173
178
|
end
|
174
179
|
|
175
|
-
# each policy_node has a certain number of levels down it calls
|
176
|
-
# before getting here. since we know them, we can skip
|
177
|
-
# right to the part of the stack we care about.
|
178
|
-
#
|
179
|
-
# Note: if our callstack changes, this number has to change
|
180
|
-
def get_call_start policy_node, invoked
|
181
|
-
# TODO: RUBY-440 audit these numbers to get stacktraces to render
|
182
|
-
# properly
|
183
|
-
base = case policy_node
|
184
|
-
when Contrast::Agent::Assess::Policy::SourceNode
|
185
|
-
6
|
186
|
-
when Contrast::Agent::Assess::Policy::PropagationNode
|
187
|
-
7
|
188
|
-
when Contrast::Agent::Assess::Policy::TriggerNode
|
189
|
-
7
|
190
|
-
else
|
191
|
-
2
|
192
|
-
end
|
193
|
-
base + invoked
|
194
|
-
end
|
195
|
-
|
196
180
|
# Convert this event into a DTM that TeamServer can consume
|
197
181
|
def to_dtm_event
|
198
182
|
event = Contrast::Api::Dtm::TraceEvent.new
|
@@ -220,20 +204,11 @@ module Contrast
|
|
220
204
|
end
|
221
205
|
|
222
206
|
# We delayed doing this as long as possible b/c it's expensive
|
223
|
-
stack = Contrast::Utils::StackTraceUtils.
|
224
|
-
|
225
|
-
rasp_element: false)
|
226
|
-
stack.each do |frame|
|
227
|
-
event.stack << frame
|
228
|
-
end
|
229
|
-
|
230
|
-
event.field_name = Contrast::Utils::StringUtils.force_utf8(source_name)
|
231
|
-
|
232
|
-
event_source_dtm = build_event_source_dtm
|
233
|
-
event.event_sources << event_source_dtm if event_source_dtm
|
207
|
+
stack = Contrast::Utils::StackTraceUtils.build_assess_stack_array(@caller)
|
208
|
+
event.stack += stack
|
234
209
|
|
235
210
|
event.object_id = event_id.to_i
|
236
|
-
|
211
|
+
parent_ids&.each do |id|
|
237
212
|
parent = Contrast::Api::Dtm::ParentObjectId.new
|
238
213
|
parent.id = id.to_i
|
239
214
|
event.parent_object_ids << parent
|
@@ -245,27 +220,6 @@ module Contrast
|
|
245
220
|
event
|
246
221
|
end
|
247
222
|
|
248
|
-
def forced_source_type
|
249
|
-
@_forced_source_type ||= Contrast::Utils::StringUtils.force_utf8(source_type)
|
250
|
-
end
|
251
|
-
|
252
|
-
def forced_source_name
|
253
|
-
@_forced_source_name ||= Contrast::Utils::StringUtils.force_utf8(source_name)
|
254
|
-
end
|
255
|
-
|
256
|
-
# Probably only for source events, but we'll go
|
257
|
-
# with source_type instead. java & .net support source_type
|
258
|
-
# in propagation events, so we'll future proof this
|
259
|
-
def build_event_source_dtm
|
260
|
-
# You can have a source w/o a name, but not w/o a type
|
261
|
-
return unless source_type
|
262
|
-
|
263
|
-
dtm = Contrast::Api::Dtm::TraceEventSource.new
|
264
|
-
dtm.type = forced_source_type
|
265
|
-
dtm.name = forced_source_name
|
266
|
-
dtm
|
267
|
-
end
|
268
|
-
|
269
223
|
# We're not going to build the signature string here, b/c we have all
|
270
224
|
# the composite pieces of it. Instead, we're going to let TeamServer
|
271
225
|
# render this for us.
|