GH-18288: Allow configuring unsafe-eval and unsafe-inline (#18801)

* GH-18288: Allow configuring unsafe-eval and unsafe-inline

* Add developer flags to telemetry

* wip

* wip

* Refactor based on review

* Refactor based on review

* fix expected vs. actual in assert.Equal

* Add unit tests, rework to check only supported flags.

* Update model/config.go

Co-authored-by: Jesse Hallam <jesse@thehallams.ca>

* Fix failing tests

* Refactor based on review

* Refactor based on review

* Refactor based on review

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Jesse Hallam <jesse@thehallams.ca>
Этот коммит содержится в:
Sharath Huddar
2021-11-12 03:11:11 +05:30
коммит произвёл GitHub
родитель df3ed307df
Коммит 27559c1c7b
4 изменённых файлов: 184 добавлений и 14 удалений

Просмотреть файл

@@ -106,6 +106,7 @@ const (
ServiceSettingsDefaultListenAndAddress = ":8065"
ServiceSettingsDefaultGfycatAPIKey = "2_KtH_W5"
ServiceSettingsDefaultGfycatAPISecret = "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof"
ServiceSettingsDefaultDeveloperFlags = ""
TeamSettingsDefaultSiteName = "Mattermost"
TeamSettingsDefaultMaxUsersPerTeam = 50
@@ -302,6 +303,7 @@ type ServiceSettings struct {
RestrictLinkPreviews *string `access:"site_posts"`
EnableTesting *bool `access:"environment_developer,write_restrictable,cloud_restrictable"`
EnableDeveloper *bool `access:"environment_developer,write_restrictable,cloud_restrictable"`
DeveloperFlags *string `access:"environment_developer"`
EnableOpenTracing *bool `access:"write_restrictable,cloud_restrictable"`
EnableSecurityFixAlert *bool `access:"environment_smtp,write_restrictable,cloud_restrictable"`
EnableInsecureOutgoingConnections *bool `access:"environment_web_server,write_restrictable,cloud_restrictable"`
@@ -416,6 +418,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
s.EnableDeveloper = NewBool(false)
}
if s.DeveloperFlags == nil {
s.DeveloperFlags = NewString("")
}
if s.EnableOpenTracing == nil {
s.EnableOpenTracing = NewBool(false)
}