diff --git a/x-pack/plugins/reporting/common/constants.ts b/x-pack/plugins/reporting/common/constants.ts index bb6136d9d08b5..79449e5d229b8 100644 --- a/x-pack/plugins/reporting/common/constants.ts +++ b/x-pack/plugins/reporting/common/constants.ts @@ -34,7 +34,7 @@ export const ALLOWED_JOB_CONTENT_TYPES = [ // See: // https://github.com/chromium/chromium/blob/3611052c055897e5ebbc5b73ea295092e0c20141/services/network/public/cpp/header_util_unittest.cc#L50 // For a list of headers that chromium doesn't like -export const KBN_SCREENSHOT_HEADER_DENY_LIST = [ +export const KBN_SCREENSHOT_HEADER_BLOCK_LIST = [ 'accept-encoding', 'connection', 'content-length', @@ -51,7 +51,7 @@ export const KBN_SCREENSHOT_HEADER_DENY_LIST = [ 'keep-alive', ]; -export const KBN_SCREENSHOT_HEADER_DENY_LIST_STARTS_WITH_PATTERN = ['proxy-']; +export const KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN = ['proxy-']; export const UI_SETTINGS_CUSTOM_PDF_LOGO = 'xpackReporting:customPdfLogo'; diff --git a/x-pack/plugins/reporting/server/browsers/network_policy.test.ts b/x-pack/plugins/reporting/server/browsers/network_policy.test.ts index 92603c647876b..b2fb6af41b01c 100644 --- a/x-pack/plugins/reporting/server/browsers/network_policy.test.ts +++ b/x-pack/plugins/reporting/server/browsers/network_policy.test.ts @@ -116,14 +116,14 @@ describe('Network Policy', () => { expect(allowRequest(url, rules)).toEqual(true); }); - it('denies requests when hosts are from banned IP addresses', () => { + it('denies requests when hosts are from blocked IP addresses', () => { const url = 'http://192.168.1.1/cool/route/bro'; const rules = [{ allow: false, host: '192.168.1.1' }, { allow: true }]; expect(allowRequest(url, rules)).toEqual(false); }); - it('allows requests when hosts are IP addresses not banned', () => { + it('allows requests when hosts are IP addresses that are not blocked', () => { const url = 'http://192.168.2.1/cool/route/bro'; const rules = [{ allow: false, host: '192.168.1.1' }, { allow: true }]; @@ -150,7 +150,7 @@ describe('Network Policy', () => { expect(allowRequest('http://bad.com/some/route', rules)).toEqual(false); }); - it('allows banning of certain IPs', () => { + it('allows blocking of certain IPs', () => { const rules = [{ allow: false, host: '169.254.0.0' }, { allow: true }]; expect(allowRequest('http://kibana.com/some/route', rules)).toEqual(true); diff --git a/x-pack/plugins/reporting/server/export_types/common/index.ts b/x-pack/plugins/reporting/server/export_types/common/index.ts index 31ef49fc17dd1..e0d03eb4864ca 100644 --- a/x-pack/plugins/reporting/server/export_types/common/index.ts +++ b/x-pack/plugins/reporting/server/export_types/common/index.ts @@ -8,5 +8,5 @@ export { decryptJobHeaders } from './decrypt_job_headers'; export { getConditionalHeaders } from './get_conditional_headers'; export { getCustomLogo } from './get_custom_logo'; export { getFullUrls } from './get_full_urls'; -export { omitBannedHeaders } from './omit_banned_headers'; +export { omitBlockedHeaders } from './omit_blocked_headers'; export { validateUrls } from './validate_urls'; diff --git a/x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.test.ts b/x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.test.ts similarity index 82% rename from x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.test.ts rename to x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.test.ts index f1f7dbb6bb043..f40651603db8f 100644 --- a/x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.test.ts +++ b/x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.test.ts @@ -4,15 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ -import { omitBannedHeaders } from './index'; +import { omitBlockedHeaders } from './index'; -test(`omits banned headers`, async () => { +test(`omits blocked headers`, async () => { const permittedHeaders = { foo: 'bar', baz: 'quix', }; - const bannedHeaders = { + const blockedHeaders = { 'accept-encoding': '', connection: 'upgrade', 'content-length': '', @@ -24,7 +24,7 @@ test(`omits banned headers`, async () => { trailer: 's are for trucks', }; - const filteredHeaders = await omitBannedHeaders({ + const filteredHeaders = await omitBlockedHeaders({ job: { title: 'cool-job-bro', type: 'csv', @@ -36,7 +36,7 @@ test(`omits banned headers`, async () => { }, decryptedHeaders: { ...permittedHeaders, - ...bannedHeaders, + ...blockedHeaders, }, }); diff --git a/x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.ts b/x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.ts similarity index 69% rename from x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.ts rename to x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.ts index 942fc53a43abc..946f033b4b481 100644 --- a/x-pack/plugins/reporting/server/export_types/common/omit_banned_headers.ts +++ b/x-pack/plugins/reporting/server/export_types/common/omit_blocked_headers.ts @@ -5,11 +5,11 @@ */ import { omitBy } from 'lodash'; import { - KBN_SCREENSHOT_HEADER_DENY_LIST, - KBN_SCREENSHOT_HEADER_DENY_LIST_STARTS_WITH_PATTERN, + KBN_SCREENSHOT_HEADER_BLOCK_LIST, + KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN, } from '../../../common/constants'; -export const omitBannedHeaders = ({ +export const omitBlockedHeaders = ({ job, decryptedHeaders, }: { @@ -20,8 +20,8 @@ export const omitBannedHeaders = ({ decryptedHeaders, (_value, header: string) => header && - (KBN_SCREENSHOT_HEADER_DENY_LIST.includes(header) || - KBN_SCREENSHOT_HEADER_DENY_LIST_STARTS_WITH_PATTERN.some((pattern) => + (KBN_SCREENSHOT_HEADER_BLOCK_LIST.includes(header) || + KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN.some((pattern) => header?.startsWith(pattern) )) ); diff --git a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts index aa0854f152676..67fc51bbfc352 100644 --- a/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts @@ -13,7 +13,7 @@ import { decryptJobHeaders, getConditionalHeaders, getFullUrls, - omitBannedHeaders, + omitBlockedHeaders, } from '../../common'; import { generatePngObservableFactory } from '../lib/generate_png'; import { TaskPayloadPNG } from '../types'; @@ -37,7 +37,7 @@ export const runTaskFnFactory: QueuedPngExecutorFactory = function executeJobFac const jobLogger = logger.clone([jobId]); const process$: Rx.Observable = Rx.of(1).pipe( mergeMap(() => decryptJobHeaders({ encryptionKey, job, logger })), - map((decryptedHeaders) => omitBannedHeaders({ job, decryptedHeaders })), + map((decryptedHeaders) => omitBlockedHeaders({ job, decryptedHeaders })), map((filteredHeaders) => getConditionalHeaders({ config, job, filteredHeaders })), mergeMap((conditionalHeaders) => { const urls = getFullUrls({ config, job }); diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts index 9cc96e1fe69aa..7d1bb109f508b 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/execute_job/index.ts @@ -14,7 +14,7 @@ import { getConditionalHeaders, getCustomLogo, getFullUrls, - omitBannedHeaders, + omitBlockedHeaders, } from '../../common'; import { generatePdfObservableFactory } from '../lib/generate_pdf'; import { TaskPayloadPDF } from '../types'; @@ -40,7 +40,7 @@ export const runTaskFnFactory: QueuedPdfExecutorFactory = function executeJobFac const jobLogger = logger.clone([jobId]); const process$: Rx.Observable = Rx.of(1).pipe( mergeMap(() => decryptJobHeaders({ encryptionKey, job, logger })), - map((decryptedHeaders) => omitBannedHeaders({ job, decryptedHeaders })), + map((decryptedHeaders) => omitBlockedHeaders({ job, decryptedHeaders })), map((filteredHeaders) => getConditionalHeaders({ config, job, filteredHeaders })), mergeMap((conditionalHeaders) => getCustomLogo({ reporting, config, job, conditionalHeaders }) diff --git a/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.ts b/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.ts index e9899b7827bb0..979283f9f037c 100644 --- a/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.ts +++ b/x-pack/plugins/reporting/server/routes/diagnostic/screenshot.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { ReportingCore } from '../..'; import { API_DIAGNOSE_URL } from '../../../common/constants'; -import { omitBannedHeaders } from '../../export_types/common'; +import { omitBlockedHeaders } from '../../export_types/common'; import { getAbsoluteUrlFactory } from '../../export_types/common/get_absolute_url'; import { generatePngObservableFactory } from '../../export_types/png/lib/generate_png'; import { LevelLogger as Logger } from '../../lib'; @@ -65,7 +65,7 @@ export const registerDiagnoseScreenshot = (reporting: ReportingCore, logger: Log }; const headers = { - headers: omitBannedHeaders({ + headers: omitBlockedHeaders({ job: null, decryptedHeaders, }),