Skip to content
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

[FSSDK-10734] update regex to allow = character #426

Merged
merged 5 commits into from
Oct 4, 2024
Merged
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
3 changes: 2 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,14 @@ client:
## the maximum time between events being dispatched
flushInterval: 30s
## Template URL for SDK datafile location. The template should specify a "%s" token for SDK key substitution.
## For secure environments, the datafileURLTemplate should be set to "https://config.optimizely.com/datafiles/auth/%s.json"
datafileURLTemplate: "https://cdn.optimizely.com/datafiles/%s.json"
## URL for dispatching events.
eventURL: "https://logx.optimizely.com/v1/events"
## Validation Regex on the request SDK Key
## By default Agent assumes only alphanumeric characters as part of the SDK Key string.
## https://github.com/google/re2/wiki/Syntax
sdkKeyRegex: "^\\w+(:\\w+)?$"
sdkKeyRegex: "^[\\w=]+(:[\\w=]+)?$"
## configure optional User profile service
userProfileService:
default: ""
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewDefaultConfig() *AgentConfig {
DatafileURLTemplate: "https://cdn.optimizely.com/datafiles/%s.json",
EventURL: "https://logx.optimizely.com/v1/events",
// https://github.com/google/re2/wiki/Syntax
SdkKeyRegex: "^\\w+(:\\w+)?$",
SdkKeyRegex: "^[\\w=]+(:[\\w=]+)?$",
UserProfileService: UserProfileServiceConfigs{
"default": "",
"services": map[string]interface{}{},
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestDefaultConfig(t *testing.T) {
assert.Equal(t, 30*time.Second, conf.Client.FlushInterval)
assert.Equal(t, "https://cdn.optimizely.com/datafiles/%s.json", conf.Client.DatafileURLTemplate)
assert.Equal(t, "https://logx.optimizely.com/v1/events", conf.Client.EventURL)
assert.Equal(t, "^\\w+(:\\w+)?$", conf.Client.SdkKeyRegex)
assert.Equal(t, "^[\\w=]+(:[\\w=]+)?$", conf.Client.SdkKeyRegex)
assert.Equal(t, "", conf.Client.UserProfileService["default"])
assert.Equal(t, false, conf.Client.ODP.Disable)
assert.Equal(t, 1*time.Second, conf.Client.ODP.EventsFlushInterval)
Expand Down
1 change: 1 addition & 0 deletions pkg/optimizely/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ func (s *DefaultLoaderTestSuite) TestDefaultRegexValidator() {
{":", false},
{"abc:def:hij", false},
{"abc:", false},
{"123sdkKey:accesTokenWith=", true},
}

conf := config.NewDefaultConfig()
Expand Down
Loading