From a0e3407f21c9c26c547482aa3fc4e581465b7dae Mon Sep 17 00:00:00 2001 From: Noah Talerman <47070608+noahtalerman@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:41:12 -0400 Subject: [PATCH 01/15] Update rest-api.md (#17801) - Fix anchor link --- docs/REST API/rest-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/REST API/rest-api.md b/docs/REST API/rest-api.md index 671831ccb5..a9f2ccdda4 100644 --- a/docs/REST API/rest-api.md +++ b/docs/REST API/rest-api.md @@ -7372,7 +7372,7 @@ This allows you to easily configure scheduled queries that will impact a whole t - [Run script](#run-script) - [Get script result](#get-script-result) -- [Run live script](#run-script) +- [Run live script](#run-live-script) - [Upload a script](#upload-a-script) - [Delete a script](#delete-a-script) - [List scripts](#list-scripts) From ee14a26df4e236146aaad89d93512f29beef3f22 Mon Sep 17 00:00:00 2001 From: Dante Catalfamo <43040593+dantecatalfamo@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:06:36 -0400 Subject: [PATCH 02/15] Return correct OS details for Windows Server 2019 (#17760) --- changes/17562-windows-server-2019-os-details | 1 + server/service/osquery_utils/queries.go | 37 +++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 changes/17562-windows-server-2019-os-details diff --git a/changes/17562-windows-server-2019-os-details b/changes/17562-windows-server-2019-os-details new file mode 100644 index 0000000000..e3aa773a03 --- /dev/null +++ b/changes/17562-windows-server-2019-os-details @@ -0,0 +1 @@ +- Fixed a bug where OS version information would not get detected on Windows Server 2019 diff --git a/server/service/osquery_utils/queries.go b/server/service/osquery_utils/queries.go index 030294f5ed..e65124e4e8 100644 --- a/server/service/osquery_utils/queries.go +++ b/server/service/osquery_utils/queries.go @@ -172,14 +172,24 @@ var hostDetailQueries = map[string]DetailQuery{ }, }, "os_version_windows": { + // display_version is not available in some versions of + // Windows (Server 2019). By including it using a JOIN it can + // return no rows and the query will still succeed Query: ` - SELECT os.name, r.data as display_version, k.version + WITH display_version_table AS ( + SELECT data as display_version + FROM registry + WHERE path = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion' + ) + SELECT + os.name, + COALESCE(d.display_version, '') AS display_version, + k.version FROM - registry r, os_version os, kernel_info k - WHERE r.path = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion' - `, + LEFT JOIN + display_version_table d`, Platforms: []string{"windows"}, IngestFunc: func(ctx context.Context, logger log.Logger, host *fleet.Host, rows []map[string]string) error { if len(rows) != 1 { @@ -531,20 +541,29 @@ var extraDetailQueries = map[string]DetailQuery{ // This query is used to populate the `operating_systems` and `host_operating_system` // tables. Separately, the `hosts` table is populated via the `os_version` and // `os_version_windows` detail queries above. + // + // DisplayVersion doesn't exist on all versions of Windows (Server 2019). + // To prevent the query from failing in those cases, we join + // the values in when they exist, alternatively the column is + // just empty. Query: ` + WITH display_version_table AS ( + SELECT data as display_version + FROM registry + WHERE path = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion' + ) SELECT os.name, os.platform, os.arch, k.version as kernel_version, os.version, - r.data as display_version + COALESCE(d.display_version, '') AS display_version FROM os_version os, - kernel_info k, - registry r - WHERE - r.path = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\DisplayVersion'`, + kernel_info k + LEFT JOIN + display_version_table d`, Platforms: []string{"windows"}, DirectIngestFunc: directIngestOSWindows, }, From 632af6635dad4827f2a3bf410c35f949fbf81afd Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 25 Mar 2024 13:37:31 -0500 Subject: [PATCH 03/15] Handbook: update `startedOn` date of auto-issue rituals. (#17835) Changes: - updated the `startedOn` date of 3 rituals with auto-issue enabled. --- handbook/business-operations/business-operations.rituals.yml | 4 ++-- handbook/digital-experience/digital-experience.rituals.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/handbook/business-operations/business-operations.rituals.yml b/handbook/business-operations/business-operations.rituals.yml index 1726a429dd..3be2ee4b68 100644 --- a/handbook/business-operations/business-operations.rituals.yml +++ b/handbook/business-operations/business-operations.rituals.yml @@ -44,7 +44,7 @@ repo: "confidential" - task: "AP invoice monitoring" # TODO tie this to a responsibility - startedOn: "2024-03-31" + startedOn: "2024-04-01" frequency: "Weekly" description: "Look for new accounts payable invoices and make sure that Fleet's suppliers are paid" moreInfoUrl: @@ -64,7 +64,7 @@ repo: "confidential" - task: "Vanta check" # TODO tie this to a responsibility - startedOn: "2024-03-01" + startedOn: "2024-04-01" frequency: "Monthly" description: "Look for any new actions in Vanta due in the upcoming months and create issues to ensure they're done on time" moreInfoUrl: diff --git a/handbook/digital-experience/digital-experience.rituals.yml b/handbook/digital-experience/digital-experience.rituals.yml index d0c1a23123..75e4244d02 100644 --- a/handbook/digital-experience/digital-experience.rituals.yml +++ b/handbook/digital-experience/digital-experience.rituals.yml @@ -3,7 +3,7 @@ - task: "Check browser compatibility for fleetdm.com" - startedOn: "2024-03-01" + startedOn: "2024-03-06" frequency: "Monthly" description: "Run `npm audit --only=prod` to check for vulnerabilities on the production dependencies of fleetdm.com." moreInfoUrl: "https://fleetdm.com/handbook/digital-experience#check-production-dependencies-of-fleetdm-com" From b3d77c75e91e789911e6332569fd13c2c407cb67 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 25 Mar 2024 13:41:17 -0500 Subject: [PATCH 04/15] Website: update Vanta integration script (#17833) Related to: #17699 Changes: - Updated the `send-data-to-vanta` script to retry requests to Vanta's `https://api.vanta.com/oauth/token` API endpoint that return a `504` response. --- website/scripts/send-data-to-vanta.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/scripts/send-data-to-vanta.js b/website/scripts/send-data-to-vanta.js index d1c45193e8..7c3565e962 100644 --- a/website/scripts/send-data-to-vanta.js +++ b/website/scripts/send-data-to-vanta.js @@ -35,7 +35,8 @@ module.exports = { }, headers: { accept: 'application/json' } }) - .retry({raw:{statusCode: 503}}) + .retry({raw:{statusCode: 503}})// Retry requests that respond with "503: Service temporarily unavailable" + .retry({raw:{statusCode: 504}})// Retry requests that respond with "504: Endpoint request timed out" .tolerate((err)=>{ // If an error occurs while sending a request to Vanta, we'll add the error to the errorReportById object, with this connections ID set as the key. errorReportById[connectionIdAsString] = new Error(`Could not refresh the token for Vanta connection (id: ${connectionIdAsString}). Full error: ${err}`); From 3d46b0d22a478cf2acb941748be5f4e01bd745bd Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:41:35 -0700 Subject: [PATCH 05/15] =?UTF-8?q?UI=20=E2=80=93=20Fix=20error=20state=20an?= =?UTF-8?q?d=20alignment=20on=20global=20host=20status=20webhook=20setting?= =?UTF-8?q?=20page=20(#17821)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Addresses #17534 Screenshot 2024-03-22 at 4 41 25 PM - also fix bug in alignment of error states vs tooltip-wrapped labels throughout org settings - [x] Changes file added - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling --- .../17534-improve-error-states-org-settings | 2 ++ .../pages/admin/OrgSettingsPage/_styles.scss | 4 ---- .../GlobalHostStatusWebhook.tsx | 18 +++++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 changes/17534-improve-error-states-org-settings diff --git a/changes/17534-improve-error-states-org-settings b/changes/17534-improve-error-states-org-settings new file mode 100644 index 0000000000..6fdff36d01 --- /dev/null +++ b/changes/17534-improve-error-states-org-settings @@ -0,0 +1,2 @@ +- Fix error state rendering on the global Host status expiry settings page, fix error state + alignment for tooltip-wrapper field labels across organization settings. diff --git a/frontend/pages/admin/OrgSettingsPage/_styles.scss b/frontend/pages/admin/OrgSettingsPage/_styles.scss index cfbfb51a9e..3ae29e2405 100644 --- a/frontend/pages/admin/OrgSettingsPage/_styles.scss +++ b/frontend/pages/admin/OrgSettingsPage/_styles.scss @@ -101,10 +101,6 @@ &__disabled-usage-statistics-checkbox { @include disabled; } - - .component__tooltip-wrapper { - margin-bottom: $pad-xsmall; - } } } } diff --git a/frontend/pages/admin/OrgSettingsPage/cards/GlobalHostStatusWebhook/GlobalHostStatusWebhook.tsx b/frontend/pages/admin/OrgSettingsPage/cards/GlobalHostStatusWebhook/GlobalHostStatusWebhook.tsx index 6783bcc2bb..78c7a0b105 100644 --- a/frontend/pages/admin/OrgSettingsPage/cards/GlobalHostStatusWebhook/GlobalHostStatusWebhook.tsx +++ b/frontend/pages/admin/OrgSettingsPage/cards/GlobalHostStatusWebhook/GlobalHostStatusWebhook.tsx @@ -28,7 +28,7 @@ const baseClass = "app-config-form"; export type IGlobalHostStatusWebhookFormData = { enableHostStatusWebhook: boolean; - hostStatusWebhookDestinationUrl: string; + destination_url: string; hostStatusWebhookHostPercentage: number; hostStatusWebhookWindow: number; }; @@ -46,7 +46,7 @@ const GlobalHostStatusWebhook = ({ enableHostStatusWebhook: appConfig.webhook_settings.host_status_webhook ?.enable_host_status_webhook || false, - hostStatusWebhookDestinationUrl: + destination_url: appConfig.webhook_settings.host_status_webhook?.destination_url || "", hostStatusWebhookHostPercentage: appConfig.webhook_settings.host_status_webhook?.host_percentage || 1, @@ -56,7 +56,7 @@ const GlobalHostStatusWebhook = ({ const { enableHostStatusWebhook, - hostStatusWebhookDestinationUrl, + destination_url, hostStatusWebhookHostPercentage, hostStatusWebhookWindow, } = formData; @@ -72,10 +72,10 @@ const GlobalHostStatusWebhook = ({ const errors: IAppConfigFormErrors = {}; if (enableHostStatusWebhook) { - if (!hostStatusWebhookDestinationUrl) { + if (!destination_url) { errors.destination_url = "Destination URL must be present"; - } else if (!validUrl({ url: hostStatusWebhookDestinationUrl })) { - errors.server_url = `${hostStatusWebhookDestinationUrl} is not a valid URL`; + } else if (!validUrl({ url: destination_url })) { + errors.destination_url = `${destination_url} is not a valid URL`; } } @@ -99,7 +99,7 @@ const GlobalHostStatusWebhook = ({ webhook_settings: { host_status_webhook: { enable_host_status_webhook: enableHostStatusWebhook, - destination_url: hostStatusWebhookDestinationUrl, + destination_url, host_percentage: hostStatusWebhookHostPercentage, days_count: hostStatusWebhookWindow, }, @@ -166,8 +166,8 @@ const GlobalHostStatusWebhook = ({ placeholder="https://server.com/example" label="Destination URL" onChange={handleInputChange} - name="hostStatusWebhookDestinationUrl" - value={hostStatusWebhookDestinationUrl} + name="destination_url" + value={destination_url} parseTarget onBlur={validateForm} error={formErrors.destination_url} From da32121f00439cf5620365afb045e3ef0b5b6a28 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 25 Mar 2024 18:02:27 -0500 Subject: [PATCH 06/15] Vuln dashboard: Update moment dependency to resolve code scanning alerts (#17849) Related to: #17764 Changes: - Updated ee/vulnerability-dashboard/assets/dependencies/moment.js to resolve two code scanning alerts. --- ee/vulnerability-dashboard/assets/dependencies/moment.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ee/vulnerability-dashboard/assets/dependencies/moment.js b/ee/vulnerability-dashboard/assets/dependencies/moment.js index 9428c66bb9..98e2e91970 100644 --- a/ee/vulnerability-dashboard/assets/dependencies/moment.js +++ b/ee/vulnerability-dashboard/assets/dependencies/moment.js @@ -680,7 +680,7 @@ function getParseRegexForToken (token, config) { // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return regexEscape(s.replace(/\\/g, '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; })); } @@ -1477,9 +1477,9 @@ function localeWeekdaysParse (weekdayName, format, strict) { mom = createUTC([2000, 1]).day(i); if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); + this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); + this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); + this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); } if (!this._weekdaysParse[i]) { regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); From 6d965426e0b7730ca06cc91c812be61f357ddfce Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:55:49 -0400 Subject: [PATCH 07/15] Fleet UI: Users can see a tooltip on a disabled checkbox (#17664) --- changes/16345-disabled-checkbox-tooltip | 1 + .../forms/fields/Checkbox/Checkbox.tsx | 17 +++++--- .../forms/fields/Checkbox/_styles.scss | 17 ++++++++ .../TeamHostExpiryToggle.tsx | 40 ++++++++----------- .../TeamHostExpiryToggle/_styles.scss | 4 -- frontend/styles/var/mixins.scss | 7 ++++ 6 files changed, 53 insertions(+), 33 deletions(-) create mode 100644 changes/16345-disabled-checkbox-tooltip diff --git a/changes/16345-disabled-checkbox-tooltip b/changes/16345-disabled-checkbox-tooltip new file mode 100644 index 0000000000..5e83ded1e1 --- /dev/null +++ b/changes/16345-disabled-checkbox-tooltip @@ -0,0 +1 @@ +- UI fix: users can see a tooltip on a disabled checkbox diff --git a/frontend/components/forms/fields/Checkbox/Checkbox.tsx b/frontend/components/forms/fields/Checkbox/Checkbox.tsx index 8380b4279c..83ddcb43be 100644 --- a/frontend/components/forms/fields/Checkbox/Checkbox.tsx +++ b/frontend/components/forms/fields/Checkbox/Checkbox.tsx @@ -55,21 +55,26 @@ const Checkbox = (props: ICheckboxProps) => { className, baseClass ); + + const checkBoxTickClass = classnames(`${baseClass}__tick`, { + [`${baseClass}__tick--disabled`]: disabled, + [`${baseClass}__tick--indeterminate`]: indeterminate, + }); + + const checkBoxLabelClass = classnames(checkBoxClass, { + [`${baseClass}__label--disabled`]: disabled, + }); + const formFieldProps = { ...pick(props, ["helpText", "label", "error", "name"]), className: wrapperClassName, type: "checkbox", } as IFormFieldProps; - const checkBoxTickClass = classnames(`${checkBoxClass}__tick`, { - [`${checkBoxClass}__tick--disabled`]: disabled, - [`${checkBoxClass}__tick--indeterminate`]: indeterminate, - }); - return ( <> -