Sha256: c6856096c138601eedf55de1857b0705d16320b1a755b17c1c6e52215375eb31

Contents?: true

Size: 987 Bytes

Versions: 13

Compression:

Stored size: 987 Bytes

Contents

/* Copyright (c) 2021 Contrast Security, Inc.  See
 * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */

#include "cs__assess_string_interpolation26.h"
#include "../cs__common/cs__common.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);
    rb_funcall(string_propagator, track_interpolation, 2, rb_params, result);
    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_interpolation26(void) {
    string_propagator =
        rb_define_class_under(core_assess, "StringPropagator", rb_cObject);
    track_interpolation = rb_intern("track_interpolation");
    install_hooks();
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
contrast-agent-4.14.1 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.14.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.13.1 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.13.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.12.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.11.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.10.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.9.1 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.9.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.8.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.7.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.6.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c
contrast-agent-4.5.0 ext/cs__assess_string_interpolation26/cs__assess_string_interpolation26.c