Skip to content

Commit f06c2b6

Browse files
ehelmsclaude
andcommitted
Fix unsafe redirect error in cockpit controller
Add allow_other_host: true parameter to redirect_to call to address Rails security changes that now require explicit permission for redirects to other hosts. The redirect is already validated against the expected hostname on line 24, making this safe. Fixes test failures: - test_0008_should allow redirect to valid cockpit URL - test_0009_should allow redirect with http scheme to same hostname - test_0010_should handle case insensitive scheme validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c4d6e27 commit f06c2b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/cockpit_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def redirect
2424
return invalid_request unless redir_url.hostname == expected_hostname
2525

2626
redir_url.query = "access_token=#{request.session_options[:id]}"
27-
redirect_to(redir_url.to_s)
27+
redirect_to(redir_url.to_s, allow_other_host: true)
2828
end
2929

3030
private

0 commit comments

Comments
 (0)