Files
fleet/server/mdm/maintainedapps
Jonathan Katz 61bae56fd2 Patch when closed: migration, types, FMA ingestion (#49691)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #49415 

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements), JS
inline code is prevented especially for url redirects, and untrusted
data interpolated into shell scripts/commands is validated against shell
metacharacters.
- [ ] Timeouts are implemented and retries are limited to avoid infinite
loops
- [ ] If paths of existing endpoints are modified without backwards
compatibility, checked the frontend/CLI for any necessary changes

## Testing

- [x] Added/updated automated tests
- [ ] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [x] QA'd all new/changed functionality manually
- Tested with FLEET_DEV_MAINTAINED_APPS_BASE_URL pointed to a branch
with the new queries. If there is an open query, adding the FMA adds it
to `app_open_query`. If not, it remains empty.
- Also tested a few of the `SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM
apps a JOIN processes p ON p.path LIKE concat(a.path, '/%%') WHERE
a.bundle_identifier = '%s');` queries locally on apps available in
dogfood self service, looks like it will work reasonably well for a
start.

## Database migrations

- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- N/A Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
  - No timestamp updates
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added a policy option to skip patch installation while the managed
application is open.
  * Added support for detecting open applications on macOS and Windows.
* Maintained applications now preserve and use app-open checks during
installation and updates.
* Policy and installer responses now include the related configuration
fields.

* **Bug Fixes**
* Ensured app-open settings are retained when installers are created,
updated, or retrieved.
* Existing policies and installers receive safe default values for the
new settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-22 14:27:06 -04:00
..