Sha256: b761c490b020aa5324db031af13d2b0b14688e33738f92637743cf8ff44c2f9d
Contents?: true
Size: 1.31 KB
Versions: 18
Compression:
Stored size: 1.31 KB
Contents
/* Copyright (c) 2023 Contrast Security, Inc. See * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */ #include "cs__assess_string_interpolation.h" #include "../cs__common/cs__common.h" #include "../cs__scope/cs__scope.h" #include <ruby.h> static VALUE rb_str_concat_literals_hook(size_t num, VALUE *strary) { VALUE result = rb_str_concat_literals_original(num, strary); VALUE rb_params = rb_ary_new_from_values((int)num, strary); VALUE in_contrast_scope = inst_methods_in_cntr_scope(contrast_patcher(), 0); if (in_contrast_scope == Qfalse) { /* enter scope */ inst_methods_enter_cntr_scope(contrast_patcher(), 0); rb_funcall(string_propagator, track_interpolation, 2, rb_params, result); /* exit scope */ inst_methods_exit_cntr_scope(contrast_patcher(), 0); } return result; } static int install_hooks() { rb_str_concat_literals_original = rb_str_concat_literals; patch_via_funchook(&rb_str_concat_literals_original, &rb_str_concat_literals_hook); return 0; } void Init_cs__assess_string_interpolation(void) { string_propagator = rb_define_class_under(core_assess, "StringPropagator", rb_cObject); track_interpolation = rb_intern("track_interpolation"); install_hooks(); }
Version data entries
18 entries across 18 versions & 1 rubygems