spree_core 5.2.3 → 5.2.5
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/app/models/spree/ability.rb +2 -1
- data/app/models/spree/permission_sets/default_customer.rb +2 -2
- data/app/models/spree/product.rb +6 -4
- data/app/services/spree/checkout/update.rb +24 -0
- data/config/locales/en.yml +1 -0
- data/lib/spree/core/version.rb +1 -1
- data/spec/fixtures/favicon.ico +0 -0
- data/spec/fixtures/files/example.json +4 -0
- data/spec/fixtures/files/icon_256x256.gif +0 -0
- data/spec/fixtures/files/icon_256x256.png +0 -0
- data/spec/fixtures/files/icon_512x512.png +0 -0
- data/spec/fixtures/files/img_256x128.png +0 -0
- data/spec/fixtures/files/products_import.csv +18 -0
- data/spec/fixtures/text-file.txt +1 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- metadata +27 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d349836816cd2c1ec5919e21868926cd4eec24cb0c38c33cb744b37a9402dc9
|
|
4
|
+
data.tar.gz: 8072164578532d141040fe3aab664d91cb00c2c8571c3b9a043cd4ccb23f1aa1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ad9ed9392d8cb3b34cf3fa0c294dca288fe2c5162ed20c84616ef82c71e2368ea7debb5264208b26703df22640cb612e4deadb98882dcd872f8622197b8d0e5
|
|
7
|
+
data.tar.gz: a6cd8afa6b70d0fc758758c9555ab24da37800c7905220b7d5f0251bf19fa06f87d03315aba858476eb181705c32ba6d80fba4e387f419f892f7b1ec16631aac
|
data/app/models/spree/ability.rb
CHANGED
|
@@ -143,7 +143,8 @@ module Spree
|
|
|
143
143
|
can :update, ::Spree::Order do |order, token|
|
|
144
144
|
!order.completed? && (order.user == user || order.token && token == order.token)
|
|
145
145
|
end
|
|
146
|
-
|
|
146
|
+
# Address management - only for persisted users with matching user_id
|
|
147
|
+
can :manage, ::Spree::Address, user_id: user.id if user.persisted?
|
|
147
148
|
can [:read, :destroy], ::Spree::CreditCard, user_id: user.id
|
|
148
149
|
can :read, ::Spree::Product
|
|
149
150
|
can :read, ::Spree::ProductProperty
|
|
@@ -43,8 +43,8 @@ module Spree
|
|
|
43
43
|
can :create, Spree.user_class
|
|
44
44
|
can [:show, :update, :destroy], Spree.user_class, id: user.id
|
|
45
45
|
|
|
46
|
-
# Address management
|
|
47
|
-
can :manage, Spree::Address, user_id: user.id
|
|
46
|
+
# Address management - only for persisted users with matching user_id
|
|
47
|
+
can :manage, Spree::Address, user_id: user.id if user.persisted?
|
|
48
48
|
|
|
49
49
|
# Credit card management
|
|
50
50
|
can [:read, :destroy], Spree::CreditCard, user_id: user.id
|
data/app/models/spree/product.rb
CHANGED
|
@@ -204,10 +204,12 @@ module Spree
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
scope :by_best_selling, lambda { |order_direction = :desc|
|
|
207
|
-
left_joins(:
|
|
208
|
-
select(
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
left_joins(variants_including_master: { line_items: :order }).
|
|
208
|
+
select(
|
|
209
|
+
"#{Spree::Product.table_name}.*",
|
|
210
|
+
"COUNT(DISTINCT CASE WHEN #{Spree::Order.table_name}.completed_at IS NOT NULL THEN #{Spree::Order.table_name}.id END) AS completed_orders_count",
|
|
211
|
+
"COALESCE(SUM(CASE WHEN #{Spree::Order.table_name}.completed_at IS NOT NULL THEN (#{Spree::LineItem.table_name}.price * #{Spree::LineItem.table_name}.quantity) END), 0) AS completed_orders_total"
|
|
212
|
+
).
|
|
211
213
|
group("#{Spree::Product.table_name}.id").
|
|
212
214
|
order(completed_orders_count: order_direction, completed_orders_total: order_direction)
|
|
213
215
|
}
|
|
@@ -5,6 +5,10 @@ module Spree
|
|
|
5
5
|
include Spree::Addresses::Helper
|
|
6
6
|
|
|
7
7
|
def call(order:, params:, permitted_attributes:, request_env:)
|
|
8
|
+
# Validate address ownership to prevent IDOR attacks
|
|
9
|
+
address_ownership_error = validate_address_ownership(order, params)
|
|
10
|
+
return failure(order, address_ownership_error) if address_ownership_error
|
|
11
|
+
|
|
8
12
|
ship_changed = address_with_country_iso_present?(params, 'ship')
|
|
9
13
|
bill_changed = address_with_country_iso_present?(params, 'bill')
|
|
10
14
|
params[:order][:ship_address_attributes] = replace_country_iso_with_id(params[:order][:ship_address_attributes]) if ship_changed
|
|
@@ -26,6 +30,26 @@ module Spree
|
|
|
26
30
|
|
|
27
31
|
private
|
|
28
32
|
|
|
33
|
+
def validate_address_ownership(order, params)
|
|
34
|
+
return nil unless params[:order]
|
|
35
|
+
|
|
36
|
+
%w[bill ship].each do |address_kind|
|
|
37
|
+
address_id = params[:order].dig("#{address_kind}_address_attributes".to_sym, :id)
|
|
38
|
+
next unless address_id
|
|
39
|
+
|
|
40
|
+
address = Spree::Address.find_by(id: address_id)
|
|
41
|
+
next unless address
|
|
42
|
+
|
|
43
|
+
# Allow if address has no user (guest address) or belongs to the order's user
|
|
44
|
+
next if address.user_id.nil?
|
|
45
|
+
next if order.user_id.present? && address.user_id == order.user_id
|
|
46
|
+
|
|
47
|
+
return Spree.t(:address_not_owned_by_user)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
29
53
|
def address_with_country_iso_present?(params, address_kind = 'ship')
|
|
30
54
|
return false unless params.dig(:order, "#{address_kind}_address_attributes".to_sym, :country_iso)
|
|
31
55
|
return false if params.dig(:order, "#{address_kind}_address_attributes".to_sym, :country_id)
|
data/config/locales/en.yml
CHANGED
|
@@ -667,6 +667,7 @@ en:
|
|
|
667
667
|
successfully_updated: Updated successfully
|
|
668
668
|
unsuccessfully_saved: There was an error while trying to save your address.
|
|
669
669
|
unsuccessfully_updated: There was an update while trying to update your address.
|
|
670
|
+
address_not_owned_by_user: The specified address does not belong to this user.
|
|
670
671
|
address_settings: Address settings
|
|
671
672
|
addresses: Addresses
|
|
672
673
|
adjustable: Adjustable
|
data/lib/spree/core/version.rb
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
slug,sku,name,status,vendor_name,brand_name,description,meta_title,meta_description,meta_keywords,tags,labels,price,compare_at_price,currency,width,height,depth,dimensions_unit,weight,weight_unit,available_on,discontinue_on,track_inventory,inventory_count,inventory_backorderable,tax_category,digital,image1_src,image2_src,image3_src,option1_name,option1_value,option2_name,option2_value,option3_name,option3_value,category1,category2,category3,metafield.properties.fit,metafield.properties.manufacturer,metafield.properties.material,metafield.custom.brand,metafield.custom.material
|
|
2
|
+
denim-shirt,"",Denim Shirt,draft,,,Adipisci sapiente velit nihil ullam. Placeat cumque ipsa cupiditate velit magni sapiente mollitia dolorum. Veritatis esse illo eos perferendis. Perspiciatis vel iusto odio eveniet quam officia quidem. Fugiat a ipsum tempore optio accusantium autem in fugit.,,,,"","",0.0,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Default,false,,,,,,,,,,Categories -> Men -> Shirts,Categories -> Women,Categories -> Sportswear,Lose,Wannabe,90% Cotton 10% Elastan,,
|
|
3
|
+
denim-shirt,DENIM-SHIRT-XS-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,XS,,,,,
|
|
4
|
+
denim-shirt,DENIM-SHIRT-S-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,S,,,,,
|
|
5
|
+
denim-shirt,DENIM-SHIRT-M-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,M,,,,,
|
|
6
|
+
denim-shirt,DENIM-SHIRT-L-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,L,,,,,
|
|
7
|
+
denim-shirt,DENIM-SHIRT-XL-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Blue,Size,XL,,,,,
|
|
8
|
+
denim-shirt,DENIM-SHIRT-XS-LIGHT-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Light Blue,Size,XS,,,,,
|
|
9
|
+
denim-shirt,DENIM-SHIRT-S-LIGHT-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Light Blue,Size,S,,,,,
|
|
10
|
+
denim-shirt,DENIM-SHIRT-M-LIGHT-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Light Blue,Size,M,,,,,
|
|
11
|
+
denim-shirt,DENIM-SHIRT-L-LIGHT-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Light Blue,Size,L,,,,,
|
|
12
|
+
denim-shirt,DENIM-SHIRT-XL-LIGHT-BLUE,,,,,,,,,,,62.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:53,,true,100,true,Clothing,false,,,,Color,Light Blue,Size,XL,,,,,
|
|
13
|
+
checked-shirt,"",Checked Shirt,draft,,,Et ipsam repudiandae itaque tenetur laborum. Cupiditate nulla blanditiis quia tenetur doloremque possimus explicabo asperiores. Facere adipisci veniam aut nemo magnam.,,,,"","",0.0,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Default,false,,,,,,,,,,Categories -> Men -> Shirts,Categories -> Women,Categories -> Sportswear,Lose,Wannabe,10% Cotton 90% Elastan,,
|
|
14
|
+
checked-shirt,CHECKED-SHIRT-XS-RED,,,,,,,,,,,22.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Clothing,false,,,,Color,Red,Size,XS,,,,,
|
|
15
|
+
checked-shirt,CHECKED-SHIRT-S-RED,,,,,,,,,,,22.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Clothing,false,,,,Color,Red,Size,S,,,,,
|
|
16
|
+
checked-shirt,CHECKED-SHIRT-M-RED,,,,,,,,,,,22.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Clothing,false,,,,Color,Red,Size,M,,,,,
|
|
17
|
+
checked-shirt,CHECKED-SHIRT-L-RED,,,,,,,,,,,22.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Clothing,false,,,,Color,Red,Size,L,,,,,
|
|
18
|
+
checked-shirt,CHECKED-SHIRT-XL-RED,,,,,,,,,,,22.99,0.0,USD,,,,,0.0,lb,2025-10-09 14:35:54,,true,100,true,Clothing,false,,,,Color,Red,Size,XL,,,,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.2.
|
|
4
|
+
version: 5.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sean Schofield
|
|
@@ -273,6 +273,20 @@ dependencies:
|
|
|
273
273
|
- - "~>"
|
|
274
274
|
- !ruby/object:Gem::Version
|
|
275
275
|
version: '1.1'
|
|
276
|
+
- !ruby/object:Gem::Dependency
|
|
277
|
+
name: ostruct
|
|
278
|
+
requirement: !ruby/object:Gem::Requirement
|
|
279
|
+
requirements:
|
|
280
|
+
- - ">="
|
|
281
|
+
- !ruby/object:Gem::Version
|
|
282
|
+
version: '0'
|
|
283
|
+
type: :runtime
|
|
284
|
+
prerelease: false
|
|
285
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
286
|
+
requirements:
|
|
287
|
+
- - ">="
|
|
288
|
+
- !ruby/object:Gem::Version
|
|
289
|
+
version: '0'
|
|
276
290
|
- !ruby/object:Gem::Dependency
|
|
277
291
|
name: paranoia
|
|
278
292
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -1669,6 +1683,15 @@ files:
|
|
|
1669
1683
|
- lib/tasks/core.rake
|
|
1670
1684
|
- lib/tasks/dependencies.rake
|
|
1671
1685
|
- lib/tasks/exchanges.rake
|
|
1686
|
+
- spec/fixtures/favicon.ico
|
|
1687
|
+
- spec/fixtures/files/example.json
|
|
1688
|
+
- spec/fixtures/files/icon_256x256.gif
|
|
1689
|
+
- spec/fixtures/files/icon_256x256.png
|
|
1690
|
+
- spec/fixtures/files/icon_512x512.png
|
|
1691
|
+
- spec/fixtures/files/img_256x128.png
|
|
1692
|
+
- spec/fixtures/files/products_import.csv
|
|
1693
|
+
- spec/fixtures/text-file.txt
|
|
1694
|
+
- spec/fixtures/thinking-cat.jpg
|
|
1672
1695
|
- vendor/javascript/@rails--request.js.js
|
|
1673
1696
|
- vendor/javascript/@stimulus-components--auto-submit.js
|
|
1674
1697
|
- vendor/javascript/stimulus-reveal-controller.js
|
|
@@ -1680,9 +1703,9 @@ licenses:
|
|
|
1680
1703
|
- BSD-3-Clause
|
|
1681
1704
|
metadata:
|
|
1682
1705
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
|
1683
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v5.2.
|
|
1706
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v5.2.5
|
|
1684
1707
|
documentation_uri: https://docs.spreecommerce.org/
|
|
1685
|
-
source_code_uri: https://github.com/spree/spree/tree/v5.2.
|
|
1708
|
+
source_code_uri: https://github.com/spree/spree/tree/v5.2.5
|
|
1686
1709
|
rdoc_options: []
|
|
1687
1710
|
require_paths:
|
|
1688
1711
|
- lib
|
|
@@ -1697,7 +1720,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1697
1720
|
- !ruby/object:Gem::Version
|
|
1698
1721
|
version: 1.8.23
|
|
1699
1722
|
requirements: []
|
|
1700
|
-
rubygems_version:
|
|
1723
|
+
rubygems_version: 4.0.2
|
|
1701
1724
|
specification_version: 4
|
|
1702
1725
|
summary: The bare bones necessary for Spree
|
|
1703
1726
|
test_files: []
|