Commit 0610126
fix: cross-env validation and docs for renderer password (#3090)
## Summary
Addresses all three follow-up items from PR #2829:
- **Ruby-side NODE_ENV checking**:
`validate_renderer_password_for_production` now checks both `RAILS_ENV`
and `NODE_ENV`, mirroring the Node-side
`runtimeEnvsAllowDevelopmentDefaults()`. Surfaces misconfigurations
(e.g. `NODE_ENV=production` + `RAILS_ENV=development`) at Rails boot
time instead of at Node request time.
- **Clarifying comment**: Added comment to
`defaultReplayServerAsyncOperationLogs()` explaining the intentional
asymmetry — it only checks `NODE_ENV` because async log replay is a JS
debugging concern, not a security boundary.
- **Unconditional validator call**: Moved
`validate_renderer_password_for_production` from inside
`setup_renderer_password` to `setup_config_values`, making enforcement
unconditional and resilient to future refactors of the password
resolution logic.
Closes #2887
## Test plan
- [x] All 51 Ruby configuration specs pass (including 4 new cross-env
tests)
- [x] All 31 Node renderer configBuilder tests pass
- [x] RuboCop clean
- [x] ESLint + Prettier clean
- [ ] CI passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Tightens production-like startup validation for the Node renderer
password, which can cause previously misconfigured deployments to fail
fast at Rails boot. Changes are localized to configuration/validation
paths with expanded spec coverage.
>
> **Overview**
> Ensures `RENDERER_PASSWORD` enforcement is **fail-closed and
consistent across Ruby and Node** by validating against both `RAILS_ENV`
and `NODE_ENV`, including rejecting mixed-env setups (e.g.
`NODE_ENV=production` + `RAILS_ENV=development`).
>
> Moves `validate_renderer_password_for_production` to run
unconditionally during Rails `setup_config_values`, updates the error
message docs/matrix accordingly, and expands Ruby specs to cover the new
cross-env scenarios.
>
> Adds a clarifying comment in the Node `configBuilder` that
`defaultReplayServerAsyncOperationLogs()` intentionally keys only off
`NODE_ENV` (debugging behavior, not a security boundary).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5a01f45. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Strengthened production validation for the Node renderer to prevent
misconfiguration in mixed or production envs.
* **Documentation**
* Clarified default server operation logging behavior and updated
environment-related messaging.
* **Tests**
* Expanded test coverage for environment-variable combinations to ensure
consistent behavior across deployment and development scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4d92580 commit 0610126
4 files changed
Lines changed: 100 additions & 27 deletions
File tree
- react_on_rails_pro
- lib/react_on_rails_pro
- sig/react_on_rails_pro
- spec/react_on_rails_pro
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| |||
Lines changed: 15 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
260 | 261 | | |
261 | 262 | | |
262 | 263 | | |
263 | | - | |
264 | | - | |
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
| |||
270 | 269 | | |
271 | 270 | | |
272 | 271 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
Lines changed: 79 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | 166 | | |
| 167 | + | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | | - | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
196 | | - | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
208 | 234 | | |
209 | 235 | | |
210 | 236 | | |
| |||
215 | 241 | | |
216 | 242 | | |
217 | 243 | | |
218 | | - | |
| 244 | + | |
219 | 245 | | |
220 | 246 | | |
221 | 247 | | |
| |||
229 | 255 | | |
230 | 256 | | |
231 | 257 | | |
232 | | - | |
| 258 | + | |
233 | 259 | | |
234 | 260 | | |
235 | 261 | | |
| |||
240 | 266 | | |
241 | 267 | | |
242 | 268 | | |
243 | | - | |
| 269 | + | |
244 | 270 | | |
245 | 271 | | |
246 | 272 | | |
| |||
251 | 277 | | |
252 | 278 | | |
253 | 279 | | |
254 | | - | |
| 280 | + | |
255 | 281 | | |
256 | 282 | | |
257 | 283 | | |
| |||
266 | 292 | | |
267 | 293 | | |
268 | 294 | | |
269 | | - | |
| 295 | + | |
270 | 296 | | |
271 | 297 | | |
272 | 298 | | |
| |||
283 | 309 | | |
284 | 310 | | |
285 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
286 | 315 | | |
287 | 316 | | |
288 | 317 | | |
289 | | - | |
| 318 | + | |
290 | 319 | | |
291 | 320 | | |
292 | 321 | | |
| |||
297 | 326 | | |
298 | 327 | | |
299 | 328 | | |
300 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
301 | 366 | | |
302 | 367 | | |
303 | 368 | | |
| |||
311 | 376 | | |
312 | 377 | | |
313 | 378 | | |
314 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
315 | 382 | | |
316 | 383 | | |
317 | 384 | | |
| |||
0 commit comments