Class: Marshalsea::Chains::ErbDefModule
- Inherits:
-
Base
- Object
- Base
- Marshalsea::Chains::ErbDefModule
show all
- Defined in:
- lib/marshalsea/chains/erb_def_module.rb
Constant Summary
collapse
- CHAIN_NAME =
"erb-def-module"
- VECTOR =
"hash"
- CVE =
"CVE-2026-41316"
- TARGET_GEM =
"erb"
- REQUIRES =
["activesupport"].freeze
- AFFECTED =
[
["< 4.0.3.1"],
["= 4.0.4"],
[">= 5.0.0", "< 6.0.1.1"],
[">= 6.0.2", "< 6.0.4"]
].map { |constraints| constraints.map(&:freeze).freeze }.freeze
- PROXY_CLASS =
"ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy"
- DEPRECATOR_CLASS =
"ActiveSupport::Deprecation"
- DISPATCH_METHOD =
:def_module
- PROXY_LABEL =
"@marshalsea"
- SRC_PREFIX =
"#\nend\n"
- SRC_SUFFIX =
"\ndef _marshalsea_unused\n"
- DEFAULT_FILENAME =
"(erb)"
- DEFAULT_LINENO =
0
- IVAR_SRC =
:@src
- IVAR_FILENAME =
:@filename
- IVAR_LINENO =
:@lineno
- IVAR_INSTANCE =
:@instance
- IVAR_METHOD =
:@method
- IVAR_VAR =
:@var
- IVAR_DEPRECATOR =
:@deprecator
- IVAR_SILENCED =
:@silenced
- CANARY_TEMPLATE =
"File.write(%<path>p, %<marker>p)"
- MISSING_DISPATCHER =
"#{PROXY_CLASS} is not loaded; this chain needs activesupport".freeze
- SET_IVAR =
Object.instance_method(:instance_variable_set).freeze
- METADATA =
{
name: CHAIN_NAME,
vector: VECTOR,
cve: CVE,
gem: TARGET_GEM,
affected: AFFECTED,
kind: KIND_CHAIN,
requires: REQUIRES
}.freeze
Constants inherited
from Base
Base::HASH_WITH_ONE_ENTRY, Base::HEADER_BYTES, Base::KIND_CHAIN, Base::KIND_PRIMITIVE, Base::NIL_VALUE, Base::OBJECT_LINK_REFUSED, Base::SUBCLASS_MUST_DEFINE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
affected_requirements, affects?, chain?, chain_name, cve, inherited, kind, primitive?, required_gems, target_gem, vector
Constructor Details
#initialize(ruby_source) ⇒ ErbDefModule
Returns a new instance of ErbDefModule.
88
89
90
91
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 88
def initialize(ruby_source)
super()
@ruby_source = ruby_source
end
|
Class Method Details
.canary(path, marker) ⇒ Object
64
65
66
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 64
def self.canary(path, marker)
new(format(CANARY_TEMPLATE, path: path, marker: marker))
end
|
.deprecator_class ⇒ Object
83
84
85
86
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 83
def self.deprecator_class
dispatcher_class
Object.const_get(DEPRECATOR_CLASS)
end
|
.dispatcher_available? ⇒ Boolean
68
69
70
71
72
73
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 68
def self.dispatcher_available?
dispatcher_class
true
rescue ChainError
false
end
|
.dispatcher_class ⇒ Object
75
76
77
78
79
80
81
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 75
def self.dispatcher_class
require "active_support"
require "active_support/deprecation"
Object.const_get(PROXY_CLASS)
rescue LoadError, NameError
raise ChainError, MISSING_DISPATCHER
end
|
60
61
62
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 60
def self.metadata
METADATA
end
|
Instance Method Details
#deprecator ⇒ Object
114
115
116
117
118
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 114
def deprecator
silent = self.class.deprecator_class.allocate
silent.instance_variable_set(IVAR_SILENCED, true)
silent
end
|
#serialize ⇒ Object
102
103
104
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 102
def serialize
in_hash_key_position(generate)
end
|
#src ⇒ Object
120
121
122
|
# File 'lib/marshalsea/chains/erb_def_module.rb', line 120
def src
"#{SRC_PREFIX}#{@ruby_source}#{SRC_SUFFIX}"
end
|