diff --git a/.chloggen/awsfirehose-use-configopaque.yaml b/.chloggen/awsfirehose-use-configopaque.yaml new file mode 100755 index 0000000000000..81e956b5b293a --- /dev/null +++ b/.chloggen/awsfirehose-use-configopaque.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/awsfirehose + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change the type of `Config.AccessKey` to be `configopaque.String` + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [17273] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/receiver/awsfirehosereceiver/config.go b/receiver/awsfirehosereceiver/config.go index 85825968daa68..7442dadc1bab7 100644 --- a/receiver/awsfirehosereceiver/config.go +++ b/receiver/awsfirehosereceiver/config.go @@ -7,6 +7,7 @@ import ( "errors" "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configopaque" ) type Config struct { @@ -20,7 +21,7 @@ type Config struct { // AccessKey is checked against the one received with each request. // This can be set when creating or updating the Firehose delivery // stream. - AccessKey string `mapstructure:"access_key"` + AccessKey configopaque.String `mapstructure:"access_key"` } // Validate checks that the endpoint and record type exist and diff --git a/receiver/awsfirehosereceiver/go.mod b/receiver/awsfirehosereceiver/go.mod index fdfae46104a19..40ae46aecc2c3 100644 --- a/receiver/awsfirehosereceiver/go.mod +++ b/receiver/awsfirehosereceiver/go.mod @@ -6,6 +6,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.81.0 go.opentelemetry.io/collector/config/confighttp v0.81.0 + go.opentelemetry.io/collector/config/configopaque v0.81.0 go.opentelemetry.io/collector/config/configtls v0.81.0 go.opentelemetry.io/collector/confmap v0.81.0 go.opentelemetry.io/collector/consumer v0.81.0 @@ -38,7 +39,6 @@ require ( go.opentelemetry.io/collector v0.81.0 // indirect go.opentelemetry.io/collector/config/configauth v0.81.0 // indirect go.opentelemetry.io/collector/config/configcompression v0.81.0 // indirect - go.opentelemetry.io/collector/config/configopaque v0.81.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.81.0 // indirect go.opentelemetry.io/collector/config/internal v0.81.0 // indirect go.opentelemetry.io/collector/extension v0.81.0 // indirect diff --git a/receiver/awsfirehosereceiver/receiver.go b/receiver/awsfirehosereceiver/receiver.go index e6d2a6fbfac2c..ee26ce2237f96 100644 --- a/receiver/awsfirehosereceiver/receiver.go +++ b/receiver/awsfirehosereceiver/receiver.go @@ -232,7 +232,7 @@ func (fmr *firehoseReceiver) ServeHTTP(w http.ResponseWriter, r *http.Request) { // validate checks the Firehose access key in the header against // the one passed into the Config func (fmr *firehoseReceiver) validate(r *http.Request) (int, error) { - if accessKey := r.Header.Get(headerFirehoseAccessKey); accessKey != "" && accessKey != fmr.config.AccessKey { + if accessKey := r.Header.Get(headerFirehoseAccessKey); accessKey != "" && accessKey != string(fmr.config.AccessKey) { return http.StatusUnauthorized, errInvalidAccessKey } return http.StatusAccepted, nil