fleet/pkg/file
Jonathan Katz 59a73b1e47
32084 Cisco Secure Client installer fix (#35077)
**Related issue:** Resolves #32084 
This PR modifies `isValidAppFilePath` to allow subdirectors in
`Applications/`, like in this case `Applications/Cisco/Cisco Secure
Client.app`.
This also changes the metadata extraction from packageinfo to trim
`.app` from the name in all cases.

# Checklist for submitter

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

- [x] 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)
- [ ] 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

### Test plan:
---
I ran this on my local environment and it seemed fine
- Have environment with the bug recreated, it has two software titles
for "Cisco Secure Client", and the one with the bundle id
`com.cisco.pkg.anyconnect.vpn` is used by the installer.
- URL to pkg:
https://fndtnfleetmsp.blob.core.windows.net/fndtnpkgs/cisco-secure-client-macos-5.1.3.62-core-vpn-webdeploy-k9.pkg
- Cisco Secure Client doesn't show as installed in UI even after
installing.
- Run the new migration.
- Cisco Secure Client shows as installed now in ui, software title with
bundle id `com.cisco.pkg.anyconnect.vpn` is gone from the database, and
the software installer references the correct title
(`com.cisco.secureclient.gui`).
- Check that deleting and reuploading the installer doesn't recreate the
bad software title.

### QA Note:
---
There are some problems with the install script, but that is probably a
different scope than this ticket.
`Reinstall` wont work, it says Cisco Secure Client is already installed.
Uninstalling through Fleet then Installing again works fine though.
2025-11-03 15:22:39 -05:00
..
scripts Add waits + norestart to MSI uninstall scripts (#31078) 2025-07-23 09:27:59 -05:00
testdata 32084 Cisco Secure Client installer fix (#35077) 2025-11-03 15:22:39 -05:00
deb.go Add support for zstd deb packages (#23657) 2024-11-11 14:13:01 -05:00
file.go Initial support for in-house apps on iOS/iPadOS (#34802) 2025-10-28 08:33:58 -04:00
file_bench_test.go Improve memory usage of software installers parsing (#23596) 2024-11-12 09:28:08 -05:00
file_test.go Add custom software icons (#32652) 2025-09-05 17:31:03 -05:00
ipa.go Initial support for in-house apps on iOS/iPadOS (#34802) 2025-10-28 08:33:58 -04:00
management.go Update MSI uninstall script for FMAs, unify with custom package version (#31111) 2025-07-23 09:29:59 -05:00
management_test.go Update golangci-lint to v2.4.0 (#33251) 2025-09-22 13:17:11 -05:00
msi.go Extract UpgradeCode from MSI custom packages, use for better uninstall script generation (#30969) 2025-07-17 10:33:23 -05:00
pdf.go Consider an empty EULA pdf file the same as an invalid one, returning 400 Bad Request (#12542) 2023-06-28 08:19:42 -04:00
pdf_test.go Consider an empty EULA pdf file the same as an invalid one, returning 400 Bad Request (#12542) 2023-06-28 08:19:42 -04:00
pe.go Fall back to FileVersion when an EXE installer has FileVersion but not ProductVersion (#25070) 2024-12-31 14:28:15 -06:00
pe_test.go Improve memory usage of software installers parsing (#23596) 2024-11-12 09:28:08 -05:00
rpm.go Add support to upload RPM packages (#22502) 2024-10-01 13:02:13 -03:00
rpm_test.go Improve memory usage of software installers parsing (#23596) 2024-11-12 09:28:08 -05:00
tgz.go Add .tar.gz package support (#28339) 2025-05-02 09:07:35 -05:00
validation.go cli: try to infer the bootstrap package name from the URL too (#11571) 2023-05-11 10:36:28 -03:00
validation_test.go cli: try to infer the bootstrap package name from the URL too (#11571) 2023-05-11 10:36:28 -03:00
xar.go 32084 Cisco Secure Client installer fix (#35077) 2025-11-03 15:22:39 -05:00
xar_test.go 32084 Cisco Secure Client installer fix (#35077) 2025-11-03 15:22:39 -05:00