Skip to content

Fixes #39817 - Respect configured smart proxy names as Sinatra permitted_hosts - #960

Merged
adamruzicka merged 1 commit into
theforeman:developfrom
lhellebr:sat-49512-permitted-hosts
Oct 2, 2026
Merged

adamruzicka merged 1 commit into
theforeman:developfrom
lhellebr:sat-49512-permitted-hosts

Conversation

@lhellebr

@lhellebr lhellebr commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes 39817
Requires theforeman/foremanctl#900

@lhellebr
lhellebr force-pushed the sat-49512-permitted-hosts branch from 026baa4 to 6d5dced Compare September 30, 2026 09:45
@lhellebr lhellebr changed the title Respect configured smart proxy names as Sinatra permitted_hosts Fixes #39817 - Respect configured smart proxy names as Sinatra permitted_hosts Sep 30, 2026
@lhellebr
lhellebr force-pushed the sat-49512-permitted-hosts branch from 6d5dced to 495cfa3 Compare September 30, 2026 13:04

@adamruzicka adamruzicka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work well, two comments inline.

Comment thread lib/smart_proxy_main.rb
# before LoggerMiddleware. Use the proxy logger for rejected-host diagnostics.
::Sinatra::Base.set :host_authorization, {
permitted_hosts: SETTINGS.permitted_hosts || [],
logger: ::Proxy::LogBuffer::Decorator.instance,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging (especially without debug) is not all that great, but guess we can't do all that much about it.

2026-10-01T09:23:27  [D] Rack::Protection::HostAuthorization @all_permitted_hosts=["foo.baz.qux"] @permitted_hosts=["foo.baz.qux"] @domain_hosts=[] @ip_hosts=[] origin_host="foo.bar.baz" forwarded_host=nil
2026-10-01T09:23:27  [W] attack prevented by Rack::Protection::HostAuthorization

Comment thread lib/smart_proxy_main.rb
…ted_hosts

Warn when permitted hosts are not enforced by Sinatra
@lhellebr
lhellebr force-pushed the sat-49512-permitted-hosts branch from 658fa17 to 586dfcd Compare October 2, 2026 09:34
@adamruzicka
adamruzicka merged commit cbc295f into theforeman:develop Oct 2, 2026
9 of 10 checks passed
@adamruzicka

Copy link
Copy Markdown
Contributor

Thank you @lhellebr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants