Sha256: 279bfa8419e0543af0885d7e859cee1bf46df1e30befb0c6f0bda6e791060480
Contents?: true
Size: 1.13 KB
Versions: 18
Compression:
Stored size: 1.13 KB
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/components/logger' module Contrast module Extension module Assess # This Class provides us with a way to invoke Hash propagation for those # methods which are too complex to fit into one of the standard # Contrast::Agent::Assess::Policy::Propagator molds. class HashPropagator include Contrast::Components::Logger::InstanceMethods class << self def cs__duplicate_and_freeze object return object unless object.is_a?(String) && !object.cs__frozen? # Copy the object, then freeze it, so that it looks the same # externally, but will have our finalizer on it. copy = object.dup Contrast::Agent::Assess::Tracker.pre_freeze(copy) copy&.cs__freeze rescue StandardError # we'll rescue this error, but we can't log it here as that will # result in a seg fault object end end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems