Commit fb3de1b
fix: address remaining PR C review feedback (security, robustness, docs)
Post-revision review surfaced 7 new actionable items. All fixed.
Code:
1. PREVIOUS_BUNDLE_HASHES path-traversal (claude): env values are used
as directory names under the renderer cache; a malicious or mistyped
value like "../../../etc" would escape the cache dir. Now reject
anything that doesn't match /\A[A-Za-z0-9_\-.]+\z/ with a warning.
2. node_renderer? guard in publish_current_bundle_if_configured
(claude): returns early when ExecJS is configured rather than
crashing on NodeRenderingPool.server_bundle_hash. Mirrors the
guard used by PreSeedRendererCache.
5. Top-level rescue in publish_current_bundle_if_configured (cursor
Medium): collect_assets / server_bundle_hash / rsc_bundle_js_file_path
can all raise from the setup code that ran before the per-upload
rescue. Extracted publish_bundles helper and wrapped the whole
publication path with StandardError rescue so a failure degrades
next-deploy seeding but doesn't fail this deploy's assets:precompile.
7. Partial-staging cleanup on asset failure (codex P1): previously if
stage_file succeeded on the bundle but failed on an asset, the
cache held a bundle file without its companion manifests. The
renderer would then find the bundle and serve without those
manifests, causing hydration breakage instead of the clean 410
retry fallback. Now rm_rf the hash directory on any failure inside
seed_previous_hash — restores the 410-retry safety net.
Docs:
3. Control Plane fetch example: replaced Dir[tmp/*.json] with an
explicit allowlist so stray JSON metadata in the image layer
isn't silently picked up.
4. S3 client mutex: @s3 ||= is not thread-safe under concurrent
callers (parallel workers running precompile hooks). Example now
uses a Mutex-synchronized memoizer with a doc comment.
6. S3 manifest RETENTION alignment: write and read both trim to
RETENTION now, so the persisted manifest matches what discovery
returns. Added a comment explaining the intent.
Tests: 40 rolling-deploy + pre-seed + shim specs (was 38, +2 for
path-traversal reject and partial-staging cleanup). Rubocop clean.
Refs: #3122, #3173
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 2e9b3f8 commit fb3de1b
4 files changed
Lines changed: 88 additions & 4 deletions
File tree
- docs/pro
- react_on_rails_pro
- lib/react_on_rails_pro
- spec/dummy/spec
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
161 | 167 | | |
162 | | - | |
| 168 | + | |
163 | 169 | | |
164 | 170 | | |
165 | 171 | | |
| |||
181 | 187 | | |
182 | 188 | | |
183 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
187 | | - | |
| 196 | + | |
188 | 197 | | |
189 | 198 | | |
190 | 199 | | |
| |||
233 | 242 | | |
234 | 243 | | |
235 | 244 | | |
236 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
237 | 251 | | |
238 | 252 | | |
239 | 253 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
| |||
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
63 | 76 | | |
64 | 77 | | |
65 | 78 | | |
| |||
86 | 99 | | |
87 | 100 | | |
88 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
89 | 108 | | |
90 | | - | |
| 109 | + | |
91 | 110 | | |
92 | 111 | | |
93 | 112 | | |
| |||
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
149 | 186 | | |
150 | 187 | | |
151 | 188 | | |
| |||
0 commit comments