Skip to content

Fail-closed json/plain Oj deserialize (SECBUGS-174) - #359

Open
d2army wants to merge 6 commits into
transfers-masterfrom
ian-yap/secbugs-174-fail-closed-json-plain
Open

Fail-closed json/plain Oj deserialize (SECBUGS-174)#359
d2army wants to merge 6 commits into
transfers-masterfrom
ian-yap/secbugs-174-fail-closed-json-plain

Conversation

@d2army

@d2army d2army commented Aug 27, 2026

Copy link
Copy Markdown

Summary

  • Fail-closed Temporal::JSON.deserialize for SECBUGS-174: JSON.parse first, reject disallowed Oj class directives, then Oj.load the original bytes so encode, symbol keys, and ^t stay compatible.
  • Instances reconstitute only for loaded Temporal:: types, loaded ::Request / ::Response (custody Go json:"^o"), loaded Exception subclasses (error serialization v2), Oj Exception backtrace types (Thread::Backtrace), and Temporal::JSON.allow_class. Anonymous Structs (^u with member names) round-trip. ^c class references require a loaded constant. Gadget classes such as Gem::Requirement raise Temporal::JSONDisallowedClassError before Oj.load.
  • Encoding name stays json/plain. This PR is 0.0.7 on transfers-master. #356 waits and is now 0.0.8.
  • CI now runs on transfers-master PRs. test_gem pins google-protobuf ~> 3.25. test_examples uses docker compose v2, pinned Temporal 1.22.4 images, and waits for port 7233. Tracking: COR3-130.

Test plan

  • bundle exec rspec spec/unit (629 examples, 0 failures)
  • Go-style {"^o":"...::Request","scope":"..."} reconstitutes a loaded Request
  • Gem::Requirement / Kernel / nested gadgets raise before Oj.load
  • Temporal::Metadata::Workflow, anonymous Struct, and raised Exception (including Thread::Backtrace) round-trip
  • Failure serializer and error serialization v2 round-trips still pass
  • GitHub Actions test_gem and test_examples on this PR
  • After publish: bump custody lockfile temporal-ruby 0.0.6 and tx_service exact pin '0.0.6'

SECBUGS-174: reject arbitrary ^o instantiation while keeping custody
Request/Response payloads and error serialization v2 working.

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear

linear Bot commented Aug 27, 2026

Copy link
Copy Markdown

SECBUGS-174

d2army and others added 5 commits August 27, 2026 15:44
Unconstrained bundle install was pulling protobuf 4, which cannot load the generated stubs, and ubuntu-latest no longer ships docker-compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
docker compose now starts, but auto-setup is not ready after a 10s sleep, so register_namespace hits connection refused.

Co-authored-by: Cursor <cursoragent@cursor.com>
auto-setup: latest never bound gRPC with Cassandra 3.11 on GitHub runners. Dump compose logs if the wait still times out.
Co-authored-by: Cursor <cursoragent@cursor.com>
Example workflows return Metadata::Workflow and Struct.new results. Those are first-party Oj encodings, not gadget classes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Oj puts ^o Thread::Backtrace on ~bt_locations. Rename the unit file to json_spec.rb so CI actually runs it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant