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 support base64 char for SDK Key & access token #427

Merged
merged 4 commits into from
Oct 8, 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
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ client:
## 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: "^[a-zA-Z0-9+/=_]+(:[a-zA-Z0-9+/=_]+)?$"
## 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: "^[a-zA-Z0-9+/=_]+(:[a-zA-Z0-9+/=_]+)?$",
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, "^[a-zA-Z0-9+/=_]+(:[a-zA-Z0-9+/=_]+)?$", 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
5 changes: 5 additions & 0 deletions pkg/optimizely/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,11 @@ func (s *DefaultLoaderTestSuite) TestDefaultRegexValidator() {
{"abc:def:hij", false},
{"abc:", false},
{"123sdkKey:accesTokenWith=", true},
{"abc+123", true},
{"abc-123", false},
{"abc/123", true},
{"abc:def=", true},
{"abc:acd+def/=", true},
}

conf := config.NewDefaultConfig()
Expand Down
Loading