kobako 0.9.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77815cccc84108dd3ece9b1571ecaa2b089867bf7b9ac395e561c940300c78fb
4
- data.tar.gz: 49199331280ce4f7324039be281dd4cdfcedfaa03ece5141e56b70c24895f6de
3
+ metadata.gz: f2af9677bcec2d298db05d1259360b9589ac7726d855157dbbfd0be0ca666472
4
+ data.tar.gz: 5ed589a7b179274650d04280d9f84456873ec6fbab46166e85974a3d92d9ab9d
5
5
  SHA512:
6
- metadata.gz: b812aea26a6c6196fcd5dbb54b38d20d38e23577b0374fb89c620c725281dc569c3ef9dd44e2383842afc37dd2db0614601b0ba8c08d423338c38f1c511966f0
7
- data.tar.gz: a55933ff5d6e425b6f98be8d2d57adcf733097a74a3524fd086005f463ba4372e0a3ced4cf2ce783e4049b3e2f7a7364baa090d76d70781cba8857334e230963
6
+ metadata.gz: 59c775f5aacdf0b81a8f00970385974d2e7173b356d9886bd7e173f006a668449eb1672833b222129a227a5f4a3746b92d1fece7b44265eba44963414406b8d2
7
+ data.tar.gz: d902273d0c0df298c41e6be747d692ba8ceec86f564c81cd81347a75bf2a78b2fc35cfd73ccbd44696cabcff01cfdcf76d7260ba99cd2f194a1400cdbe4e88df
@@ -1 +1 @@
1
- {".":"0.9.0","wasm/kobako-core":"0.4.0","wasm/kobako":"0.4.0","wasm/kobako-io":"0.4.0","wasm/kobako-regexp":"0.4.0"}
1
+ {".":"0.9.1","wasm/kobako-core":"0.4.0","wasm/kobako":"0.4.0","wasm/kobako-io":"0.4.0","wasm/kobako-regexp":"0.4.0"}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.9.1](https://github.com/elct9620/kobako/compare/v0.9.0...v0.9.1) (2026-06-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **transport:** block ambient reflection in guest dispatch (GHSA-7pwq-q9jf-539h) ([dd08166](https://github.com/elct9620/kobako/commit/dd081665f368f7ba54e476c3ad045ee1aa8ed703))
9
+
3
10
  ## [0.9.0](https://github.com/elct9620/kobako/compare/v0.8.0...v0.9.0) (2026-06-10)
4
11
 
5
12
 
data/Cargo.lock CHANGED
@@ -878,7 +878,7 @@ dependencies = [
878
878
 
879
879
  [[package]]
880
880
  name = "kobako"
881
- version = "0.9.0"
881
+ version = "0.9.1"
882
882
  dependencies = [
883
883
  "magnus",
884
884
  "wasmtime",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "kobako"
3
- version = "0.9.0"
3
+ version = "0.9.1"
4
4
  edition = "2021"
5
5
  authors = ["Aotokitsuruya <contact@aotoki.me>"]
6
6
  license = "Apache-2.0"
@@ -42,6 +42,17 @@ module Kobako
42
42
  # ({docs/behavior.md E-12}[link:../../../docs/behavior.md]).
43
43
  class UndefinedTargetError < StandardError; end
44
44
 
45
+ # Modules whose instance methods are ambient Ruby reflection /
46
+ # metaprogramming surface (+send+, +public_send+, +instance_eval+,
47
+ # +method+, +tap+, +instance_variable_get+, ...) rather than Service
48
+ # behaviour. A guest-supplied method name resolving to one of these is
49
+ # rejected: the security contract is that only methods the bound object
50
+ # itself defines are reachable, and +public_send(:send, ...)+ would
51
+ # otherwise let a guest pivot through +send+ into the private
52
+ # +Kernel#eval+ / +#system+ surface (host RCE).
53
+ META_OWNERS = [BasicObject, Kernel, Object, Module, Class].freeze
54
+ private_constant :META_OWNERS
55
+
45
56
  # Dispatch a single transport request and return the encoded
46
57
  # Response bytes ({docs/behavior.md B-12}[link:../../../docs/behavior.md]).
47
58
  # Invoked from the +Runtime#on_dispatch+ Proc that
@@ -109,14 +120,33 @@ module Kobako
109
120
  # so the same call site handles both cases without an explicit
110
121
  # conditional.
111
122
  def invoke(target, method, args, kwargs, yielder = nil)
123
+ name = method.to_sym
124
+ reject_meta_method!(target, name)
112
125
  block = yielder&.to_proc
113
126
  if kwargs.empty?
114
- target.public_send(method.to_sym, *args, &block)
127
+ target.public_send(name, *args, &block)
115
128
  else
116
- target.public_send(method.to_sym, *args, **kwargs, &block)
129
+ target.public_send(name, *args, **kwargs, &block)
117
130
  end
118
131
  end
119
132
 
133
+ # Guard the +public_send+ below against ambient reflection methods
134
+ # (see {META_OWNERS}). A concretely-defined public method whose owner
135
+ # is a meta module is rejected; a name with no concrete public method
136
+ # is allowed only when the target opts into it via +respond_to?+
137
+ # (dynamic +method_missing+ Services), since the dangerous meta methods
138
+ # are all concretely defined and therefore never reach that branch.
139
+ def reject_meta_method!(target, name)
140
+ owner = target.public_method(name).owner
141
+ return unless META_OWNERS.include?(owner)
142
+
143
+ raise UndefinedTargetError, "method #{name.inspect} is not a Service method"
144
+ rescue NameError
145
+ return if target.respond_to?(name)
146
+
147
+ raise UndefinedTargetError, "no public method #{name.inspect} on target"
148
+ end
149
+
120
150
  # {docs/behavior.md B-16}[link:../../../docs/behavior.md] — A Kobako::Handle arriving as a positional or keyword
121
151
  # argument identifies a host-side object previously allocated by a prior
122
152
  # transport call's Handle wrap (B-14). Resolve it back to the Ruby object before
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kobako
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
@@ -7,7 +7,8 @@
7
7
  "component": "kobako",
8
8
  "include-component-in-tag": false,
9
9
  "release-type": "ruby",
10
- "exclude-paths": ["wasm"]
10
+ "exclude-paths": ["wasm"],
11
+ "release-as": "0.9.1"
11
12
  },
12
13
  "wasm/kobako-core": {
13
14
  "component": "kobako-core",
@@ -6,6 +6,8 @@ module Kobako
6
6
 
7
7
  BREAK_THROW: Symbol
8
8
 
9
+ META_OWNERS: Array[Module]
10
+
9
11
  def self?.dispatch: (String request_bytes, Kobako::Catalog::Namespaces namespaces, Kobako::Catalog::Handles handler, ^(String) -> String yield_to_guest) -> String
10
12
 
11
13
  def self?.resolve_call_args: (Kobako::Transport::Request request, Kobako::Catalog::Handles handler) -> [Array[untyped], Hash[Symbol, untyped]]
@@ -14,6 +16,8 @@ module Kobako
14
16
 
15
17
  def self?.invoke: (untyped target, String method, Array[untyped] args, Hash[Symbol, untyped] kwargs, ?Kobako::Transport::Yielder? yielder) -> untyped
16
18
 
19
+ def self?.reject_meta_method!: (untyped target, Symbol name) -> void
20
+
17
21
  def self?.resolve_arg: (untyped value, Kobako::Catalog::Handles handler) -> untyped
18
22
 
19
23
  def self?.resolve_target: (String | Kobako::Handle target, Kobako::Catalog::Namespaces namespaces, Kobako::Catalog::Handles handler) -> untyped
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kobako
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aotokitsuruya