Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sentry-ruby/lib/sentry/transport/spotlight_transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def on_error
@failed += 1
end

# Similar to HTTPTransport connection, but does not support Proxy and SSL
# Similar to HTTPTransport connection, but does not support Proxy
def conn
sidecar = URI(@sidecar_url)
connection = ::Net::HTTP.new(sidecar.hostname, sidecar.port, nil)
connection.use_ssl = false
connection.use_ssl = sidecar.scheme == "https"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HTTPS skips transport SSL configuration

Medium Severity

conn enables SSL for https sidecar URLs but never applies ssl_configuration. ssl_verification, ssl_ca_file, and transport.ssl are ignored, so the connection keeps Net::HTTP's default peer verification and system trust store. Private CAs and disabled verification, typical for Docker or an intercepting proxy, fail for Spotlight while the main transport honors the same settings.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 707aed3. Configure here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm not sure I see the security issue here:

Private CAs and disabled verification, typical for Docker or an intercepting proxy, fail for Spotlight while the main transport honors the same settings.

While this is true, it's not a security issue (on the contrary, disabling verification would be), and more of a feature limitation.

This change would only make vanilla HTTPS work, not special cases with Private CAs.

That said, if you as maintainers prefer another approach, let me know or feel free to amend this PR.

connection
end
end
Expand Down
18 changes: 18 additions & 0 deletions sentry-ruby/spec/sentry/transport/spotlight_transport_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@
expect(subject.conn.port).to eq(80)
expect(subject.conn.use_ssl?).to eq(false)
end

it 'returns an SSL connection with the default HTTPS port' do
configuration.spotlight = 'https://foobar@test.com'
connection = described_class.new(configuration).conn

expect(connection.address).to eq('test.com')
expect(connection.port).to eq(443)
expect(connection.use_ssl?).to eq(true)
end

it 'preserves an explicitly specified HTTPS port' do
configuration.spotlight = 'https://foobar@test.com:8443'
connection = described_class.new(configuration).conn

expect(connection.address).to eq('test.com')
expect(connection.port).to eq(8443)
expect(connection.use_ssl?).to eq(true)
end
end

describe '#send_data' do
Expand Down