Skip to content
Back to skills

Ruby Knowledge Patch

ASecurity

Ruby

  • 25 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 5, 2026
developmentrustgorubyc#apisecurityperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill ruby-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ruby Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ruby Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-ruby-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-ruby-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ruby-knowledge-patch
description: Ruby
version: "4.0.10"
license: MIT
metadata:
  author: Nevaberry
---


# Ruby knowledge patch

Load this skill when updating Ruby code or working with language semantics,
Ractors, fiber schedulers, I/O, gem packaging, native extensions, diagnostics,
garbage collection, or JIT configuration. The references contain the detailed
compatibility guidance; the sections below provide a quick reference.

## Reference index

| Reference | Topics |
| --- | --- |
| [Language and core types](references/language-and-core-types.md) | Syntax, reflection, strings, encodings, regexps, collections, ranges, numbers, time, object behavior |
| [Concurrency and Ractors](references/concurrency-and-ractors.md) | Ractor ports, lifecycle, loading, storage, shareable callables, scheduler hooks, exception causes |
| [I/O, networking, and standard library](references/io-networking-and-standard-library.md) | TCP fallback and deadlines, DNS security, file operations, timeouts, URI parsing, HTTP headers, Windows process launches |
| [Extensions, builds, and packaging](references/extensions-builds-and-packaging.md) | Gem dependencies, signing, checksums, gem security fixes, removed APIs, native extensions, compiler requirements, release tarballs |
| [Runtime, diagnostics, and JIT](references/runtime-diagnostics-and-jit.md) | Backtraces, warnings, object IDs, process status, Ruby Box, garbage collectors, YJIT, ZJIT |

## Breaking changes and deprecations

### String mutation and assignment syntax

- Mutating a literal in a file without a `frozen_string_literal` directive can
  warn with `-W:deprecated` or `Warning[:deprecated] = true`. Use
  `buffer = +"data"` for a mutable string without the warning, or
  `--disable-frozen-string-literal` to restore the previous default.
- Mutating a string returned by `Symbol#to_s` can warn under the same settings.
  Use `symbol.to_s.dup` for a mutable copy; a future Ruby version will freeze
  the returned string.
- Bracket assignment rejects keyword and block arguments. For a custom setter
  that accepts them, call `obj.[]=(0, 2, mode: :fast, &callback)` as appropriate.
- Defining the top-level constant `Ruby` warns when `Warning[:deprecated]`
  is enabled.

### Reflection and removed operations

- `Binding#local_variables` omits numbered block parameters; ordinary local
  variable get, set, and defined checks reject them. Inspect numbered parameters
  and `it` with `implicit_parameters`, `implicit_parameter_get`, and
  `implicit_parameter_defined?` on the binding.
- `Proc#parameters` reports an anonymous optional parameter as `[:opt]`.
  Reflection code expecting `[:opt, nil]` needs to accept the shorter entry.
- `*nil` expands to zero elements without dispatching `nil.to_a`; a custom
  `nil.to_a` has no effect on a splat of `nil`.
- `Refinement#refined_class`, `DidYouMean::SPELL_CHECKERS[]=`, and
  `DidYouMean::SPELL_CHECKERS.merge!` are removed.
- `ObjectSpace._id2ref` is deprecated. `Process::Status#&` and
  `Process::Status#>>` are removed.

### Ractor communication migration

Replace `Ractor.yield` and `Ractor#take` with sends and receives on
`Ractor::Port`. Ports accept `send` or `<<` and provide `receive`, `close`, and
`closed?`. Each Ractor's `default_port` backs its existing send and receive
operations; `close_incoming` and `close_outgoing` are removed.

```ruby
reply = Ractor::Port.new
Ractor.new(reply) { |port| port << :done }
reply.receive # => :done
```

Use `ractor.join` to wait for termination and `ractor.value` to retrieve the
result. `Ractor.select` accepts only Ractors and ports; selecting a Ractor waits
for termination. The lower-level lifecycle API is `monitor` and `unmonitor`.

### I/O and network compatibility

- Ruby removes implicit subprocess creation via a leading `|` in `Kernel#open`
  and the affected `IO` class methods.
- `Timeout.timeout` rejects negative durations. The Ruby 4.0.10 backport for
  `IO#sysread` and `IO#pread` adds a negative-length check when an output buffer
  is supplied.
- `URI` defaults to its RFC 3986 parser, changing behavior for code that depended
  on RFC 2396 parsing.
- `Net::HTTP` removes the automatic `application/x-www-form-urlencoded`
  fallback for requests with a body. Set `Content-Type` explicitly if the server
  expects one.

### Gem dependencies and loading

- Under Bundler, declare used gems that moved from default to bundled gems in
  the Gemfile. The packaging reference contains both complete migration lists.
- Ruby drops the default `cgi` gem and ships `cgi/escape` for escaping and
  unescaping helpers.
- To use `SortedSet`, install `sorted_set` and explicitly
  `require "sorted_set"`; the old `set/sorted_set.rb` path and autoload are removed.
- Passing arguments to `Set#to_set` or `Enumerable#to_set` is deprecated.
- `require "strscan"` activates the gem again, allowing a newer installed
  version to be selected and avoiding a second load.

### Native extension migration

`rb_thread_fd_close` is deprecated and does nothing. Wrap a descriptor exposed
to Ruby in an IO with `RUBY_IO_MODE_EXTERNAL` and close it with `rb_io_close(io)`
to interrupt and wait for pending operations on that IO. `rb_thread_call_with_gvl`
accepts callers with or without the GVL already held. The deprecated
`rb_path_check` is removed; the packaging reference also lists removed compatibility
APIs and macros and the native Set APIs.

## Security updates

- Upgrade Ruby 4.0 installations to 4.0.10 or later for seven security fixes
  covering string case conversion and regexp compilation, matching, and
  `Regexp#to_s`. That release updates the default `json` gem from 2.18.0 to
  2.18.3, which fixes CVE-2026-33210.
- Upgrade the bundled `resolv` gem to address CVE-2026-80212 and CVE-2026-80213.
- Ruby 4.0.5 fixes CVE-2026-46727, a use-after-free in the pthread-based
  `getaddrinfo` timeout handler. Upgrade Ruby 4.0 installations to 4.0.5 or later.
- Ruby 3.2.11 includes an updated `zlib` gem addressing CVE-2026-27820.

## Core operations and buffer handling

- `Pathname` and `Set` are core classes available without a `require`.
  `Set#inspect` prints in the form `Set[1, 2, 3]`.
- `String#append_as_bytes` concatenates arguments without encoding validation
  or conversion, as in `buffer.append_as_bytes(header, payload)`.
- `strip`, `lstrip`, `rstrip`, and their bang variants accept selectors for
  characters to trim, as in `"__name__".strip("_")`.
- Use a separate `buffer:` for `Array#pack` when a string in the input would
  otherwise be packed into itself. `Encoding::Converter#primitive_convert`
  requires distinct source and destination buffers if both are strings.
- Ruby 4.0.10 rejects UTF-32 code units whose most significant byte is `0x80`
  or greater; `String#valid_encoding?` can return `false` for these inputs.
- `Range#step` advances with `+` for nonnumeric values too, so a time range can
  step by seconds. `Range#size` raises `TypeError` for a non-iterable range.
- `Range#to_set` checks size before materializing, guarding against endless
  ranges. `Range#overlap?` handles unbounded ranges.
- `Enumerator.produce` accepts `size:` as an integer, `Float::INFINITY`, a
  callable, or `nil` for unknown size. The default is `Float::INFINITY`; the
  block still controls when iteration stops.
- `Time#xmlschema` and its `#iso8601` alias are available without `require "time"`.

## Concurrency and connection controls

- `require` can run from a non-main Ractor, with loading performed on the main
  Ractor. `Ractor._require(feature)` routes loading there; `Ractor.main?` checks
  whether the caller is already there.
- `Ractor[key]` and `Ractor[key] = value` access the current Ractor's storage.
  Use `Ractor.store_if_absent(:cache) { {} }` for thread-safe initialization.
- `Ractor.shareable_proc` and `Ractor.shareable_lambda` create callables that
  can be shared across Ractors.
- Schedulers can implement optional `blocking_operation_wait` to move blocking
  operations out of the event loop. They can implement `fiber_interrupt` to
  deliver an exception to a fiber and `yield` to keep processing with signal
  exceptions disabled. Asynchronous `IO#close` can use restored `io_close`;
  flushing an IO write buffer invokes `io_write`.
- `Thread#raise` and `Fiber#raise` accept `cause:` to set the delivered
  exception's cause.
- `Socket.tcp`, `TCPSocket.new`, and `TCPSocket.open` use Happy Eyeballs v2 by
  default to race IPv6 and IPv4 attempts. Disable it for one call with
  `fast_fallback: false`, or process-wide with `Socket.tcp_fast_fallback = false`
  or `RUBY_TCP_NO_FAST_FALLBACK=1`. Specifying a local port disables fast fallback.
- `Socket.tcp` and `TCPSocket.new` accept `open_timeout:` for the initial
  connection. `TCPSocket.new` raises `IO::TimeoutError` when the caller's timeout
  expires; OS-level timeouts and some `Socket.tcp` timeout paths can raise
  `Errno::ETIMEDOUT`.
- `Tempfile.create(anonymous: true)` immediately removes the directory entry,
  leaving an open handle usable without later cleaning up a pathname.

## Runtime configuration and diagnostics

- Enable the experimental `Ruby::Box` API with `RUBY_BOX=1` at launch. A box
  isolates loaded definitions, including monkey patches, class and global
  variable changes, and Ruby and native libraries.
- `GC.config` can change settings on the running collector.
  `GC.config(rgengc_allow_full_mark: false)` restricts marking to young objects;
  the setting defaults to `true`.
- Configure with `--with-modular-gc` to select a collector at runtime through
  `RUBY_GC_LIBRARY`. On a machine with Rust, build the experimental MMTk collector
  with `make modular-gc MODULAR_GC=mmtk`, then run with `RUBY_GC_LIBRARY=mmtk`.
- Backtrace labels use single quotes at both ends and qualify methods with
  permanently named classes, as in `in 'Object#foo'`. Separate `rescue` and
  `ensure` frames disappear; these changes also affect `Kernel#caller` and
  `Thread::Backtrace::Location`. Backtraces omit `<internal:...>` frames.
- `Exception#set_backtrace` accepts `Thread::Backtrace::Location` arrays, so a
  handler can pass `caller_locations` directly. `Kernel#raise`, `Thread#raise`,
  and `Fiber#raise` accept the same backtrace format.
- Verbose mode (`-w`) can warn about ignored blocks; `-W:strict_unused_block`
  enables the category explicitly. Redefining optimized methods such as
  `String#freeze` or `Integer#+` can warn with `-W:performance`.

## JIT configuration

- Build with Rust 1.85.0 or later for experimental ZJIT support, then enable it
  with `ruby --zjit` or `RubyVM::ZJIT.enable`. Ruby 4.0.10 enables ZJIT when
  configured with `--enable=zjit`. The `--rjit` flag is removed.
- `--yjit-mem-size` sets the unified YJIT memory limit, defaulting to 128 MiB.
  `RubyVM::YJIT.enable` adds `mem_size:` and `call_threshold:`.
- Enable compilation logging with `--yjit-log` or `RubyVM::YJIT.enable(log: true)`
  and read its tail with `RubyVM::YJIT.log`. Use `--yjit-trace-exits=COUNTER` for
  specific counted exits or `--yjit-perf=codegen` to attribute JIT code profiles
  to codegen functions.
- Collecting `ratio_in_yjit` requires building with `--enable-yjit=stats` and
  running with `--yjit-stats`.
- `--yjit-exec-mem-size` and `--zjit-exec-mem-size` reject values whose
  reservation size exceeds the unsigned 32-bit limit.

Files in this skill

  • SKILL.md8.3 KB
  • coverage.json417 B
  • references/concurrency-and-ractors.md2.5 KB
  • references/extensions-builds-and-packaging.md1.9 KB
  • references/io-networking-and-standard-library.md2.6 KB
  • references/language-and-core-types.md4.2 KB
  • references/runtime-diagnostics-and-jit.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.