PLT-6358: Server HTTP client improvements (#6980)

* restrict untrusted, internal http connections by default

* command test fix

* more test fixes

* change setting from toggle to whitelist

* requested ui changes

* add isdefault diagnostic

* fix tests
Этот коммит содержится в:
Chris
2017-08-09 15:49:07 -05:00
коммит произвёл Christopher Speller
родитель 504582b824
Коммит ffbf8e51fe
19 изменённых файлов: 342 добавлений и 98 удалений

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

@@ -388,10 +388,13 @@ func TestExecuteCommand(t *testing.T) {
channel := th.BasicChannel
enableCommands := *utils.Cfg.ServiceSettings.EnableCommands
allowedInternalConnections := *utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections
defer func() {
utils.Cfg.ServiceSettings.EnableCommands = &enableCommands
utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections
}()
*utils.Cfg.ServiceSettings.EnableCommands = true
*utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost"
postCmd := &model.Command{
CreatorId: th.BasicUser.Id,

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

@@ -19,10 +19,13 @@ func TestGetOpenGraphMetadata(t *testing.T) {
Client := th.Client
enableLinkPreviews := *utils.Cfg.ServiceSettings.EnableLinkPreviews
allowedInternalConnections := *utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections
defer func() {
*utils.Cfg.ServiceSettings.EnableLinkPreviews = enableLinkPreviews
utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections
}()
*utils.Cfg.ServiceSettings.EnableLinkPreviews = true
*utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost 127.0.0.1"
ogDataCacheMissCount := 0

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

@@ -119,14 +119,17 @@ func testCreatePostWithOutgoingHook(
enableOutgoingHooks := utils.Cfg.ServiceSettings.EnableOutgoingWebhooks
enableAdminOnlyHooks := utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations
allowedInternalConnections := *utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections
defer func() {
utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = enableOutgoingHooks
utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = enableAdminOnlyHooks
utils.SetDefaultRolesBasedOnConfig()
utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = &allowedInternalConnections
}()
utils.Cfg.ServiceSettings.EnableOutgoingWebhooks = true
*utils.Cfg.ServiceSettings.EnableOnlyAdminIntegrations = true
utils.SetDefaultRolesBasedOnConfig()
*utils.Cfg.ServiceSettings.AllowedUntrustedInternalConnections = "localhost 127.0.0.1"
var hook *model.OutgoingWebhook
var post *model.Post