Sha256: 7a5b178279f52249d8814116b2e1738a803d680c8a61bc00671e89a990d6cc23
Contents?: true
Size: 1.31 KB
Versions: 15
Compression:
Stored size: 1.31 KB
Contents
/* Copyright (c) 2022 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
15 entries across 15 versions & 1 rubygems