mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 16:39:01 +00:00
## For #28049 , #28610 - **Implement front end ability to enable or disable conditional access on a per-policy basis** - **Update policy status UI to include new "action required" state, representing a failed policy on a host with conditional access enabled** - Additional improvements <img width="1624" alt="Screenshot 2025-04-29 at 1 32 33 PM" src="https://github.com/user-attachments/assets/960b3348-b0e2-48b8-bcff-28f91f64fd01" /> <img width="1624" alt="Screenshot 2025-04-29 at 12 15 39 PM" src="https://github.com/user-attachments/assets/b0e0cf1f-a693-4e0b-b18a-a44ee258975f" /> <img width="1624" alt="Screenshot 2025-04-29 at 12 15 49 PM" src="https://github.com/user-attachments/assets/15f7bea1-7338-4997-93bf-8baeb308e3f0" /> <img width="1400" alt="updated policies table headers" src="https://github.com/user-attachments/assets/164fd84a-a9ee-4dfe-8d73-b4e82e27edbc" /> - [x] Changes file added for user-visible changes in `changes/` - [ ] Added/updated automated tests - [x] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
123 lines
4 KiB
TypeScript
123 lines
4 KiB
TypeScript
import { IPolicyStats } from "interfaces/policy";
|
|
|
|
const DEFAULT_POLICY_MOCK: IPolicyStats = {
|
|
id: 1,
|
|
name: "Antivirus healthy (Linux)",
|
|
query:
|
|
"SELECT score FROM (SELECT case when COUNT(*) = 2 then 1 ELSE 0 END AS score FROM processes WHERE (name = 'clamd') OR (name = 'freshclam')) WHERE score == 1;",
|
|
critical: false,
|
|
description:
|
|
"Checks that both ClamAV's daemon and its updater service (freshclam) are running.",
|
|
author_id: 1,
|
|
author_name: "Test User",
|
|
author_email: "test@user.com",
|
|
team_id: null,
|
|
resolution: "Ensure ClamAV and Freshclam are installed and running.",
|
|
platform: "linux" as const,
|
|
created_at: "2023-03-24T22:13:59Z",
|
|
updated_at: "2023-03-31T19:05:13Z",
|
|
passing_host_count: 0,
|
|
failing_host_count: 8,
|
|
host_count_updated_at: "2023-11-30T19:05:13Z",
|
|
webhook: "Off",
|
|
has_run: true,
|
|
next_update_ms: 3600000,
|
|
calendar_events_enabled: true,
|
|
conditional_access_enabled: false,
|
|
install_software: {
|
|
name: "testSw0",
|
|
software_title_id: 1,
|
|
},
|
|
};
|
|
|
|
const createMockPolicy = (overrides?: Partial<IPolicyStats>): IPolicyStats => {
|
|
return { ...DEFAULT_POLICY_MOCK, ...overrides };
|
|
};
|
|
|
|
export const createMockPoliciesResponse = (
|
|
overrides?: Partial<IPolicyStats>
|
|
) => {
|
|
const MOCK_POLICIES_RESPONSE: { policies: IPolicyStats[] } = {
|
|
policies: [
|
|
{
|
|
id: 5,
|
|
name: "Gatekeeper enabled",
|
|
query: "SELECT 1 FROM gatekeeper WHERE assessments_enabled = 1;",
|
|
description: "Checks if gatekeeper is enabled on macOS devices",
|
|
critical: true,
|
|
author_id: 42,
|
|
author_name: "John",
|
|
author_email: "john@example.com",
|
|
team_id: 2,
|
|
resolution: "Resolution steps",
|
|
platform: "darwin",
|
|
created_at: "2021-12-16T14:37:37Z",
|
|
updated_at: "2021-12-16T16:39:00Z",
|
|
passing_host_count: 2000,
|
|
failing_host_count: 300,
|
|
host_count_updated_at: "2023-12-20T15:23:57Z",
|
|
webhook: "Off",
|
|
has_run: true,
|
|
next_update_ms: 3600000,
|
|
calendar_events_enabled: false,
|
|
conditional_access_enabled: false,
|
|
},
|
|
{
|
|
id: 29090,
|
|
name: "Windows machines with encrypted hard disks",
|
|
query: "SELECT 1 FROM bitlocker_info WHERE protection_status = 1;",
|
|
description: "Checks if the hard disk is encrypted on Windows devices",
|
|
critical: false,
|
|
author_id: 43,
|
|
author_name: "Alice",
|
|
author_email: "alice@example.com",
|
|
team_id: 2,
|
|
resolution: "Resolution steps",
|
|
platform: "windows",
|
|
created_at: "2021-12-16T14:37:37Z",
|
|
updated_at: "2021-12-16T16:39:00Z",
|
|
passing_host_count: 2300,
|
|
failing_host_count: 0,
|
|
host_count_updated_at: "2023-12-20T15:23:57Z",
|
|
webhook: "Off",
|
|
has_run: true,
|
|
next_update_ms: 3600000,
|
|
calendar_events_enabled: false,
|
|
conditional_access_enabled: false,
|
|
},
|
|
{
|
|
id: 136,
|
|
name: "Arbitrary Test Policy (all platforms) (all teams)",
|
|
query: "SELECT 1 FROM osquery_info WHERE 1=1;",
|
|
description:
|
|
"If you're seeing this, mostly likely this is because someone is testing out failing policies in dogfood. You can ignore this.",
|
|
critical: true,
|
|
author_id: 77,
|
|
author_name: "Test Admin",
|
|
author_email: "test@admin.com",
|
|
team_id: null,
|
|
resolution:
|
|
'To make it pass, change "1=0" to "1=1". To make it fail, change "1=1" to "1=0".',
|
|
platform: "darwin,windows,linux",
|
|
created_at: "2022-08-04T19:30:18Z",
|
|
updated_at: "2022-08-30T15:08:26Z",
|
|
passing_host_count: 10,
|
|
failing_host_count: 9,
|
|
host_count_updated_at: "2023-12-20T15:23:57Z",
|
|
webhook: "Off",
|
|
has_run: true,
|
|
next_update_ms: 3600000,
|
|
calendar_events_enabled: false,
|
|
conditional_access_enabled: false,
|
|
},
|
|
],
|
|
};
|
|
|
|
if (overrides) {
|
|
MOCK_POLICIES_RESPONSE.policies.push(createMockPolicy(overrides));
|
|
}
|
|
|
|
return MOCK_POLICIES_RESPONSE;
|
|
};
|
|
|
|
export default createMockPolicy;
|