2023-12-12 22:21:44 +00:00
import { startCase } from "lodash" ;
2021-04-27 20:55:33 +00:00
import PropTypes from "prop-types" ;
2023-12-12 21:03:33 +00:00
import vulnerabilityInterface from "./vulnerability" ;
2021-04-27 20:55:33 +00:00
export default PropTypes . shape ( {
type : PropTypes . string ,
name : PropTypes.string ,
version : PropTypes.string ,
2021-07-15 17:01:52 +00:00
source : PropTypes.string ,
2021-04-27 20:55:33 +00:00
id : PropTypes.number ,
2021-07-15 17:01:52 +00:00
vulnerabilities : PropTypes.arrayOf ( vulnerabilityInterface ) ,
2021-04-27 20:55:33 +00:00
} ) ;
2021-07-15 17:01:52 +00:00
2022-11-18 16:25:39 +00:00
export interface ISoftwareResponse {
counts_updated_at : string ;
software : ISoftware [ ] ;
}
export interface ISoftwareCountResponse {
count : number ;
}
export interface IGetSoftwareByIdResponse {
software : ISoftware ;
}
2023-12-12 21:03:33 +00:00
// TODO: old software interface. replaced with ISoftwareVersion
// check to see if we still need this.
2021-07-15 17:01:52 +00:00
export interface ISoftware {
id : number ;
2021-09-29 04:04:58 +00:00
name : string ; // e.g., "Figma.app"
version : string ; // e.g., "2.1.11"
2023-03-23 16:32:32 +00:00
bundle_identifier? : string | null ; // e.g., "com.figma.Desktop"
2021-09-29 04:04:58 +00:00
source : string ; // e.g., "apps"
generated_cpe : string ;
2023-12-12 21:03:33 +00:00
vulnerabilities : ISoftwareVulnerability [ ] | null ;
2023-03-23 16:32:32 +00:00
hosts_count? : number ;
2021-09-29 04:04:58 +00:00
last_opened_at? : string | null ; // e.g., "2021-08-18T15:11:35Z”
2023-05-18 13:35:58 +00:00
installed_paths? : string [ ] ;
2021-07-15 17:01:52 +00:00
}
2022-04-07 19:12:38 +00:00
2024-02-08 16:56:32 +00:00
export type IVulnerabilitySoftware = Omit < ISoftware , " vulnerabilities " > & {
resolved_in_version : string ;
} ;
2024-02-07 02:39:49 +00:00
2023-12-12 21:03:33 +00:00
export interface ISoftwareTitleVersion {
id : number ;
version : string ;
vulnerabilities : string [ ] | null ; // TODO: does this return null or is it omitted?
hosts_count? : number ;
}
2024-05-09 13:06:58 +00:00
export interface ISoftwarePackage {
name : string ;
version : string ;
uploaded_at : string ;
install_script : string ;
pre_install_query? : string ;
post_install_script? : string ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
self_service : boolean ;
2024-05-09 13:06:58 +00:00
status : {
installed : number ;
pending : number ;
failed : number ;
} ;
}
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
interface ISoftwareTitle {
2023-12-12 21:03:33 +00:00
id : number ;
name : string ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
software_package : ISoftwarePackage | string | null ;
2023-12-12 21:03:33 +00:00
versions_count : number ;
source : string ;
hosts_count : number ;
2024-02-16 21:50:25 +00:00
versions : ISoftwareTitleVersion [ ] | null ;
2023-12-12 21:03:33 +00:00
browser : string ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
self_service? : boolean ;
}
export interface ISoftwareTitleWithPackageName
extends Omit < ISoftwareTitle , " software_package " | " self - service " > {
software_package : string | null ;
self_service : boolean ;
}
export interface ISoftwareTitleWithPackageDetail
extends Omit < ISoftwareTitle , " software_package " | " self - service " > {
software_package : ISoftwarePackage | null ;
self_service? : never ;
2023-12-12 21:03:33 +00:00
}
export interface ISoftwareVulnerability {
cve : string ;
details_link : string ;
cvss_score? : number | null ;
epss_probability? : number | null ;
cisa_known_exploit? : boolean | null ;
cve_published? : string | null ;
cve_description? : string | null ;
resolved_in_version? : string | null ;
2024-02-08 13:54:00 +00:00
created_at? : string | null ;
2023-12-12 21:03:33 +00:00
}
export interface ISoftwareVersion {
id : number ;
name : string ; // e.g., "Figma.app"
version : string ; // e.g., "2.1.11"
bundle_identifier? : string ; // e.g., "com.figma.Desktop"
source : string ; // e.g., "apps"
2023-12-12 22:21:44 +00:00
browser : string ; // e.g., "chrome"
2023-12-12 21:03:33 +00:00
release : string ; // TODO: on software/verions/:id?
vendor : string ;
arch : string ; // e.g., "x86_64" // TODO: on software/verions/:id?
generated_cpe : string ;
vulnerabilities : ISoftwareVulnerability [ ] | null ;
hosts_count? : number ;
}
2023-12-12 22:21:44 +00:00
export const SOURCE_TYPE_CONVERSION : Record < string , string > = {
2022-04-07 19:12:38 +00:00
apt_sources : "Package (APT)" ,
deb_packages : "Package (deb)" ,
portage_packages : "Package (Portage)" ,
rpm_packages : "Package (RPM)" ,
yum_sources : "Package (YUM)" ,
npm_packages : "Package (NPM)" ,
2023-12-04 19:26:26 +00:00
atom_packages : "Package (Atom)" , // Atom packages were removed from software inventory. Mapping is maintained for backwards compatibility. (2023-12-04)
2022-04-07 19:12:38 +00:00
python_packages : "Package (Python)" ,
apps : "Application (macOS)" ,
2023-12-12 22:21:44 +00:00
chrome_extensions : "Browser plugin" , // chrome_extensions can include any chrome-based browser (e.g., edge), so we rely instead on the `browser` field computed by Fleet server and fallback to this value if it is not present.
2022-04-07 19:12:38 +00:00
firefox_addons : "Browser plugin (Firefox)" ,
safari_extensions : "Browser plugin (Safari)" ,
homebrew_packages : "Package (Homebrew)" ,
programs : "Program (Windows)" ,
ie_extensions : "Browser plugin (IE)" ,
chocolatey_packages : "Package (Chocolatey)" ,
pkg_packages : "Package (pkg)" ,
2024-03-05 16:59:53 +00:00
vscode_extensions : "IDE extension (VS Code)" ,
2022-06-08 19:01:38 +00:00
} as const ;
2022-04-07 19:12:38 +00:00
2023-12-12 22:21:44 +00:00
const BROWSER_TYPE_CONVERSION : Record < string , string > = {
chrome : "Chrome" ,
chromium : "Chromium" ,
opera : "Opera" ,
yandex : "Yandex" ,
brave : "Brave" ,
edge : "Edge" ,
edge_beta : "Edge Beta" ,
} as const ;
export const formatSoftwareType = ( {
source ,
browser ,
} : {
source : string ;
2024-05-09 21:44:50 +00:00
browser? : string ;
2023-12-12 22:21:44 +00:00
} ) = > {
let type = SOURCE_TYPE_CONVERSION [ source ] || "Unknown" ;
if ( browser ) {
type = ` Browser plugin ( ${
BROWSER_TYPE_CONVERSION [ browser ] || startCase ( browser )
} ) ` ;
}
return type ;
2022-04-07 19:12:38 +00:00
} ;
2024-05-10 15:57:47 +00:00
/ * *
* This list comprises all possible states of software install operations .
* /
export const SOFTWARE_INSTALL_STATUSES = [
"failed" ,
"installed" ,
"pending" ,
] as const ;
2024-05-09 20:45:53 +00:00
/ *
* SoftwareInstallStatus represents the possible states of software install operations .
* /
2024-05-10 15:57:47 +00:00
export type SoftwareInstallStatus = typeof SOFTWARE_INSTALL_STATUSES [ number ] ;
export const isValidSoftwareInstallStatus = (
s : string | undefined
) : s is SoftwareInstallStatus = >
! ! s && SOFTWARE_INSTALL_STATUSES . includes ( s as SoftwareInstallStatus ) ;
2024-05-09 20:45:53 +00:00
/ * *
* ISoftwareInstallResult is the shape of a software install result object
* returned by the Fleet API .
* /
export interface ISoftwareInstallResult {
install_uuid : string ;
software_title : string ;
software_title_id : number ;
software_package : string ;
host_id : number ;
host_display_name : string ;
2024-05-10 15:57:47 +00:00
status : SoftwareInstallStatus ;
2024-05-09 20:45:53 +00:00
detail : string ;
output : string ;
pre_install_query_output : string ;
post_install_script_output : string ;
}
export interface ISoftwareInstallResults {
results : ISoftwareInstallResult ;
}
2024-05-09 21:44:50 +00:00
// ISoftwareInstallerType defines the supported installer types for
// software uploaded by the IT admin.
export type ISoftwareInstallerType = "pkg" | "msi" | "deb" | "exe" ;
export interface ISoftwareLastInstall {
install_uuid : string ;
installed_at : string ;
}
export interface ISoftwareInstallVersion {
version : string ;
last_opened_at : string | null ;
2024-05-10 15:18:24 +00:00
vulnerabilities : string [ ] | null ;
2024-05-09 21:44:50 +00:00
installed_paths : string [ ] ;
}
export interface IHostSoftware {
id : number ;
name : string ;
2024-05-10 15:18:24 +00:00
package_available_for_install? : string | null ;
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
self_service : boolean ;
2024-05-09 21:44:50 +00:00
source : string ;
2024-05-10 15:18:24 +00:00
bundle_identifier? : string ;
2024-05-10 15:57:47 +00:00
status : SoftwareInstallStatus | null ;
2024-05-09 21:44:50 +00:00
last_install : ISoftwareLastInstall | null ;
installed_versions : ISoftwareInstallVersion [ ] | null ;
}
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
2024-06-11 11:56:50 +00:00
export type IDeviceSoftware = Omit <
IHostSoftware ,
"package_available_for_install"
> & {
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] 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.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] 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)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
package : {
name : string ;
version : string ;
} ;
2024-06-11 11:56:50 +00:00
} ;