fleetdm / fleet

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

Create a 'person' API endpoint #17000

Open dherder opened 8 months ago

dherder commented 8 months ago

Problem

Users would like to be able to search for the people/humans associated with a device rather than search for a device and find the human associated with it. Additionally, it is not uncommon to have many devices associated with a single person. The use case of wanting to know all the devices a human/person has is much more common than searching for all the people (users) using a single device (like in a shared computer use case).

Potential solutions

From @noahtalerman: I'm thinking the first step could be a GET /fleet/human/:id endpoint (riffing) that returns all devices for a specific person. Then, you could hit an endpoint to apply the label to each device.

noahtalerman commented 8 months ago

wanting to know all the devices a human/person has

@dherder heads up that this can be accomplished today w/ GET /hosts?query={email}. This will return all devices that are associated with the person's email.

I agree a new endpoint is easier to understand / clearer. Bringing this to feature fest.

dherder commented 8 months ago

@noahtalerman the problem is that if a user wanted to apply a label 1:1 with a "person", they cannot do that with the above approach.

noahtalerman commented 8 months ago

the problem is that if a user wanted to apply a label 1:1 with a "person", they cannot do that with the above approach.

Here's how this could work:

  1. Automation hits GET /hosts?query={email} endpoint. This returns a list of hosts for that person (end user).
  2. For each host in the list, automation hits the POST /hosts/:id/labels endpoint to apply the label to each host.
  3. The label is applied to all of the end user's hosts.

Does that work?

dherder commented 8 months ago

@noahtalerman that approach doesn't work unfortunately. I want to hit an endpoint to get all the "humans" without knowing anything about an email.

noahtalerman commented 7 months ago

@dherder got it. Thanks!

Heads up that we didn't have room for this improvement in the design sprint we just kicked off (4.48).