Sha256: 020bfabf2400a5894885ab86963882a0436f30380c868dd4c8402734e93f533e
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
/* Copyright (c) 2020 Contrast Security, Inc. See * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */ #include "cs__assess_basic_object.h" #include "../cs__common/cs__common.h" #include <ruby.h> void contrast_assess_instance_eval_trigger_check(VALUE module, VALUE source, VALUE ret) { VALUE has_trigger_check = rb_respond_to(rb_cBasicObject, instance_trigger_check_method); if (has_trigger_check) { rb_funcall(rb_cBasicObject, instance_trigger_check_method, 2, source, ret); } } VALUE contrast_assess_basic_object_instance_eval(const int argc, const VALUE *argv, const VALUE self) { if (RTEST(rb_funcall(contrast_patcher(), rb_sym_skip_assess_analysis, 0))) { return rb_obj_instance_eval(argc, argv, self); } int nested_scope = RTEST(rb_funcall(contrast_patcher(), rb_sym_in_scope, 0)); rb_funcall(contrast_patcher(), rb_sym_enter_scope, 0); VALUE ret = rb_obj_instance_eval(argc, argv, self); if (!nested_scope && argc > 0) { VALUE data = argv[0]; contrast_assess_instance_eval_trigger_check(self, data, ret); } rb_funcall(contrast_patcher(), rb_sym_exit_scope, 0); return ret; } void Init_cs__assess_basic_object(void) { instance_trigger_check_method = rb_intern("instance_eval_trigger_check"); /* We don't keep a reference to the underlying method. * Instead, we call rb_obj_instance_eval directly. * This should work an overwhelming majority of the time, * but if someone else patched BasicObject#instance_eval, * IDK if this is intentional... noting it. -ajm */ contrast_register_patch("BasicObject", "instance_eval", contrast_assess_basic_object_instance_eval); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contrast-agent-3.11.0 | ext/cs__assess_basic_object/cs__assess_basic_object.c |