Class: Contrast::Utils::StackTraceUtils
- Defined in:
- lib/contrast/utils/stack_trace_utils.rb
Overview
Utilities for converting ruby stack trace into DTMs
Constant Summary collapse
- AGENT_CLASS_MARKER =
need lib here to separate from specs
'/lib/contrast/'
Class Method Summary collapse
-
.build_protect_report_stack_array ⇒ Array<Contrast::Agent::Reporting::ApplicationDefendAttackSampleStack>
Call and translate a caller_locations array to an array of ApplicationDefendAttackSampleStack for TeamServer to display, excluding any Contrast code found.
-
.custom_code_context? ⇒ Boolean
Determine if this method is being invoked by application code or not based on the immediate caller of the code after Contrast.
Class Method Details
.build_protect_report_stack_array ⇒ Array<Contrast::Agent::Reporting::ApplicationDefendAttackSampleStack>
Call and translate a caller_locations array to an array of ApplicationDefendAttackSampleStack for TeamServer to display, excluding any Contrast code found.
39 40 41 |
# File 'lib/contrast/utils/stack_trace_utils.rb', line 39 def build_protect_report_stack_array build_protect_stack(Contrast::Agent::Reporting::ApplicationDefendAttackSampleStack) end |
.custom_code_context? ⇒ Boolean
Determine if this method is being invoked by application code or not based on the immediate caller of the code after Contrast.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/contrast/utils/stack_trace_utils.rb', line 20 def custom_code_context? root_dir = Contrast::Agent.framework_manager.app_root stack = Kernel.caller(0, 15) i = 0 while i < stack.length stack_element = stack[i] i += 1 next if stack_element.include?('/contrast/') return stack_element.start_with?(root_dir) end end |