contrast-agent 3.11.0 → 3.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/.flayignore +1 -0
  3. data/ext/cs__assess_active_record_named/cs__active_record_named.c +7 -2
  4. data/ext/cs__assess_active_record_named/cs__active_record_named.h +1 -0
  5. data/ext/cs__assess_array/cs__assess_array.c +2 -1
  6. data/ext/cs__assess_array/cs__assess_array.h +1 -0
  7. data/ext/cs__assess_basic_object/cs__assess_basic_object.c +3 -7
  8. data/ext/cs__assess_basic_object/cs__assess_basic_object.h +2 -1
  9. data/ext/cs__assess_kernel/cs__assess_kernel.c +1 -1
  10. data/ext/cs__assess_module/cs__assess_module.c +5 -7
  11. data/ext/cs__assess_module/cs__assess_module.h +3 -0
  12. data/ext/cs__common/cs__common.c +1 -1
  13. data/ext/cs__protect_kernel/cs__protect_kernel.c +4 -2
  14. data/ext/cs__protect_kernel/cs__protect_kernel.h +1 -0
  15. data/funchook/autom4te.cache/output.0 +13 -1
  16. data/funchook/autom4te.cache/requests +49 -48
  17. data/funchook/autom4te.cache/traces.0 +3 -0
  18. data/funchook/config.log +217 -378
  19. data/funchook/config.status +24 -23
  20. data/funchook/configure +13 -1
  21. data/funchook/src/Makefile +7 -7
  22. data/funchook/src/config.h +2 -2
  23. data/funchook/src/decoder.o +0 -0
  24. data/funchook/src/distorm.o +0 -0
  25. data/funchook/src/funchook.o +0 -0
  26. data/funchook/src/funchook_io.o +0 -0
  27. data/funchook/src/funchook_syscall.o +0 -0
  28. data/funchook/src/funchook_unix.o +0 -0
  29. data/funchook/src/funchook_x86.o +0 -0
  30. data/funchook/src/instructions.o +0 -0
  31. data/funchook/src/insts.o +0 -0
  32. data/funchook/src/libfunchook.so +0 -0
  33. data/funchook/src/mnemonics.o +0 -0
  34. data/funchook/src/operands.o +0 -0
  35. data/funchook/src/os_func.o +0 -0
  36. data/funchook/src/os_func_unix.o +0 -0
  37. data/funchook/src/prefix.o +0 -0
  38. data/funchook/src/printf_base.o +0 -0
  39. data/funchook/src/textdefs.o +0 -0
  40. data/funchook/src/wstring.o +0 -0
  41. data/funchook/test/Makefile +2 -2
  42. data/funchook/test/funchook_test +0 -0
  43. data/funchook/test/libfunchook_test.so +0 -0
  44. data/funchook/test/test_main.o +0 -0
  45. data/funchook/test/x86_64_test.o +0 -0
  46. data/lib/contrast.rb +0 -1
  47. data/lib/contrast/agent.rb +19 -22
  48. data/lib/contrast/agent/assess.rb +0 -9
  49. data/lib/contrast/agent/assess/policy/patcher.rb +1 -0
  50. data/lib/contrast/agent/assess/policy/policy_node.rb +1 -1
  51. data/lib/contrast/agent/assess/policy/policy_scanner.rb +1 -1
  52. data/lib/contrast/agent/assess/policy/propagation_method.rb +3 -0
  53. data/lib/contrast/agent/assess/policy/propagator/custom.rb +1 -1
  54. data/lib/contrast/agent/assess/policy/propagator/database_write.rb +1 -3
  55. data/lib/contrast/agent/assess/policy/trigger/reflected_xss.rb +90 -0
  56. data/lib/contrast/agent/assess/policy/trigger/xpath.rb +57 -0
  57. data/lib/contrast/agent/assess/policy/trigger_method.rb +3 -7
  58. data/lib/contrast/agent/assess/policy/trigger_node.rb +4 -1
  59. data/lib/contrast/agent/assess/rule/base.rb +0 -15
  60. data/lib/contrast/agent/assess/rule/provider/hardcoded_value_rule.rb +22 -5
  61. data/lib/contrast/agent/assess/rule/redos.rb +0 -1
  62. data/lib/contrast/agent/at_exit_hook.rb +2 -2
  63. data/lib/contrast/agent/class_reopener.rb +9 -4
  64. data/lib/contrast/agent/exclusion_matcher.rb +0 -1
  65. data/lib/contrast/agent/inventory/policy/datastores.rb +54 -0
  66. data/lib/contrast/agent/inventory/policy/policy.rb +1 -1
  67. data/lib/contrast/agent/middleware.rb +38 -34
  68. data/lib/contrast/agent/patching/policy/after_load_patch.rb +11 -2
  69. data/lib/contrast/agent/patching/policy/after_load_patcher.rb +51 -56
  70. data/lib/contrast/agent/patching/policy/patch.rb +2 -1
  71. data/lib/contrast/agent/patching/policy/patcher.rb +10 -12
  72. data/lib/contrast/agent/patching/policy/policy_node.rb +1 -1
  73. data/lib/contrast/agent/patching/policy/trigger_node.rb +1 -1
  74. data/lib/contrast/agent/protect/policy/applies_command_injection_rule.rb +63 -0
  75. data/lib/contrast/agent/protect/policy/applies_deserialization_rule.rb +52 -0
  76. data/lib/contrast/agent/protect/policy/applies_no_sqli_rule.rb +68 -0
  77. data/lib/contrast/agent/protect/policy/applies_path_traversal_rule.rb +117 -0
  78. data/lib/contrast/agent/protect/policy/applies_sqli_rule.rb +54 -0
  79. data/lib/contrast/agent/protect/policy/applies_xxe_rule.rb +129 -0
  80. data/lib/contrast/agent/protect/policy/policy.rb +6 -6
  81. data/lib/contrast/agent/protect/policy/rule_applicator.rb +51 -0
  82. data/lib/contrast/agent/protect/rule.rb +0 -5
  83. data/lib/contrast/agent/protect/rule/base.rb +6 -5
  84. data/lib/contrast/agent/protect/rule/cmd_injection.rb +3 -3
  85. data/lib/contrast/agent/protect/rule/path_traversal.rb +2 -7
  86. data/lib/contrast/agent/protect/rule/sqli.rb +4 -4
  87. data/lib/contrast/agent/railtie.rb +1 -0
  88. data/lib/contrast/agent/request.rb +2 -6
  89. data/lib/contrast/agent/request_context.rb +5 -6
  90. data/lib/contrast/agent/request_handler.rb +2 -2
  91. data/lib/contrast/agent/response.rb +0 -69
  92. data/lib/contrast/agent/service_heartbeat.rb +2 -2
  93. data/lib/contrast/agent/socket_client.rb +8 -8
  94. data/lib/contrast/agent/static_analysis.rb +2 -3
  95. data/lib/contrast/agent/version.rb +1 -1
  96. data/lib/contrast/api/decorators/application_settings.rb +1 -1
  97. data/lib/contrast/api/speedracer.rb +1 -1
  98. data/lib/contrast/components/agent.rb +17 -12
  99. data/lib/contrast/components/app_context.rb +33 -1
  100. data/lib/contrast/components/assess.rb +25 -15
  101. data/lib/contrast/components/contrast_service.rb +23 -67
  102. data/lib/contrast/components/interface.rb +4 -12
  103. data/lib/contrast/components/inventory.rb +5 -1
  104. data/lib/contrast/components/logger.rb +2 -2
  105. data/lib/contrast/components/protect.rb +40 -4
  106. data/lib/contrast/components/scope.rb +2 -52
  107. data/lib/contrast/components/settings.rb +24 -18
  108. data/lib/contrast/config/protect_rules_configuration.rb +0 -1
  109. data/lib/contrast/{extensions/ruby_core → extension}/assess.rb +12 -14
  110. data/lib/contrast/extension/assess/array.rb +77 -0
  111. data/lib/contrast/{extensions/ruby_core → extension}/assess/assess_extension.rb +2 -2
  112. data/lib/contrast/{extensions/ruby_core → extension}/assess/erb.rb +0 -0
  113. data/lib/contrast/extension/assess/eval_trigger.rb +78 -0
  114. data/lib/contrast/{extensions/ruby_core → extension}/assess/exec_trigger.rb +1 -1
  115. data/lib/contrast/{extensions/ruby_core → extension}/assess/fiber.rb +6 -5
  116. data/lib/contrast/{extensions/ruby_core → extension}/assess/hash.rb +2 -2
  117. data/lib/contrast/extension/assess/kernel.rb +110 -0
  118. data/lib/contrast/{extensions/ruby_core → extension}/assess/regexp.rb +4 -4
  119. data/lib/contrast/{extensions/ruby_core → extension}/assess/string.rb +5 -5
  120. data/lib/contrast/{extensions/ruby_core → extension}/delegator.rb +0 -0
  121. data/lib/contrast/{extensions/ruby_core → extension}/inventory.rb +2 -2
  122. data/lib/contrast/extension/kernel.rb +54 -0
  123. data/lib/contrast/{extensions/ruby_core → extension}/module.rb +0 -0
  124. data/lib/contrast/{extensions/ruby_core → extension}/protect.rb +2 -2
  125. data/lib/contrast/extension/protect/kernel.rb +44 -0
  126. data/lib/contrast/{extensions/ruby_core → extension}/protect/psych.rb +1 -1
  127. data/lib/contrast/{extensions/ruby_core → extension}/thread.rb +0 -0
  128. data/lib/contrast/framework/base_support.rb +22 -0
  129. data/lib/contrast/framework/manager.rb +33 -8
  130. data/lib/contrast/framework/rack/patch/session_cookie.rb +126 -0
  131. data/lib/contrast/framework/rack/patch/support.rb +24 -0
  132. data/lib/contrast/framework/rack/support.rb +22 -0
  133. data/lib/contrast/framework/rails/patch/action_controller_live_buffer.rb +43 -0
  134. data/lib/contrast/framework/rails/patch/assess_configuration.rb +103 -0
  135. data/lib/contrast/framework/rails/patch/rails_application_configuration.rb +31 -0
  136. data/lib/contrast/framework/rails/patch/support.rb +67 -0
  137. data/lib/contrast/framework/rails/rewrite/action_controller_railties_helper_inherited.rb +34 -0
  138. data/lib/contrast/framework/rails/rewrite/active_record_attribute_methods_read.rb +39 -0
  139. data/lib/contrast/framework/rails/rewrite/active_record_named.rb +73 -0
  140. data/lib/contrast/framework/rails/rewrite/active_record_time_zone_inherited.rb +33 -0
  141. data/lib/contrast/framework/rails/support.rb +115 -0
  142. data/lib/contrast/framework/sinatra/application_helper.rb +51 -0
  143. data/lib/contrast/framework/sinatra/patch/base.rb +83 -0
  144. data/lib/contrast/framework/sinatra/patch/support.rb +27 -0
  145. data/lib/contrast/framework/sinatra/support.rb +109 -0
  146. data/lib/contrast/logger/application.rb +80 -0
  147. data/lib/contrast/{agent/logger.rb → logger/log.rb} +23 -54
  148. data/lib/contrast/logger/time.rb +50 -0
  149. data/lib/contrast/tasks/config.rb +54 -0
  150. data/lib/contrast/tasks/service.rb +1 -5
  151. data/lib/contrast/utils/class_util.rb +1 -1
  152. data/lib/contrast/utils/gemfile_reader.rb +2 -2
  153. data/lib/contrast/utils/hash_digest.rb +2 -7
  154. data/lib/contrast/utils/invalid_configuration_util.rb +3 -3
  155. data/lib/contrast/utils/job_servers_running.rb +4 -2
  156. data/lib/contrast/utils/object_share.rb +0 -1
  157. data/lib/contrast/utils/service_response_util.rb +14 -12
  158. data/lib/contrast/utils/service_sender_util.rb +78 -21
  159. data/resources/assess/policy.json +9 -50
  160. data/resources/inventory/policy.json +2 -2
  161. data/resources/protect/policy.json +6 -6
  162. data/ruby-agent.gemspec +5 -1
  163. data/service_executables/VERSION +1 -1
  164. data/service_executables/linux/contrast-service +0 -0
  165. data/service_executables/mac/contrast-service +0 -0
  166. metadata +69 -83
  167. data/funchook/src/libfunchook.dylib +0 -0
  168. data/funchook/test/libfunchook_test.so.dSYM/Contents/Info.plist +0 -20
  169. data/funchook/test/libfunchook_test.so.dSYM/Contents/Resources/DWARF/libfunchook_test.so +0 -0
  170. data/lib/contrast/agent/assess/rule/csrf.rb +0 -66
  171. data/lib/contrast/agent/assess/rule/csrf/csrf_action.rb +0 -28
  172. data/lib/contrast/agent/assess/rule/csrf/csrf_applicator.rb +0 -53
  173. data/lib/contrast/agent/assess/rule/csrf/csrf_watcher.rb +0 -136
  174. data/lib/contrast/agent/assess/rule/response_scanning_rule.rb +0 -47
  175. data/lib/contrast/agent/assess/rule/response_watcher.rb +0 -36
  176. data/lib/contrast/agent/assess/rule/watcher.rb +0 -36
  177. data/lib/contrast/agent/feature_state.rb +0 -346
  178. data/lib/contrast/agent/protect/rule/csrf.rb +0 -119
  179. data/lib/contrast/agent/protect/rule/csrf/csrf_evaluator.rb +0 -100
  180. data/lib/contrast/agent/protect/rule/csrf/csrf_token_injector.rb +0 -85
  181. data/lib/contrast/agent/settings_state.rb +0 -88
  182. data/lib/contrast/api/decorators/exclusion.rb +0 -20
  183. data/lib/contrast/extensions/framework/rack/cookie.rb +0 -24
  184. data/lib/contrast/extensions/framework/rack/request.rb +0 -24
  185. data/lib/contrast/extensions/framework/rack/response.rb +0 -23
  186. data/lib/contrast/extensions/framework/rails/action_controller_inheritance.rb +0 -39
  187. data/lib/contrast/extensions/framework/rails/action_controller_railties_helper_inherited.rb +0 -20
  188. data/lib/contrast/extensions/framework/rails/active_record.rb +0 -26
  189. data/lib/contrast/extensions/framework/rails/active_record_named.rb +0 -58
  190. data/lib/contrast/extensions/framework/rails/active_record_time_zone_inherited.rb +0 -21
  191. data/lib/contrast/extensions/framework/rails/buffer.rb +0 -28
  192. data/lib/contrast/extensions/framework/rails/configuration.rb +0 -27
  193. data/lib/contrast/extensions/framework/sinatra/base.rb +0 -59
  194. data/lib/contrast/extensions/ruby_core/assess/array.rb +0 -59
  195. data/lib/contrast/extensions/ruby_core/assess/basic_object.rb +0 -15
  196. data/lib/contrast/extensions/ruby_core/assess/kernel.rb +0 -96
  197. data/lib/contrast/extensions/ruby_core/assess/module.rb +0 -14
  198. data/lib/contrast/extensions/ruby_core/assess/tilt_template_trigger.rb +0 -78
  199. data/lib/contrast/extensions/ruby_core/assess/xpath_library_trigger.rb +0 -40
  200. data/lib/contrast/extensions/ruby_core/eval_trigger.rb +0 -51
  201. data/lib/contrast/extensions/ruby_core/inventory/datastores.rb +0 -37
  202. data/lib/contrast/extensions/ruby_core/protect/applies_command_injection_rule.rb +0 -61
  203. data/lib/contrast/extensions/ruby_core/protect/applies_deserialization_rule.rb +0 -50
  204. data/lib/contrast/extensions/ruby_core/protect/applies_no_sqli_rule.rb +0 -66
  205. data/lib/contrast/extensions/ruby_core/protect/applies_path_traversal_rule.rb +0 -115
  206. data/lib/contrast/extensions/ruby_core/protect/applies_sqli_rule.rb +0 -53
  207. data/lib/contrast/extensions/ruby_core/protect/applies_xxe_rule.rb +0 -127
  208. data/lib/contrast/extensions/ruby_core/protect/kernel.rb +0 -30
  209. data/lib/contrast/extensions/ruby_core/protect/rule_applicator.rb +0 -50
  210. data/lib/contrast/framework/rails_support.rb +0 -104
  211. data/lib/contrast/framework/sinatra_application_helper.rb +0 -49
  212. data/lib/contrast/framework/sinatra_support.rb +0 -104
  213. data/lib/contrast/utils/data_store_util.rb +0 -23
  214. data/lib/contrast/utils/rack_assess_session_cookie.rb +0 -104
  215. data/lib/contrast/utils/rails_assess_configuration.rb +0 -95
  216. data/lib/contrast/utils/random_util.rb +0 -22
  217. data/resources/csrf/inject.js +0 -44
@@ -1,4 +1,4 @@
1
- #! /bin/sh
1
+ #! /bin/bash
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/sh}
11
+ SHELL=${CONFIG_SHELL-/bin/bash}
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='/Users/donaldpropst/Projects/ruby-agent/funchook'
436
+ ac_pwd='/opt/atlassian/pipelines/agent/build/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/sh './configure' $ac_configure_extra_args --no-create --no-recursion
515
+ set X /bin/bash './configure' $ac_configure_extra_args --no-create --no-recursion
516
516
  shift
517
- $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
518
- CONFIG_SHELL='/bin/sh'
517
+ $as_echo "running CONFIG_SHELL=/bin/bash $*" >&6
518
+ CONFIG_SHELL='/bin/bash'
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.dylib"
612
+ S["LIBFUNCHOOK_SO"]="libfunchook.so"
613
613
  S["FUNCHOOK_OS"]="unix"
614
614
  S["FUNCHOOK_CPU"]="x86_64"
615
- S["host_os"]="darwin18.6.0"
616
- S["host_vendor"]="apple"
615
+ S["host_os"]="linux-gnu"
616
+ S["host_vendor"]="unknown"
617
617
  S["host_cpu"]="x86_64"
618
- S["host"]="x86_64-apple-darwin18.6.0"
619
- S["build_os"]="darwin18.6.0"
620
- S["build_vendor"]="apple"
618
+ S["host"]="x86_64-unknown-linux-gnu"
619
+ S["build_os"]="linux-gnu"
620
+ S["build_vendor"]="unknown"
621
621
  S["build_cpu"]="x86_64"
622
- S["build"]="x86_64-apple-darwin18.6.0"
623
- S["EGREP"]="/usr/bin/grep -E"
624
- S["GREP"]="/usr/bin/grep"
622
+ S["build"]="x86_64-unknown-linux-gnu"
623
+ S["EGREP"]="/bin/grep -E"
624
+ S["GREP"]="/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"]="-ldl"
637
637
  S["ECHO_T"]=""
638
- S["ECHO_N"]=""
639
- S["ECHO_C"]="\\c"
638
+ S["ECHO_N"]="-n"
639
+ S["ECHO_C"]=""
640
640
  S["DEFS"]="-DHAVE_CONFIG_H"
641
641
  S["mandir"]="${datarootdir}/man"
642
642
  S["localedir"]="${datarootdir}/locale"
@@ -649,6 +649,7 @@ 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"
652
653
  S["localstatedir"]="${prefix}/var"
653
654
  S["sharedstatedir"]="${prefix}/com"
654
655
  S["sysconfdir"]="${prefix}/etc"
@@ -667,7 +668,7 @@ S["PACKAGE_VERSION"]="0.1"
667
668
  S["PACKAGE_TARNAME"]="funchook"
668
669
  S["PACKAGE_NAME"]="funchook"
669
670
  S["PATH_SEPARATOR"]=":"
670
- S["SHELL"]="/bin/sh"
671
+ S["SHELL"]="/bin/bash"
671
672
  _ACAWK
672
673
  cat >>"$ac_tmp/subs1.awk" <<_ACAWK &&
673
674
  for (key in S) S_is_set[key] = 1
@@ -731,8 +732,8 @@ D["_GNU_SOURCE"]=" 1"
731
732
  D["_POSIX_PTHREAD_SEMANTICS"]=" 1"
732
733
  D["_TANDEM_SOURCE"]=" 1"
733
734
  D["SIZEOF_VOIDP"]=" 8"
734
- D["HAVE_DECL__SYS_NERR"]=" 0"
735
- D["HAVE_DECL__SYS_ERRLIST"]=" 0"
735
+ D["HAVE_DECL__SYS_NERR"]=" 1"
736
+ D["HAVE_DECL__SYS_ERRLIST"]=" 1"
736
737
  D["HAVE_DECL_SYS_NERR"]=" 1"
737
738
  D["HAVE_DECL_SYS_ERRLIST"]=" 1"
738
739
  for (key in D) D_is_set[key] = 1
@@ -665,6 +665,7 @@ infodir
665
665
  docdir
666
666
  oldincludedir
667
667
  includedir
668
+ runstatedir
668
669
  localstatedir
669
670
  sharedstatedir
670
671
  sysconfdir
@@ -735,6 +736,7 @@ datadir='${datarootdir}'
735
736
  sysconfdir='${prefix}/etc'
736
737
  sharedstatedir='${prefix}/com'
737
738
  localstatedir='${prefix}/var'
739
+ runstatedir='${localstatedir}/run'
738
740
  includedir='${prefix}/include'
739
741
  oldincludedir='/usr/include'
740
742
  docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -987,6 +989,15 @@ do
987
989
  | -silent | --silent | --silen | --sile | --sil)
988
990
  silent=yes ;;
989
991
 
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
+
990
1001
  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
991
1002
  ac_prev=sbindir ;;
992
1003
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1124,7 +1135,7 @@ fi
1124
1135
  for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
1125
1136
  datadir sysconfdir sharedstatedir localstatedir includedir \
1126
1137
  oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1127
- libdir localedir mandir
1138
+ libdir localedir mandir runstatedir
1128
1139
  do
1129
1140
  eval ac_val=\$$ac_var
1130
1141
  # Remove trailing slashes.
@@ -1277,6 +1288,7 @@ Fine tuning of the installation directories:
1277
1288
  --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
1278
1289
  --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
1279
1290
  --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1291
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
1280
1292
  --libdir=DIR object code libraries [EPREFIX/lib]
1281
1293
  --includedir=DIR C header files [PREFIX/include]
1282
1294
  --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -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 = -ldl
11
11
  LINK_SHARED = $(CC) -shared
12
12
 
13
13
  #LIBS += -lpsapi
14
- LDFLAGS += -install_name @rpath/libfunchook.dylib
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.dylib
46
+ all: libfunchook.so
47
47
 
48
48
  check:
49
49
  cd ../test && $(MAKE) check
50
50
 
51
- libfunchook.dylib: $(OBJS)
52
- $(LINK_SHARED) $(LDFLAGS) -o libfunchook.dylib $(OBJS) $(LIBS)
51
+ libfunchook.so: $(OBJS)
52
+ $(LINK_SHARED) $(LDFLAGS) -o libfunchook.so $(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.dylib $(OBJS)
67
+ $(RM) libfunchook.so $(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
@@ -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 0
14
+ #define HAVE_DECL__SYS_ERRLIST 1
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 0
18
+ #define HAVE_DECL__SYS_NERR 1
19
19
 
20
20
  /* Define to 1 if you have the <inttypes.h> header file. */
21
21
  #define HAVE_INTTYPES_H 1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -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
- LDFLAGS += -Wl,-undefined,dynamic_lookup
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.dylib libfunchook_test.so
27
+ funchook_test$(EXEEXT): $(OBJS) libfunchook.so libfunchook_test.so
28
28
  $(CC) -o funchook_test$(EXEEXT) $(OBJS) $(LIBS)
29
29
 
30
30
  libfunchook_test.so: $(SO_OBJS) $(FUNCHOOK_TEST_LIB)
Binary file
Binary file
Binary file
@@ -51,7 +51,6 @@ cs__scoped_require 'contrast/internal_exception'
51
51
 
52
52
  # shared utils
53
53
  cs__scoped_require 'contrast/utils/timer'
54
- cs__scoped_require 'contrast/utils/random_util'
55
54
  cs__scoped_require 'contrast/utils/preflight_util'
56
55
 
57
56
  cs__scoped_require 'contrast/utils/assess/sampling_util'
@@ -3,12 +3,11 @@
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
-
10
6
  # This must precede other Contrast C extensions
11
7
  cs__scoped_require 'cs__common/cs__common'
8
+ # This must precede any patching we do as we log patches and we shouldn't cause
9
+ # requires to happen during that process.
10
+ cs__scoped_require 'contrast/components/logger'
12
11
 
13
12
  # defining instrumentation, this must precede core extensions
14
13
  # because they need to register their patches
@@ -16,12 +15,12 @@ cs__scoped_require 'contrast/agent/patching/policy/patcher'
16
15
  cs__scoped_require 'contrast/agent/patching/policy/patch'
17
16
 
18
17
  # core extensions
19
- cs__scoped_require 'contrast/extensions/ruby_core/assess'
20
- cs__scoped_require 'contrast/extensions/ruby_core/delegator'
21
- cs__scoped_require 'contrast/extensions/ruby_core/inventory'
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'
18
+ cs__scoped_require 'contrast/extension/assess'
19
+ cs__scoped_require 'contrast/extension/delegator'
20
+ cs__scoped_require 'contrast/extension/inventory'
21
+ cs__scoped_require 'contrast/extension/module'
22
+ cs__scoped_require 'contrast/extension/protect'
23
+ cs__scoped_require 'contrast/extension/protect/kernel'
25
24
 
26
25
  cs__scoped_require 'contrast/utils/object_share'
27
26
  cs__scoped_require 'contrast/utils/boolean_util'
@@ -74,17 +73,6 @@ cs__scoped_require 'contrast/agent/request_context'
74
73
 
75
74
  cs__scoped_require 'contrast/agent/assess'
76
75
 
77
- # Unconditional early-framework patches.
78
- # These happen regardless of analysis mode, & should be lightweight.
79
- cs__scoped_require 'contrast/utils/rack_assess_session_cookie'
80
- cs__scoped_require 'contrast/utils/rails_assess_configuration'
81
-
82
- # In Rails, session configuration occurs extremely early & only once.
83
- # If we defer our patching of the rails session configuration too long
84
- # (i.e., where we normally patch) we will miss the configuration
85
- # and will never be able to report session misconfiguration rules.
86
- cs__scoped_require 'contrast/extensions/framework/rails/configuration' if defined?(Rails)
87
-
88
76
  # protect rules
89
77
  cs__scoped_require 'contrast/agent/protect/rule'
90
78
 
@@ -93,4 +81,13 @@ cs__scoped_require 'contrast/utils/gemfile_reader'
93
81
 
94
82
  # rack event monitoring
95
83
  cs__scoped_require 'contrast/agent/middleware'
96
- cs__scoped_require 'contrast/agent/railtie' if defined?(Rails) && Rails::VERSION::MAJOR.to_i >= 3
84
+
85
+ # TODO: RUBY-919
86
+ # Refactor to use Contrast::Framework::Manager
87
+ # Contrast::Framework::Manager.before_load_patches!
88
+ if defined?(::Rails)
89
+ cs__scoped_require 'contrast/framework/rails/patch/support'
90
+ cs__scoped_require 'contrast/framework/rails/patch/rails_application_configuration'
91
+ Contrast::Framework::Rails::Patch::RailsApplicationConfiguration.instrument
92
+ cs__scoped_require 'contrast/agent/railtie' if ::Rails::VERSION::MAJOR.to_i >= 3
93
+ end
@@ -17,19 +17,10 @@ module Contrast
17
17
  # Rules - generic
18
18
  cs__scoped_require 'contrast/agent/assess/rule'
19
19
  cs__scoped_require 'contrast/agent/assess/rule/base'
20
- cs__scoped_require 'contrast/agent/assess/rule/response_scanning_rule'
21
- cs__scoped_require 'contrast/agent/assess/rule/watcher'
22
- cs__scoped_require 'contrast/agent/assess/rule/response_watcher'
23
20
 
24
21
  # Dynamic Sources
25
22
  cs__scoped_require 'contrast/agent/assess/policy/dynamic_source_factory'
26
23
 
27
- # Rule: CSRF
28
- cs__scoped_require 'contrast/agent/assess/rule/csrf'
29
- cs__scoped_require 'contrast/agent/assess/rule/csrf/csrf_applicator'
30
- cs__scoped_require 'contrast/agent/assess/rule/csrf/csrf_action'
31
- cs__scoped_require 'contrast/agent/assess/rule/csrf/csrf_watcher'
32
-
33
24
  # Rule: REDOS
34
25
  cs__scoped_require 'contrast/agent/assess/rule/redos'
35
26
 
@@ -35,6 +35,7 @@ module Contrast
35
35
  # pass us execution flow once a new method has been made available.
36
36
  def patch_assess_on_eval mod
37
37
  return unless ASSESS.enabled?
38
+ return if in_contrast_scope?
38
39
 
39
40
  with_contrast_scope { patcher.patch_specific_module(mod) }
40
41
  rescue StandardError => e
@@ -166,7 +166,7 @@ module Contrast
166
166
  # values. Give it some help by changing them to 'A'
167
167
  source = ALL_TYPE if source.include?(Contrast::Utils::ObjectShare::COMMA)
168
168
  target = ALL_TYPE if target.include?(Contrast::Utils::ObjectShare::COMMA)
169
- str = source[0] + TO_MARKER + target[0] # TODO: RUBY-139 PERF -- save in the patcher
169
+ str = source[0] + TO_MARKER + target[0]
170
170
  str.to_sym
171
171
  end
172
172
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  cs__scoped_require 'contrast/utils/object_share'
5
5
  cs__scoped_require 'contrast/components/interface'
6
- cs__scoped_require 'contrast/extensions/ruby_core/assess/assess_extension'
6
+ cs__scoped_require 'contrast/extension/assess/assess_extension'
7
7
 
8
8
  module Contrast
9
9
  module Agent
@@ -28,6 +28,7 @@ module Contrast
28
28
  INSERT_ACTION = 'INSERT'
29
29
  KEEP_ACTION = 'KEEP'
30
30
  NEXT_ACTION = 'NEXT'
31
+ NOOP_ACTION = 'NOOP'
31
32
  PREPEND_ACTION = 'PREPEND'
32
33
  REPLACE_ACTION = 'REPLACE'
33
34
  REMOVE_ACTION = 'REMOVE'
@@ -84,6 +85,7 @@ module Contrast
84
85
  INSERT_ACTION => Contrast::Agent::Assess::Policy::Propagator::Insert,
85
86
  KEEP_ACTION => Contrast::Agent::Assess::Policy::Propagator::Keep,
86
87
  NEXT_ACTION => Contrast::Agent::Assess::Policy::Propagator::Next,
88
+ NOOP_ACTION => nil,
87
89
  PREPEND_ACTION => Contrast::Agent::Assess::Policy::Propagator::Prepend,
88
90
  REPLACE_ACTION => Contrast::Agent::Assess::Policy::Propagator::Replace,
89
91
  REMOVE_ACTION => Contrast::Agent::Assess::Policy::Propagator::Remove,
@@ -241,6 +243,7 @@ module Contrast
241
243
  end
242
244
 
243
245
  def handle_cs_properties_propagation propagation_node, preshift, target, object, ret, args, _block
246
+ return if propagation_node.action == NOOP_ACTION
244
247
  return unless can_propagate?(propagation_node, preshift, target)
245
248
 
246
249
  # propagate all the tags from the sources to the target
@@ -1,7 +1,7 @@
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/extensions/ruby_core/module'
4
+ cs__scoped_require 'contrast/extension/module'
5
5
 
6
6
  module Contrast
7
7
  module Agent
@@ -45,9 +45,7 @@ module Contrast
45
45
  if known_tainted
46
46
  known_tainted.concat(tainted_columns.keys)
47
47
  else
48
- unless class_type < Contrast::CoreExtensions::Assess::AssessExtension
49
- class_type.send(:include, Contrast::CoreExtensions::Assess::AssessExtension)
50
- end
48
+ class_type.send(:include, Contrast::Extension::Assess::AssessExtension) unless class_type < Contrast::Extension::Assess::AssessExtension
51
49
  ASSESS.tainted_columns[class_name] = tainted_columns.keys
52
50
  end
53
51