-
Notifications
You must be signed in to change notification settings - Fork 242
feat: add new envelope transport #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1094 +/- ##
==========================================
- Coverage 86.97% 86.70% -0.28%
==========================================
Files 55 59 +4
Lines 6025 6519 +494
==========================================
+ Hits 5240 5652 +412
- Misses 641 699 +58
- Partials 144 168 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
return &tls.Config{ | ||
RootCAs: options.CaCerts, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep identified an issue in your code:
MinVersion
is missing from this TLS configuration. By default, as of Go 1.22, TLS 1.2 is currently used as the minimum. General purpose web applications should default to TLS 1.3 with all other protocols disabled. Only where it is known that a web server must support legacy clients with unsupported an insecure browsers (such as Internet Explorer 10), it may be necessary to enable TLS 1.0 to provide support. Add `MinVersion: tls.VersionTLS13' to the TLS configuration to bump the minimum version to TLS 1.3.
To resolve this comment:
✨ Commit Assistant Fix Suggestion
- Add a
MinVersion: tls.VersionTLS13,
field to thetls.Config
struct in thegetTLSConfig
function. The config object should look like:&tls.Config{RootCAs: options.CaCerts, MinVersion: tls.VersionTLS13}
. - Ensure you have
import "crypto/tls"
at the top of your file if it is not already present.
By setting MinVersion
to tls.VersionTLS13
, the server will not accept connections using older and less secure TLS protocols.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>
for false positive/ar <comment>
for acceptable risk/other <comment>
for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by missing-ssl-minversion.
You can view more details about this finding in the Semgrep AppSec Platform.
3ce9dee
to
4228142
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally we'd also abstract the older event types as envelope items, but I'll leave it upto you if you want to do that now or separately later
} | ||
// Dsn is used as the remote address source to client transport. | ||
type Dsn struct { | ||
protocol.Dsn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not familiar with go, why embed instead of alias?
|
||
envelope := protocol.NewEnvelope(header) | ||
|
||
eventBody, err := json.Marshal(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine for now, but eventually, each envelope item type should know how to serialize itself instead of this hacky logic
Lines 558 to 574 in 1ed184b
func (e *Event) MarshalJSON() ([]byte, error) { | |
// We want to omit time.Time zero values, otherwise the server will try to | |
// interpret dates too far in the past. However, encoding/json doesn't | |
// support the "omitempty" option for struct types. See | |
// https://golang.org/issues/11939. | |
// | |
// We overcome the limitation and achieve what we want by shadowing fields | |
// and a few type tricks. | |
if e.Type == transactionType { | |
return e.transactionMarshalJSON() | |
} | |
if e.Type == checkInType { | |
return e.checkInMarshalJSON() | |
} | |
return e.defaultMarshalJSON() | |
} |
Description
Create the new transport that accepts envelopes and not events. For now only the implementation for the new transport is added, without deprecating the old one. The PR also includes some misc changes:
Issues
Note
Introduce envelope-first Sync/Async HTTP transports, centralize DSN and envelope types under internal/protocol, and adapt SDK to use them with minimal API surface changes.
internal/http
transports:AsyncTransport
andSyncTransport
that sendprotocol.Envelope
s, with queueing, flush/close, rate limiting, proxy/TLS config, headers, and keep-alive handling.internal/protocol
:Dsn
,Envelope
(+ items, header),SdkInfo
, and interfaces (EnvelopeConvertible
,TelemetryTransport
).Dsn
andDsnParseError
in top-levelsentry
;NewDsn
delegates to protocol;RequestHeaders()
uses SDK version; minor typo fix in comment.Event.ToEnvelope
/ToEnvelopeWithTime
; include DSC trace info and attachments; fallback JSON marshal path preserved.DynamicSamplingContext
andtransport.go
to use DSN getters (GetPublicKey
, etc.) and scheme constants from protocol inNewRequest
.Written by Cursor Bugbot for commit 1ed184b. This will update automatically on new commits. Configure here.