yeptris 0.6.28.5 → 0.6.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/yeptris_native/cbor_ruby.c +6 -1
- data/lib/yeptris/node.rb +13 -0
- data/lib/yeptris/psych.rb +49 -3
- data/lib/yeptris.rb +1 -1
- data/vendor/libyeptris/CMakeLists.txt +1 -1
- data/vendor/libyeptris/src/yeptris/parse/engine.c +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f393e5d97dd930bd8dda0a92247a12e25684cbeb0b7c068ce9c58c5de1b6911
|
|
4
|
+
data.tar.gz: d373e283788cc0c02d40257fda655a66827f209f008e91ebcca8e4d74640ff69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 441cf501ddba2e13a786162e0e3a67d909353f872d7dd24623e5a1d6a6a7f968719bdfbae61b21087dbca59776abd32a9e01c132f0b9534dc89397ab00dfd0c3
|
|
7
|
+
data.tar.gz: 383a856c2d6e4588eaffeb86dfdd6d731285060631c635ddb9cf04b9f7f4cf3da66906b58121fba513a4b17ac1870a7d88a4f0c8fca31cb664b5496a3d4b5028
|
|
@@ -183,7 +183,12 @@ VALUE yep_rb_cbor_load(const char* p, size_t len, int strict) {
|
|
|
183
183
|
yep_cbor_sink sink = RV_SINK;
|
|
184
184
|
sink.ctx = &ctx;
|
|
185
185
|
st = yep_cbor_decode_gen((const unsigned char*)p, len, strict, NULL, &sink);
|
|
186
|
-
|
|
186
|
+
/* rb_gc_disable returns Qfalse when GC was ON — enable exactly
|
|
187
|
+
* then (the old RTEST(gc_on) tested the inverted sense, so every
|
|
188
|
+
* CBOR load left GC permanently off; the Init self-check rides
|
|
189
|
+
* this path too, so one require disabled GC for the process —
|
|
190
|
+
* #259's linear RSS growth and never-running finalizers) */
|
|
191
|
+
if (gc_on == Qfalse) {
|
|
187
192
|
rb_gc_enable();
|
|
188
193
|
}
|
|
189
194
|
if (st != YEPTRIS_OK) {
|
data/lib/yeptris/node.rb
CHANGED
|
@@ -394,6 +394,19 @@ class Yeptris::Node
|
|
|
394
394
|
def scalar_to_ruby
|
|
395
395
|
return symbolize if symbol? && tag_id == :str
|
|
396
396
|
|
|
397
|
+
# !ruby/symbol (#258): psych deserializes the scalar to a Symbol
|
|
398
|
+
# (both spellings; safety is walk_safe's permitted_classes gate)
|
|
399
|
+
if tag == "!ruby/symbol" || tag == "tag:ruby.yaml.org,2002:symbol"
|
|
400
|
+
return value.to_s.to_sym
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# scanner-coercion primitives (psych's ClassLoader-free path)
|
|
404
|
+
case tag
|
|
405
|
+
when "!ruby/string", "tag:ruby.yaml.org,2002:string" then return value.to_s
|
|
406
|
+
when "!ruby/integer", "tag:ruby.yaml.org,2002:integer" then return value.to_i
|
|
407
|
+
when "!ruby/float", "tag:ruby.yaml.org,2002:float" then return value.to_f
|
|
408
|
+
end
|
|
409
|
+
|
|
397
410
|
# stdlib deserialize's tagged-scalar arms: the class tag carries
|
|
398
411
|
# DateTime (dumped tagged — a plain timestamp re-loads as Time)
|
|
399
412
|
if tag == "!ruby/object:DateTime"
|
data/lib/yeptris/psych.rb
CHANGED
|
@@ -401,6 +401,42 @@ module Yeptris
|
|
|
401
401
|
PERMITTED_BY_DEFAULT = [TrueClass, FalseClass, NilClass, Integer, Float,
|
|
402
402
|
String, Array, Hash].freeze
|
|
403
403
|
|
|
404
|
+
CORE_TAGS = %w[str int float bool null timestamp seq map merge value
|
|
405
|
+
binary].freeze
|
|
406
|
+
|
|
407
|
+
# Both tag spellings to the "ruby/…" short form: the engine may
|
|
408
|
+
# hand either the "!ruby/symbol" shorthand or the
|
|
409
|
+
# "tag:ruby.yaml.org,2002:…" URI spelling.
|
|
410
|
+
def ruby_tag_short(tag)
|
|
411
|
+
t = tag.sub(/\A!/, "")
|
|
412
|
+
return t if t.start_with?("ruby/")
|
|
413
|
+
t.sub(/\Atag:ruby\.yaml\.org,2002:/, "ruby/")
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# psych's scanner coercion path — always allowed, no class
|
|
417
|
+
# loader involved (verified against stdlib: !ruby/string with no
|
|
418
|
+
# permitted_classes loads fine)
|
|
419
|
+
RUBY_TAG_PRIMITIVES = %w[ruby/string ruby/integer ruby/float].freeze
|
|
420
|
+
|
|
421
|
+
# The class a !ruby/… tag names (psych's resolve_class face):
|
|
422
|
+
# "ruby/symbol" → Symbol; "ruby/object:Foo" and the collection
|
|
423
|
+
# forms "ruby/hash:Foo" name Foo. Nil = not a class-shaped ruby
|
|
424
|
+
# tag (or unresolvable) — the caller raises DisallowedClass.
|
|
425
|
+
RUBY_TAG_SINGLETONS = {
|
|
426
|
+
"ruby/symbol" => ::Symbol,
|
|
427
|
+
}.freeze
|
|
428
|
+
|
|
429
|
+
def ruby_tag_class(short)
|
|
430
|
+
return RUBY_TAG_SINGLETONS[short] if RUBY_TAG_SINGLETONS.key?(short)
|
|
431
|
+
|
|
432
|
+
rest = short[/\Aruby\/(?:object|hash|array|struct|exception)(?::(.*))?\z/, 1]
|
|
433
|
+
return nil if rest.nil? || rest.empty?
|
|
434
|
+
rest.split("::").inject(Object) do |mod, part|
|
|
435
|
+
return nil unless mod.const_defined?(part, false)
|
|
436
|
+
mod.const_get(part, false)
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
|
|
404
440
|
def check(node, permitted, aliases_enabled)
|
|
405
441
|
case node.kind
|
|
406
442
|
when :alias
|
|
@@ -411,9 +447,19 @@ module Yeptris
|
|
|
411
447
|
# both tag spellings pass: the URI form's last segment and
|
|
412
448
|
# the short "!binary" shorthand (#168's cassettes carry it)
|
|
413
449
|
name = tag.split(":").last.sub(/\A!/, "")
|
|
414
|
-
unless
|
|
415
|
-
|
|
416
|
-
|
|
450
|
+
unless CORE_TAGS.include?(name)
|
|
451
|
+
# #258: !ruby/… tags follow psych's ClassLoader rules —
|
|
452
|
+
# the scalar primitives (string/integer/float) coerce
|
|
453
|
+
# through the scanner and are allowed as-is; !ruby/symbol
|
|
454
|
+
# passes exactly when Symbol is in permitted_classes;
|
|
455
|
+
# class-bearing forms (ruby/object:K, ruby/hash:K, …)
|
|
456
|
+
# pass when K is in permitted_classes
|
|
457
|
+
short = ruby_tag_short(tag)
|
|
458
|
+
unless RUBY_TAG_PRIMITIVES.include?(short)
|
|
459
|
+
klass = ruby_tag_class(short)
|
|
460
|
+
raise DisallowedClass, name if klass.nil?
|
|
461
|
+
raise DisallowedClass, name unless permitted.include?(klass)
|
|
462
|
+
end
|
|
417
463
|
end
|
|
418
464
|
end
|
|
419
465
|
if node.kind == :scalar && node.tag_id == :timestamp &&
|
data/lib/yeptris.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Yeptris
|
|
4
4
|
# The gem's version lives in the parent namespace's file — the last
|
|
5
5
|
# internal require (yeptris/version) retired with it.
|
|
6
|
-
VERSION = "0.6.
|
|
6
|
+
VERSION = "0.6.29.1".freeze
|
|
7
7
|
|
|
8
8
|
# Informational notices are OPT-IN (yeptris-ruby#217): consumers
|
|
9
9
|
# embed yeptris inside CLIs that assert clean stderr, and a
|
|
@@ -3060,7 +3060,14 @@ static int e_parse_value(yep_engine* e, yep_ctx ctx, uint16_t floor_col) {
|
|
|
3060
3060
|
* continue the value even at the parent column ("k:\n!!seq\n[a]"). */
|
|
3061
3061
|
if (li.indent > floor_col || e->depth == 0 ||
|
|
3062
3062
|
(ctx == YEP_CTX_AFTER_Q && li.indent == floor_col && li.first != ':') ||
|
|
3063
|
-
((li.first == '[' || li.first == '{') && li.indent == floor_col)
|
|
3063
|
+
((li.first == '[' || li.first == '{') && li.indent == floor_col) ||
|
|
3064
|
+
/* libyaml never validates a block-scalar HEADER's column —
|
|
3065
|
+
* only the content must out-indent the parent (e_block_scalar
|
|
3066
|
+
* enforces that), so "|" / ">" at the key's own column is the
|
|
3067
|
+
* pending value (yeptris-ruby#258: the metanorma collection
|
|
3068
|
+
* fixture shape) */
|
|
3069
|
+
(vctx == YEP_CTX_VALUE_LINE && (li.first == '|' || li.first == '>') &&
|
|
3070
|
+
li.indent == floor_col)) {
|
|
3064
3071
|
e->pos += li.indent;
|
|
3065
3072
|
return e_node(e, vctx, floor_col);
|
|
3066
3073
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yeptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.29.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|