Hardening & Secrets
Rails ships its own defences: forgery tokens, encrypted credentials, column encryption, CSP and host checks, and rate_limit. Interviewers ask which are on by default and which you must enable.
part ofRuby on Railsread it →on this pageshowhide
explore
- Forgery Protection5 questions
- Credentials & Master Key5 questions
- Column-Level Encryption5 questions
- CSP, SSL & Host Rules6 questions
- Injection & Brakeman Scans6 questions
- Per-Action Throttling5 questions
questions
page 2 of 2In Rails 8.1, which header does config.permissions_policy actually emit, and how does a controller override it for one action?
level: middleimportance: nice to knowfreq 15%
basics
~10 sDespite its name, Rails 8.1's permissions_policy DSL writes the legacy Feature-Policy header; a controller's permissions_policy only: block edits a clone of the global policy, which must exist because the override cannot start from nothing.
In a Rails 8.1 app, what can the rate_limit macro not protect that a Rack middleware limiter can, and what does each layer know about the request?
level: seniorimportance: nice to knowfreq 20%
basics
~20 srate_limit is a before_action, so it guards only actions that declare it, after middleware, routing and controller setup; a Rack middleware limiter sees every request earlier and more cheaply, but without the controller's knowledge of the user.
showing 31–32 of 32