From 72a838e763dc3af435b6b0223fc27c206bf571c3 Mon Sep 17 00:00:00 2001 From: Joel Griffith Date: Wed, 12 Aug 2020 10:29:29 -0700 Subject: [PATCH] Allow any hostname for chromium proxy bypass (#74693) (#74777) * Allow any hostname for chromium proxy bypass * Adds a test for the proxy bypass config * Add wildcard to test --- .../reporting/server/config/schema.test.ts | 28 +++++++++++++++++++ .../plugins/reporting/server/config/schema.ts | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/reporting/server/config/schema.test.ts b/x-pack/plugins/reporting/server/config/schema.test.ts index ddd5491b661bc..69e4d443cf040 100644 --- a/x-pack/plugins/reporting/server/config/schema.test.ts +++ b/x-pack/plugins/reporting/server/config/schema.test.ts @@ -126,6 +126,34 @@ describe('Reporting Config Schema', () => { ).toMatchObject({ hostname: 'Frodo' }); }); + it('allows setting a wildcard for chrome proxy bypass', () => { + expect( + ConfigSchema.validate({ + capture: { + browser: { + chromium: { + proxy: { + enabled: true, + server: 'http://example.com:8080', + bypass: ['*.example.com', '*bar.example.com', 'bats.example.com'], + }, + }, + }, + }, + }).capture.browser.chromium.proxy + ).toMatchInlineSnapshot(` + Object { + "bypass": Array [ + "*.example.com", + "*bar.example.com", + "bats.example.com", + ], + "enabled": true, + "server": "http://example.com:8080", + } + `); + }); + it(`logs the proper validation messages`, () => { // kibanaServer const throwValidationErr = () => ConfigSchema.validate({ kibanaServer: { hostname: '0' } }); diff --git a/x-pack/plugins/reporting/server/config/schema.ts b/x-pack/plugins/reporting/server/config/schema.ts index 2f77aff0020d5..33249f20757e2 100644 --- a/x-pack/plugins/reporting/server/config/schema.ts +++ b/x-pack/plugins/reporting/server/config/schema.ts @@ -97,7 +97,7 @@ const CaptureSchema = schema.object({ bypass: schema.conditional( schema.siblingRef('enabled'), true, - schema.arrayOf(schema.string({ hostname: true })), + schema.arrayOf(schema.string()), schema.maybe(schema.never()) ), }),