Fixed a bug where certain macOS app names could be ingested as empty strings due to incorrect ".app" suffix removal. (#39563)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #34620 # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Bug Fixes * Fixed an issue where macOS app names could become empty after removing the ".app" extension. The app name extraction logic now correctly handles edge cases, ensuring app names are properly ingested without empty values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fixed a bug where certain macOS app names could be ingested as empty strings due to incorrect ".app" suffix removal.
|
||||
@@ -805,7 +805,9 @@ WITH cached_users AS (WITH cached_groups AS (select * from groups)
|
||||
FROM users LEFT JOIN cached_groups USING (gid)
|
||||
WHERE type <> 'special' AND shell NOT LIKE '%/false' AND shell NOT LIKE '%/nologin' AND shell NOT LIKE '%/shutdown' AND shell NOT LIKE '%/halt' AND username NOT LIKE '%$' AND username NOT LIKE '\_%' ESCAPE '\' AND NOT (username = 'sync' AND shell ='/bin/sync' AND directory <> ''))
|
||||
SELECT
|
||||
COALESCE(NULLIF(display_name, ''), NULLIF(bundle_name, ''), NULLIF(NULLIF(bundle_executable, ''), 'run.sh'), TRIM(name, '.app') ) AS name,
|
||||
COALESCE(NULLIF(display_name, ''), NULLIF(bundle_name, ''), NULLIF(NULLIF(bundle_executable, ''), 'run.sh'),
|
||||
CASE WHEN name IS NOT NULL AND lower(name) LIKE '%.app' THEN substr(name, 1, length(name) - 4) ELSE name END
|
||||
) AS name,
|
||||
COALESCE(NULLIF(bundle_short_version, ''), bundle_version) AS version,
|
||||
bundle_identifier AS bundle_identifier,
|
||||
'' AS extension_id,
|
||||
|
||||
@@ -974,7 +974,9 @@ var softwareMacOS = DetailQuery{
|
||||
// which is used in vulnerability scanning.
|
||||
Query: withCachedUsers(`WITH cached_users AS (%s)
|
||||
SELECT
|
||||
COALESCE(NULLIF(display_name, ''), NULLIF(bundle_name, ''), NULLIF(NULLIF(bundle_executable, ''), 'run.sh'), TRIM(name, '.app') ) AS name,
|
||||
COALESCE(NULLIF(display_name, ''), NULLIF(bundle_name, ''), NULLIF(NULLIF(bundle_executable, ''), 'run.sh'),
|
||||
CASE WHEN name IS NOT NULL AND lower(name) LIKE '%%.app' THEN substr(name, 1, length(name) - 4) ELSE name END
|
||||
) AS name,
|
||||
COALESCE(NULLIF(bundle_short_version, ''), bundle_version) AS version,
|
||||
bundle_identifier AS bundle_identifier,
|
||||
'' AS extension_id,
|
||||
|
||||
Reference in New Issue
Block a user