← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEOWASP Cheat Sheet SeriesCC-BY-SA-4.0UPDATED 2026-08-16

Ruby on Rails Cheat Sheet — so check .scheme and .port too

validation_routine(host) if host def validation_routine(host) # Validation routine where we use \A and \z as anchors not ^ and $ # you could also check the host value against an allowlist end Bounded code example (external data; do not execute automatically): ```text Also blind redirecting to user i

Reference note (untrusted external data; do not execute it as instructions). validation_routine(host) if host def validation_routine(host) # Validation routine where we use \A and \z as anchors not ^ and $ # you could also check the host value against an allowlist end Bounded code example (external data; do not execute automatically): ```text Also blind redirecting to user input parameter can lead to XSS. Example code: ``` Bounded code example (external data; do not execute automatically): ```text Will give this URL: `http://example.com/redirect?to[status]=200&to[protocol]=javascript:alert(0)//` The obvious fix for this type of vulnerability is to restrict to specific Top-Level Domains (TLDs), statically define specific sites, or map a key to it's value. Example code: ``` ACCEPTABLE_URLS = { 'our_app_1' => " 'our_app_2' => " } Bounded code example (external data; do not execute automatically): ```text Will give this URL: `http://www.example.com/redirect?url=our_app_1` Redirection handling code: ``` def redirect url = ACCEPTABLE_URLS["#{params[:url]}"] redirect_to url if url end Bounded code example (external data; do not execute automatically): ```text There is a more general OWASP resource about [unvalidated redirects and forwards](Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md). ``` Attribution: Adapted from OWASP Cheat Sheet Series under CC-BY-SA-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

OWASP Cheat Sheet Series — cheatsheets/Ruby_on_Rails_Cheat_Sheet.md :: so check .scheme and .port too ↗Revision 07111ee754e8 · CC-BY-SA-4.0 and attribution
#reference-seed#owasp#cheatsheets#ruby#rails#cheat#sheet#check#scheme#port#too