bp3-activestorage 0.1.5 → 0.2.0

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: 9a0ea6328c63cb70ea785d2842dac2ef526f85681c14debc226c89c47175bc78
4
- data.tar.gz: 6471cfc53197041d0643d4dbc64b79ea545d90e55fe17a9e5262d0e93f4d4a13
3
+ metadata.gz: c92e9ed2f063e2d3d1a777bdd9f3d3ddb23892a9ad70ef54796c4b4abf2e5f43
4
+ data.tar.gz: f6bcf3de5ed1ee85c69dcebab7281bbde03049f927b455e4535928d592d8ec58
5
5
  SHA512:
6
- metadata.gz: d76a87d531729ccdb45a03f1a1cf57ea40681f744720f8fc80919924c3bd16709f136bca306da6e72ee9892547bc39b8bd7b039986382ce3c4e791c919910e67
7
- data.tar.gz: 719c8989bece6050ab37625e9a7192bc88f867f446bad5f979c6efa5e65f08a1de764bc9dd5352f18b080f14e1629c8c3686b6a6e511a8355a9554b4c6e037e0
6
+ metadata.gz: a2fb3b472e8299d518b954a56b5a973a91601d23ad8dd7c9555b49b441423f4ddd44e0e6f166b2a33d34b2963c6d85c69b2ba33984dadf4cef2e16c07fabd990
7
+ data.tar.gz: 37c2134952350031e4d4a994468d4e38f8a566a83257e59ffcf0d310a904f639cc660d648818b307f5a2b124f699bc5f119092a40089a81f2caae3f6e217b003
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2026-10-30
4
+
5
+ ### Security
6
+
7
+ - Refuse `ActiveStorage::Blob#key` to explore, as it locates the file in storage
8
+ - Require bp3-core 0.4.0, for `unexplorable_columns`
9
+
3
10
  ## [0.1.5] - 2026-01-12
4
11
 
5
12
  - Update gems
data/CLAUDE.md ADDED
@@ -0,0 +1,56 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ bp3-activestorage adapts `activestorage` for BP3 (persuavis/black_phoebe_3), a multi-site multi-tenant
8
+ Rails application. It makes ActiveStorage's records and controllers BP3-aware. There is nothing to
9
+ configure: adding the gem is enough.
10
+
11
+ ## Commands
12
+
13
+ The gems run on Ruby 3.4.6 (`.ruby-version`). Prefix commands with `~/.rvm/bin/rvm 3.4.6 do` when the
14
+ shell is not already on it; a missing `rspec` means the wrong Ruby, not a missing bundle.
15
+
16
+ - `bundle exec rake` - specs and RuboCop (the default task)
17
+ - `bundle exec rspec spec/path/to/file_spec.rb[:LINE]` - one file or example
18
+ - `bundle exec rubocop` / `bundle exec rubocop -a`
19
+ - `bin/setup`, `bin/console`, `rake install`
20
+
21
+ ## Architecture
22
+
23
+ `lib/bp3/activestorage/railtie.rb` reopens five classes in an `after_initialize` block. The Railtie is
24
+ only defined when `Rails.env` is.
25
+
26
+ **Models**: `ActiveStorage::Attachment`, `Blob` and `VariantRecord`
27
+ - include `Bp3::Core::Rqid`, `Sqnr` and `Ransackable` (Blob also `Displayable`), call
28
+ `use_sqnr_for_ordering` and `has_paper_trail`
29
+ - declare optional `belongs_to :sites_site` (aliased `site`) and `belongs_to :tenant` by hand
30
+ - define `table_name_basis`, the table name without its `public.` schema prefix
31
+ - **Do not include `Bp3::Core::Tenantable`.** Its callbacks set site and tenant behind the scenes and its
32
+ default scope then hides blobs that a later lookup needs to find
33
+ - Blob's `version_filter_mask` is `'[FILTERED][AB]'`
34
+
35
+ **Controllers**: `ActiveStorage::BaseController` and `ActiveStorage::Representations::ProxyController`
36
+ include `Bp3::Core::Actions`, `Settings`, `FeatureFlags` and `Cookies`, so file requests get the same site,
37
+ tenant and request tracking as the rest of the application. They do not authenticate;
38
+ `authenticate_root!` breaks the proxy controller.
39
+
40
+ ## Testing
41
+
42
+ The spec only checks the version; the Railtie needs a Rails application with a database to exercise. Try a
43
+ change against the application (black_phoebe_3) by putting this repo's `lib` ahead of the bundled gem.
44
+
45
+ ## Code Style
46
+
47
+ - RuboCop (`.rubocop.yml`): target Ruby 3.2.2, NewCops, rubocop-rake and rubocop-rspec; AbcSize 26,
48
+ MethodLength 15, BlockLength 66, ModuleLength 150; `Lint/ConstantDefinitionInBlock` and `Lint/Void`
49
+ are off for `lib/bp3/**/railtie.rb`, where classes are reopened inside a block
50
+ - Every file starts with `# frozen_string_literal: true`
51
+ - American English; no trailing whitespace on any added or modified line
52
+
53
+ ## Release
54
+
55
+ Bump `lib/bp3/activestorage/version.rb` and add a `CHANGELOG.md` entry. `rake release` tags, pushes and
56
+ publishes to rubygems.org; leave releasing and committing to the user.
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bp3-activestorage (0.1.5)
4
+ bp3-activestorage (0.2.0)
5
5
  activestorage (~> 8.1)
6
- bp3-core (>= 0.1.0)
6
+ bp3-core (>= 0.4.0)
7
7
  paper_trail (>= 15.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (8.1.2)
13
- actionview (= 8.1.2)
14
- activesupport (= 8.1.2)
12
+ actionpack (8.1.4)
13
+ actionview (= 8.1.4)
14
+ activesupport (= 8.1.4)
15
15
  nokogiri (>= 1.8.5)
16
16
  rack (>= 2.2.4)
17
17
  rack-session (>= 1.0.1)
@@ -19,28 +19,28 @@ GEM
19
19
  rails-dom-testing (~> 2.2)
20
20
  rails-html-sanitizer (~> 1.6)
21
21
  useragent (~> 0.16)
22
- actionview (8.1.2)
23
- activesupport (= 8.1.2)
22
+ actionview (8.1.4)
23
+ activesupport (= 8.1.4)
24
24
  builder (~> 3.1)
25
25
  erubi (~> 1.11)
26
26
  rails-dom-testing (~> 2.2)
27
27
  rails-html-sanitizer (~> 1.6)
28
- activejob (8.1.2)
29
- activesupport (= 8.1.2)
28
+ activejob (8.1.4)
29
+ activesupport (= 8.1.4)
30
30
  globalid (>= 0.3.6)
31
- activemodel (8.1.2)
32
- activesupport (= 8.1.2)
33
- activerecord (8.1.2)
34
- activemodel (= 8.1.2)
35
- activesupport (= 8.1.2)
31
+ activemodel (8.1.4)
32
+ activesupport (= 8.1.4)
33
+ activerecord (8.1.4)
34
+ activemodel (= 8.1.4)
35
+ activesupport (= 8.1.4)
36
36
  timeout (>= 0.4.0)
37
- activestorage (8.1.2)
38
- actionpack (= 8.1.2)
39
- activejob (= 8.1.2)
40
- activerecord (= 8.1.2)
41
- activesupport (= 8.1.2)
37
+ activestorage (8.1.4)
38
+ actionpack (= 8.1.4)
39
+ activejob (= 8.1.4)
40
+ activerecord (= 8.1.4)
41
+ activesupport (= 8.1.4)
42
42
  marcel (~> 1.0)
43
- activesupport (8.1.2)
43
+ activesupport (8.1.4)
44
44
  base64
45
45
  bigdecimal
46
46
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -55,8 +55,8 @@ GEM
55
55
  uri (>= 0.13.1)
56
56
  ast (2.4.3)
57
57
  base64 (0.3.0)
58
- bigdecimal (4.0.1)
59
- bp3-core (0.2.0)
58
+ bigdecimal (4.1.3)
59
+ bp3-core (0.4.0)
60
60
  actionview (~> 8.1)
61
61
  activesupport (~> 8.1)
62
62
  bp3-request_state (~> 0.1)
@@ -65,54 +65,59 @@ GEM
65
65
  activesupport (~> 8.1)
66
66
  request_store (>= 1.5.1)
67
67
  builder (3.3.0)
68
- byebug (12.0.0)
69
- concurrent-ruby (1.3.6)
68
+ byebug (13.0.0)
69
+ reline (>= 0.6.0)
70
+ concurrent-ruby (1.3.8)
70
71
  connection_pool (3.0.2)
71
- crass (1.0.6)
72
+ crass (1.0.8)
72
73
  diff-lcs (1.6.2)
73
74
  drb (2.2.3)
74
75
  erubi (1.13.1)
75
- globalid (1.3.0)
76
+ globalid (1.4.0)
76
77
  activesupport (>= 6.1)
77
- i18n (1.14.8)
78
+ i18n (1.15.2)
78
79
  concurrent-ruby (~> 1.0)
79
- json (2.18.0)
80
- language_server-protocol (3.17.0.5)
80
+ io-console (0.9.5)
81
+ json (3.1.0)
82
+ language_server-protocol (3.17.0.6)
81
83
  lint_roller (1.1.0)
82
84
  logger (1.7.0)
83
- loofah (2.25.0)
85
+ loofah (2.25.2)
84
86
  crass (~> 1.0.2)
85
87
  nokogiri (>= 1.12.0)
86
- marcel (1.1.0)
87
- minitest (6.0.1)
88
+ marcel (1.2.1)
89
+ minitest (6.0.6)
90
+ drb (~> 2.0)
88
91
  prism (~> 1.5)
89
- nokogiri (1.19.0-x86_64-darwin)
92
+ nokogiri (1.19.4-x86_64-darwin)
90
93
  racc (~> 1.4)
91
94
  paper_trail (17.0.0)
92
95
  activerecord (>= 7.1)
93
96
  request_store (~> 1.4)
94
- parallel (1.27.0)
95
- parser (3.3.10.0)
97
+ parallel (2.3.0)
98
+ parser (3.3.13.0)
96
99
  ast (~> 2.4.1)
97
100
  racc
98
- prism (1.7.0)
101
+ prism (1.9.0)
99
102
  racc (1.8.1)
100
- rack (3.2.4)
101
- rack-session (2.1.1)
103
+ rack (3.2.8)
104
+ rack-session (2.1.2)
102
105
  base64 (>= 0.1.0)
103
106
  rack (>= 3.0.0)
104
- rack-test (2.2.0)
107
+ rack-test (2.3.0)
105
108
  rack (>= 1.3)
106
109
  rails-dom-testing (2.3.0)
107
110
  activesupport (>= 5.0.0)
108
111
  minitest
109
112
  nokogiri (>= 1.6)
110
- rails-html-sanitizer (1.6.2)
111
- loofah (~> 2.21)
113
+ rails-html-sanitizer (1.7.1)
114
+ loofah (~> 2.25, >= 2.25.2)
112
115
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
113
116
  rainbow (3.1.1)
114
- rake (13.3.1)
115
- regexp_parser (2.11.3)
117
+ rake (13.4.2)
118
+ regexp_parser (2.13.1)
119
+ reline (0.7.0)
120
+ io-console (~> 0.5)
116
121
  request_store (1.7.0)
117
122
  rack (>= 1.4)
118
123
  rspec (3.13.2)
@@ -124,39 +129,40 @@ GEM
124
129
  rspec-expectations (3.13.5)
125
130
  diff-lcs (>= 1.2.0, < 2.0)
126
131
  rspec-support (~> 3.13.0)
127
- rspec-mocks (3.13.7)
132
+ rspec-mocks (3.13.8)
128
133
  diff-lcs (>= 1.2.0, < 2.0)
129
134
  rspec-support (~> 3.13.0)
130
- rspec-support (3.13.6)
131
- rubocop (1.82.1)
132
- json (~> 2.3)
135
+ rspec-support (3.13.7)
136
+ rubocop (1.92.2)
137
+ json (>= 2.3)
133
138
  language_server-protocol (~> 3.17.0.2)
134
139
  lint_roller (~> 1.1.0)
135
- parallel (~> 1.10)
140
+ parallel (>= 1.10)
136
141
  parser (>= 3.3.0.2)
137
142
  rainbow (>= 2.2.2, < 4.0)
138
- regexp_parser (>= 2.9.3, < 3.0)
139
- rubocop-ast (>= 1.48.0, < 2.0)
143
+ regexp_parser (>= 2.11.3, < 3.0)
144
+ rubocop-ast (>= 1.49.0, < 2.0)
140
145
  ruby-progressbar (~> 1.7)
141
146
  unicode-display_width (>= 2.4.0, < 4.0)
142
- rubocop-ast (1.49.0)
147
+ rubocop-ast (1.50.0)
143
148
  parser (>= 3.3.7.2)
144
149
  prism (~> 1.7)
145
150
  rubocop-rake (0.7.1)
146
151
  lint_roller (~> 1.1)
147
152
  rubocop (>= 1.72.1)
148
- rubocop-rspec (3.9.0)
153
+ rubocop-rspec (3.10.2)
149
154
  lint_roller (~> 1.1)
150
- rubocop (~> 1.81)
155
+ regexp_parser (>= 2.0)
156
+ rubocop (~> 1.86, >= 1.86.2)
151
157
  ruby-progressbar (1.13.0)
152
158
  securerandom (0.4.1)
153
- timeout (0.6.0)
159
+ timeout (0.6.1)
154
160
  tzinfo (2.0.6)
155
161
  concurrent-ruby (~> 1.0)
156
- unicode-display_width (3.2.0)
157
- unicode-emoji (~> 4.1)
158
- unicode-emoji (4.2.0)
159
- uri (1.1.1)
162
+ unicode-display_width (3.3.0)
163
+ unicode-emoji (~> 4.3)
164
+ unicode-emoji (4.3.0)
165
+ uri (1.1.2)
160
166
  useragent (0.16.11)
161
167
 
162
168
  PLATFORMS
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.require_paths = ['lib']
33
33
 
34
34
  spec.add_dependency 'activestorage', '~> 8.1'
35
- spec.add_dependency 'bp3-core', '>= 0.1.0'
35
+ spec.add_dependency 'bp3-core', '>= 0.4.0'
36
36
  spec.add_dependency 'paper_trail', '>= 15.1'
37
37
 
38
38
  spec.add_development_dependency 'byebug'
@@ -2,7 +2,7 @@
2
2
 
3
3
  # require 'rails/railtie'
4
4
 
5
- # rubocop:disable Metrics/BlockLength
5
+ # rubocop:disable-next Metrics/BlockLength
6
6
  module Bp3
7
7
  module Activestorage
8
8
  if defined?(Rails.env)
@@ -41,6 +41,9 @@ module Bp3
41
41
  include Bp3::Core::Displayable
42
42
  include Bp3::Core::Ransackable
43
43
 
44
+ # The key locates the file in storage, so it is not to be guessed at one character at a time
45
+ self.unexplorable_columns = %w[key]
46
+
44
47
  use_sqnr_for_ordering
45
48
  has_paper_trail
46
49
 
@@ -107,4 +110,3 @@ module Bp3
107
110
  end
108
111
  end
109
112
  end
110
- # rubocop:enable Metrics/BlockLength
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bp3
4
4
  module Activestorage
5
- VERSION = '0.1.5'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bp3-activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wim den Braven
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.1.0
32
+ version: 0.4.0
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 0.1.0
39
+ version: 0.4.0
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: paper_trail
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +145,7 @@ files:
145
145
  - ".rubocop.yml"
146
146
  - ".yardopts"
147
147
  - CHANGELOG.md
148
+ - CLAUDE.md
148
149
  - Gemfile
149
150
  - Gemfile.lock
150
151
  - LICENSE.txt
@@ -179,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
180
  - !ruby/object:Gem::Version
180
181
  version: '0'
181
182
  requirements: []
182
- rubygems_version: 3.6.9
183
+ rubygems_version: 4.0.4
183
184
  specification_version: 4
184
185
  summary: bp3-activestorage adapts activestorage for BP3 (persuavis/black_phoebe_3).
185
186
  test_files: []