fleet/frontend/interfaces/activity.ts
Lucas Manuel Rodriguez 328004d679
Log failed login attempts as activities (#9430)
#9119

To test the SSO changes locally you can use:

https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Testing-and-local-development.md#testing-sso

@RachelElysia Please take a look at the UI changes (All I did was
copy/paste and amend the changes for the new activity type.)

IMO we shouldn't display an avatar because there's no "actual user"
involved in these failed login attempts activities (by "actual user" I
mean the user attributed to the activity):

<img width="446" alt="Screenshot 2023-01-19 at 10 41 05"
src="https://user-images.githubusercontent.com/2073526/213524771-b85901ce-eec0-4cf3-919c-73162285e20b.png">

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)
- ~[ ] Documented any permissions changes~
- ~[ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)~
- ~[ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.~
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality
  - ~For Orbit and Fleet Desktop changes:~
- ~[ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.~
- ~[ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).~
2023-01-20 12:43:22 -03:00

66 lines
1.9 KiB
TypeScript

import { IPolicy } from "./policy";
import { IQuery } from "./query";
import { ITeamSummary } from "./team";
export enum ActivityType {
CreatedPack = "created_pack",
DeletedPack = "deleted_pack",
EditedPack = "edited_pack",
CreatedPolicy = "created_policy",
DeletedPolicy = "deleted_policy",
EditedPolicy = "edited_policy",
CreatedSavedQuery = "created_saved_query",
DeletedSavedQuery = "deleted_saved_query",
EditedSavedQuery = "edited_saved_query",
CreatedTeam = "created_team",
DeletedTeam = "deleted_team",
LiveQuery = "live_query",
AppliedSpecPack = "applied_spec_pack",
AppliedSpecPolicy = "applied_spec_policy",
AppliedSpecSavedQuery = "applied_spec_saved_query",
AppliedSpecTeam = "applied_spec_team",
EditedAgentOptions = "edited_agent_options",
UserAddedBySSO = "user_added_by_sso",
UserLoggedIn = "user_logged_in",
UserFailedLogin = "user_failed_login",
UserCreated = "created_user",
UserDeleted = "deleted_user",
UserChangedGlobalRole = "changed_user_global_role",
UserDeletedGlobalRole = "deleted_user_global_role",
UserChangedTeamRole = "changed_user_team_role",
UserDeletedTeamRole = "deleted_user_team_role",
MdmEnrolled = "mdm_enrolled",
MdmUnenrolled = "mdm_unenrolled",
}
export interface IActivity {
created_at: string;
id: number;
actor_full_name: string;
actor_id: number;
actor_gravatar: string;
actor_email?: string;
type: ActivityType;
details?: IActivityDetails;
}
export interface IActivityDetails {
pack_id?: number;
pack_name?: string;
policy_id?: number;
policy_name?: string;
query_id?: number;
query_name?: string;
query_sql?: string;
team_id?: number;
team_name?: string;
teams?: ITeamSummary[];
targets_count?: number;
specs?: IQuery[] | IPolicy[];
global?: boolean;
public_ip?: string;
user_email?: string;
email?: string;
role?: string;
host_serial?: string;
installed_from_dep?: boolean;
}