You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use sendKey for rule matching if it's configured (#1735)
## Which problem is this PR solving?
Refinery uses the API key included in an incoming request to determine
the target environment and dataset. However, when a SendKey is
configured, it can override the original incoming API key in the
request.
When SendKey is configured to override, Refinery should resolve the
environment and dataset based on the SendKey, not the original incoming
API key. Otherwise, sampling rules may be incorrectly matched using the
wrong key.
This PR ensures that when a SendKey is applied, the environment/dataset
resolution and sampling rule matching are based on the SendKey.
## Short description of the changes
- Replaces the request’s APIKey header value with the configured
SendKey, when applicable
- Adds integration tests to validate SendKey-based resolution behavior
---------
Co-authored-by: Robb Kidd <[email protected]>
{"unknown key", fields{ReceiveKeys: []string{"key1"}, AcceptOnlyListedKeys: true}, "key2", errors.New("api key key2... not found in list of authorized keys")},
96
-
{"accept missing key", fields{ReceiveKeys: []string{"key1"}, AcceptOnlyListedKeys: true}, "", errors.New("api key ... not found in list of authorized keys")},
96
+
{"reject missing key with sendkey configured", fields{ReceiveKeys: []string{"key1"}, AcceptOnlyListedKeys: true, SendKey: "key2"}, "", errors.New("api key ... not found in list of authorized keys")},
97
+
{"reject missing key without sendkey configured", fields{ReceiveKeys: []string{"key1"}, AcceptOnlyListedKeys: true}, "", errors.New("api key ... not found in list of authorized keys")},
0 commit comments