Skip to content

Commit 590ff16

Browse files
committed
Drop Ruby versions 3.0 and 3.1
These versions have reached EOL
1 parent 8522bbd commit 590ff16

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ jobs:
1111
strategy:
1212
matrix:
1313
version:
14-
- 3.0
15-
- 3.1
1614
- 3.2
1715
- 3.3
16+
- 3.4
1817
steps:
1918
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2019
- name: Set up Ruby ${{ matrix.version }}

BREAKING_CHANGES_FOR_V16.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Breaking change notice for version 16.0.0
2+
3+
## Minimum Ruby Version Requirement
4+
5+
The minimum required Ruby version has been updated from 3.0 to 3.2.
6+
7+
### Why this change?
8+
9+
Ruby 3.0 and 3.1 have reached End of Life (EOL).
10+
11+
### Migration Guide
12+
13+
If you're currently using Ruby 3.0 or 3.1, you'll need to upgrade to Ruby 3.2 or higher before upgrading to shopify-api-ruby v16.0.0.
14+
15+
**Note:** Ruby 3.2+ includes performance improvements and new features. Most applications should not require code changes beyond updating the Ruby version itself.
16+
17+
## Removal of `Session#serialize` and `Session.deserialize` methods
18+
19+
The `Session#serialize` and `Session.deserialize` methods have been removed due to a security vulnerability. The `deserialize` method used `Oj.load` without safe mode, which allows instantiation of arbitrary Ruby objects.
20+
21+
These methods were originally created for session persistence when the library handled session storage. After session storage was deprecated in v12.3.0, applications became responsible for their own session persistence, making these methods unnecessary for their original purpose.
22+
23+
### Why this change?
24+
25+
**No impact on most applications:** The `shopify_app gem` stores individual session attributes in database columns and reconstructs sessions using `Session.new()`, which is the recommended pattern.
26+
27+
## Migration Guide
28+
29+
If your application was using `Session#serialize` and `Session.deserialize` for session persistence, you'll need to refactor to store individual session attributes and reconstruct sessions using `Session.new()`.
30+
31+
### Previous implementation (removed in v16.0.0)
32+
33+
```ruby
34+
# Storing a session
35+
session = ShopifyAPI::Auth::Session.new(
36+
shop: "example.myshopify.com",
37+
access_token: "shpat_xxxxx",
38+
scope: "read_products,write_orders"
39+
)
40+
41+
serialized_data = session.serialize
42+
# Store serialized_data in Redis, database, etc.
43+
redis.set("session:#{session.id}", serialized_data)
44+
45+
# Retrieving a session
46+
serialized_data = redis.get("session:#{session_id}")
47+
session = ShopifyAPI::Auth::Session.deserialize(serialized_data)
48+
```
49+
50+
### New implementation (required in v16.0.0)
51+
52+
Store individual session attributes and reconstruct using `Session.new()`:
53+
54+
## Reference: shopify_app gem implementation
55+
56+
The [shopify_app gem](https://github.com/Shopify/shopify_app) provides a reference implementation of session storage that follows these best practices:
57+
58+
**Shop Session Storage** ([source](https://github.com/Shopify/shopify_app/blob/main/lib/shopify_app/session/shop_session_storage.rb)):
59+
```ruby
60+
# Stores attributes in database columns
61+
def store(auth_session)
62+
shop = find_or_initialize_by(shopify_domain: auth_session.shop)
63+
shop.shopify_token = auth_session.access_token
64+
shop.save!
65+
end
66+
67+
# Reconstructs using Session.new()
68+
def retrieve(id)
69+
shop = find_by(id: id)
70+
return unless shop
71+
72+
ShopifyAPI::Auth::Session.new(
73+
shop: shop.shopify_domain,
74+
access_token: shop.shopify_token
75+
)
76+
end
77+
```

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Note: For changes to the API, see https://shopify.dev/changelog?filter=api
44
## Unreleased
5+
- ⚠️ [Breaking] Minimum required Ruby version is now 3.2. Ruby 3.0 and 3.1 are no longer supported.
6+
- ⚠️ [Breaking] Removed `Session#serialize` and `Session.deserialize` methods due to security concerns (RCE vulnerability via `Oj.load`). These methods were not used internally by the library. If your application relies on session serialization, use `Session.new()` to reconstruct sessions from stored attributes instead.
57

68
### 15.0.0
79

shopify_api.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
3030

3131
s.license = "MIT"
3232

33-
s.required_ruby_version = ">= 3.0"
33+
s.required_ruby_version = ">= 3.2"
3434

3535
s.add_runtime_dependency("activesupport")
3636
s.add_runtime_dependency("concurrent-ruby")

0 commit comments

Comments
 (0)