fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.12k stars 431 forks source link

Add ability to detect compatibility and update which hosts are checked for an existing policy #2716

Closed noahtalerman closed 2 years ago

noahtalerman commented 3 years ago

Goal

As a Fleet admin or maintainer, I want to specify the platform (macOS, Windows, Linux) for a specific policy so that I can answer a specific yes or no question about only my macOS devices.

Figma

Add ability to specify which hosts are checked for a given policy by platform: https://www.figma.com/file/hdALBDsrti77QuDNSzLdkx/?node-id=2931%3A79321

Backend (Done): #3220

Tasks

1

image


2


3


4

image

No platforms selected:

image


5

image


6

If no platform is selected...

image

noahtalerman commented 3 years ago

@mike-j-thomas I've assigned you to this issue and added it into the Growth board.

Can you please complete wireframes for the following UI element?

mike-j-thomas commented 3 years ago

@noahtalerman made the above UI changes:

Figma: https://www.figma.com/file/hdALBDsrti77QuDNSzLdkx/?node-id=2931%3A79321

Tooltip interaction prototype: https://www.figma.com/proto/bdl76K7p0NaRv2rKXoBVfO/Prototypes-(clickable-mockups%2C-diagrams)?page-id=810%3A127871&node-id=810%3A127879&viewport=462%2C48%2C0.84&scaling=min-zoom&starting-point-node-id=810%3A127879&show-proto-sidebar=1

Reference images: image

image

noahtalerman commented 3 years ago

@mike-j-thomas looks great! Thank you.

FYI, I took a pass on the "override" state that is displayed when the user selects the pencil icon in the "Compatible with" section. Screen Shot 2021-11-02 at 9 35 56 AM

I'm going to bring my pass to engineering however, I'm curious if you have any feedback or thoughts that we can break into a "spiffier" change.

mike-j-thomas commented 3 years ago

Argh... sorry. I completely forgot the override state. What you did is spot on 👍

noahtalerman commented 3 years ago

@mike-j-thomas it was a mess up from me to not indicate, in this issue's description, that we need the override state. Always room to improve!

noahtalerman commented 3 years ago

@lukeheath I'm assigning this issue to you for UI review.

Please note that these UI changes to the New policy page and Edit policy page are dependent on the following issue that specifies adding these pages: #2595

Please pass the issue back to me if you have any questions or concerns with the approach :)

noahtalerman commented 3 years ago

EDIT: Ignore the below! The backend specification is already included in the issue. I added the ":estimate" to signal that this issue is ready for estimation.


Adding the ability to specify which hosts are checked for a given policy will also require changes to the API and backend.

@chiiph the following are proposed updates to the /policies API routes to support storing and retrieving platform information. When you get the chance, can you please update this issue's description with a backend specification that includes your decision on the API interface?

The platform property will determine which hosts the policy runs on. For example, if a policy's platform is set to darwin,linux, the policy will only run on macOS and Linux hosts.

Update existing API routes:

New parameters:

Example request:

PATCH /api/v1/fleet/policies/{id}

{
    “platform”: “darwin,windows,linux”,
}

Example response:

{
  "policy": {
      "id": 2,
      "name": "Is Gatekeeper enabled on macOS devices?",
      “description”: “Checks to make sure that the Gatekeeper feature is enabled on macOS devices. This feature enforces code signing and verifies downloaded applications before allowing them to run, thereby reducing the likelihood of inadvertently executing malware.”
      “platform”: “darwin,windows,linux”,
      "resolution": "Some resolution steps",
      "passing_host_count": 0,
      "failing_host_count": 0
    }
}
chiiph commented 3 years ago

@noahtalerman I've updated the API to match the new API of the dependent ticket and use an array of platforms rather than a string.

lukeheath commented 3 years ago

Sarah: Provide more trust in the up-to-date status of the osquery's table JSON. Currently Zach updates manually.

Noah: Proposed behavior is that once this user goes into override mode, they are always in override mode. They are taking the compatibility into their own hands. If they never go into override mode, it's checked by Fleet but only updated on save.

Sarah: We need a flag to define if the user overwrote the platforms compatibility.

Noah: Let's have the policy be in edit mode always once it is saved. So the automatic platform detection only happens on new queries.

Sarah: So when they come back to a saved policy query, Fleet will only show platforms that have been saved and not evaluate the SQL.

Sarah: How do we want to handle existing queries?

Tomas: There will be a migration.

Noah: This will only apply to policy queries, not standard queries.

Sarah: When a user adds a queries to the global schedule through the simple interface there is no way to set platforms?

Noah: You have to click into advanced options.

Lucas: What migration will run?

Tomas: When we add the column we need to define what the avlue means for platforms for all existing policies.

lukeheath commented 3 years ago

Sarah: Does this ticket involve adding the column and running the check on queries?

Tomas: Yes.

noahtalerman commented 2 years ago

From 🪚 Estimation on 2021-11-11:

Noah: Let's have the policy be in edit mode always once it is saved. So the automatic platform detection only happens on new queries.

I made an adjustment to the decision outlined in the comment above.

@lukeheath when you get the chance, can you please update this issue's description with the following expected behavior?

Expected behavior:

More details on the above expected behavior are included in updated dev notes in Figma. I'm linking to this issue's page in Figma here: https://www.figma.com/file/hdALBDsrti77QuDNSzLdkx/?node-id=2931%3A79321

lukeheath commented 2 years ago

Rachel: We need an error state if they try to save no platforms selected. Luke: I need to update API specs link and array of paltforms param.

lukeheath commented 2 years ago

Hey team! Please add your planning poker estimate with ZenHub @gillespi314 @martavis @RachelElysia

lukeheath commented 2 years ago

Adding some additional points to this ticket to allow time for including unit tests on the compatibility component based on an established pattern (another ticket).

lukeheath commented 2 years ago

@gillespi314 So that you are not blocked by #3028, I propose we not include unit tests as part of this ticket. I'm thinking next sprint we have a ticket for backfilling some important unit tests with React Testing Library, and include this component. Does that work for you?

gillespi314 commented 2 years ago

@lukeheath works for me!

noahtalerman commented 2 years ago

@gillespi314 heads up, I'm unassigning you from this issue because this issue is being moved back to the start of the product design process.

This is because the UI changes specified in this issue need to be updated after the ability to specify a policy's platform (for new policy's) was included in the Fleet 4.7.0 release.

noahtalerman commented 2 years ago

Frontend estimation prior to moving the issue back to the start of the product design process: 5

lukeheath commented 2 years ago

@noahtalerman A few questions:

1) Does the "Compatible with" list in the sidebar update immediately?

image

2) I'm not clear on what this dev note means. Will you please clarify?

image

3) Should the "Compatible with" list in the sidebar also be applied to queries?

4) Will queries continue to have only automatic compatibility detection?

Thanks!

noahtalerman commented 2 years ago

Does the "Compatible with" list in the sidebar update immediately?

When creating or editing a policy, does this list filter down to compatible platforms in realtime?

@lukeheath No, the "Compatible with" list only changes when the user selects a new table in the "Tables" dropdown in the sidebar. This is the same behavior as the current behavior.

Should the "Compatible with" list in the sidebar also be applied to queries?

Yes, the copy changes to "Compatible with:" and "macOS" should also be applied to the sidebar in the Edit query and New query pages.

I'm not clear on what this dev note means. Will you please clarify?

Yes, definitely. That dev note was pointing to the wrong UI element. Here's an updated screenshot: Screen Shot 2022-01-27 at 11 14 15 AM

The green checks and red x's are always determined on the fly.

Will queries continue to have only automatic compatibility detection?

Yes, I'm interpreting this question as "the 'Checks on' checkboxes will not exist on the query pages."

lukeheath commented 2 years ago

Martavis: The validation errors seem inconsistent in the save modal. If no name is provided, it lets the user click save before showing error. If no platform is selected, save is disabled with a tooltip. @noahtalerman < Product feedback

noahtalerman commented 2 years ago

The validation errors seem inconsistent in the save modal. If no name is provided, it lets the user click save before showing error. If no platform is selected, save is disabled with a tooltip.

@martavis this is a great point. I filed a separate "Make UI show required form fields in a consistent way" issue and tracking it in the product weekly board here: #3912