-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akj32d7 40 review findings across 40 files #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
18dd7cc
fdf04c6
3abd25e
56e8828
fd1b0ed
e2854c8
6cf2522
da9c980
9e87702
05efcc5
92bad79
f50f0f5
a0f7b9f
e267939
a9b0f14
8774c33
1f30b5c
a71c6ef
da6b25f
386ef02
f68b0a5
d1437cc
382e429
55a4a6d
76a22bc
609d4bd
55b33dd
5d9a0ac
9cd73c1
7cb64a8
bbef622
eb6e61a
86f78c4
4f6536c
d4122a7
a3dfd57
32f7aab
4101fef
3197acf
319688b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,17 @@ | ||
| #!/bin/bash | ||
|
|
||
| sudo /usr/bin/defaults write /Library/Application\ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π CIS_2.6.2.sh path continuation via unescaped line break inside a string literal is fragile and likely broken Replaced all four fragile mid-path backslash-newline continuations ( π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| Support/CrashReporter/DiagnosticMessagesHistory.plist AutoSubmit -bool false | ||
| sudo /usr/bin/defaults write "/Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist" AutoSubmit -bool false | ||
|
|
||
| sudo /usr/bin/defaults write /Library/Application\ | ||
| Support/CrashReporter/DiagnosticMessagesHistory.plist ThirdPartyDataSubmit -bool false | ||
| sudo /usr/bin/defaults write "/Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist" ThirdPartyDataSubmit -bool false | ||
|
|
||
| sudo /bin/chmod 644 /Library/Application\ | ||
| Support/CrashReporter/DiagnosticMessagesHistory.plist | ||
| sudo /bin/chmod 644 "/Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist" | ||
|
|
||
| sudo /usr/sbin/chgrp admin /Library/Application\ | ||
| Support/CrashReporter/DiagnosticMessagesHistory.plist | ||
| sudo /usr/sbin/chgrp admin "/Library/Application Support/CrashReporter/DiagnosticMessagesHistory.plist" | ||
|
|
||
|
|
||
| echo "This needs modification" | ||
| sudo -u <username> /usr/bin/defaults write | ||
| /Users/<username>/Library/Preferences/com.apple.assistant.support "Siri DataSharing Opt-In Status" -int 2 | ||
|
|
||
| # Example: | ||
| # sudo -u sharonkatz /usr/bin/defaults write /Users/sharonkatz/Library/Preferences/com.apple.assistant.support "Siri Data Sharing Opt-In Status" -int 2 | ||
| # sudo -u sharonkatz /usr/bin/defaults write /Users/sharonkatz/Library/Preferences/com.apple.assistant.support "Siri Data Sharing Opt-In Status" -int 2 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,10 +88,6 @@ export default class TableOSVersion extends Table { | |
| column: "codename", | ||
| error_message: err.message.toString(), | ||
| }); | ||
| warningsArray.push({ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π os_version.ts silently drops columns declared but never populated ( Removed the misleading π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| column: "platform_like", | ||
| error_message: err.message.toString(), | ||
| }); | ||
| } | ||
|
|
||
| let arch; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package externalrefs | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "log" | ||
|
|
||
| maintained_apps "github.com/fleetdm/fleet/v4/ee/maintained-apps" | ||
| ) | ||
|
|
@@ -14,15 +14,18 @@ var Funcs = map[string][]func(*maintained_apps.FMAManifestApp) (*maintained_apps | |
|
|
||
| // EnrichManifest applies all registered enrichment functions for the given app. | ||
| // Enrichers are looked up by app.Slug and run sequentially. | ||
| // Errors are logged but do not stop the enrichment pipeline. | ||
| // Errors are logged and stop the enrichment pipeline for that app, preserving | ||
| // the last known-good app value. | ||
| func EnrichManifest(app *maintained_apps.FMAManifestApp) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Enrichment errors are silently logged with fmt.Printf and swallowed, discarding partial-state app pointer Changed π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
| if enrichers, ok := Funcs[app.Slug]; ok { | ||
| for _, enricher := range enrichers { | ||
| var err error | ||
| app, err = enricher(app) | ||
| enriched, err := enricher(app) | ||
| if err != nil { | ||
| fmt.Printf("Error enriching app %s: %v\n", app.UniqueIdentifier, err) | ||
| log.Printf("Error enriching app %s: %v\n", app.UniqueIdentifier, err) | ||
| break | ||
| } | ||
| app = enriched | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,14 +100,18 @@ trash() { | |
| fi | ||
|
|
||
| local trash="/Users/$logged_in_user/.Trash" | ||
| local file_name="$(basename "${target_file}")" | ||
|
|
||
| if [[ -e "$target_file" ]]; then | ||
| echo "removing $target_file." | ||
| mv -f "$target_file" "$trash/${file_name}_${timestamp}_${rand}" | ||
| else | ||
| echo "$target_file doesn't exist." | ||
| fi | ||
| local file_name | ||
|
|
||
| # Glob-expand target_file (compgen preserves spaces in the path; [[ -e "$x" ]] does not expand *) | ||
| while IFS= read -r expanded_file; do | ||
| if [[ -e "$expanded_file" ]]; then | ||
| file_name="$(basename "${expanded_file}")" | ||
| echo "removing $expanded_file." | ||
| mv -f "$expanded_file" "$trash/${file_name}_${timestamp}_${rand}" | ||
| else | ||
| echo "$expanded_file doesn't exist." | ||
| fi | ||
| done < <(compgen -G "$target_file") | ||
| } | ||
|
|
||
| remove_launchctl_service 'com.macpaw.CleanMyMac5.HealthMonitor' | ||
|
Comment on lines
100
to
117
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π cleanmymac-uninstall.sh trash() lacks the glob-expansion fix present in the sibling camtasia_uninstall.sh trash() Changed the π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
|
|
@@ -130,3 +134,4 @@ trash $LOGGED_IN_USER '~/Library/LaunchAgents/com.macpaw.CleanMyMac5.Updater.pli | |
| trash $LOGGED_IN_USER '~/Library/Logs/com.macpaw.CleanMyMac5' | ||
| trash $LOGGED_IN_USER '~/Library/Preferences/com.macpaw.CleanMyMac5.plist' | ||
| trash $LOGGED_IN_USER '~/Library/Saved Application State/com.macpaw.CleanMyMac5.savedState' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ set -euo pipefail | |
|
|
||
| # variables | ||
| APPDIR="/Applications/" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π docker_desktop_install.sh: TMPDIR path derived from realpath of INSTALLER_PATH is not necessarily writable/removable, and Docker.app copy leaves TMPDIR unmanaged Changed π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| TMPDIR=$(dirname "$(realpath "$INSTALLER_PATH")") | ||
| TMPDIR=$(mktemp -d) | ||
| MOUNT_POINT="" | ||
|
|
||
| cleanup() { | ||
|
|
@@ -15,6 +15,9 @@ cleanup() { | |
| fi | ||
| rmdir "$mp" >/dev/null 2>&1 || true | ||
| fi | ||
| if [[ -n "${TMPDIR:-}" ]]; then | ||
| rm -rf "$TMPDIR" >/dev/null 2>&1 || true | ||
| fi | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
|
|
@@ -142,3 +145,4 @@ mkdir -p /usr/local/bin | |
| /bin/ln -h -f -s -- "$APPDIR/Docker.app/Contents/Resources/bin/docker-credential-desktop" "/usr/local/bin/docker-credential-desktop" | ||
| /bin/ln -h -f -s -- "$APPDIR/Docker.app/Contents/Resources/bin/docker-credential-ecr-login" "/usr/local/bin/docker-credential-ecr-login" | ||
| /bin/ln -h -f -s -- "$APPDIR/Docker.app/Contents/Resources/bin/docker-credential-osxkeychain" "/usr/local/bin/docker-credential-osxkeychain" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,28 +139,36 @@ module.exports = { | |
| } else {// If we're filtering by a specific team and not getting the results for a single vulnerability, we'll build a list of vulnerabilities that affect that team. | ||
|
|
||
| let hostIdsToFind = _.pluck(await Host.find({teamApid: teamApid}).select(['id']), 'id'); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π Unparameterized SQL query building with raw string concatenation of host IDs in vulnerability report helper In π€ Prompt for AI agentsfix confidence: π΄ 55 low β review closely β react π/π to teach the reviewer |
||
| // TODO use parameterization | ||
| let firstNativeQueryToSend; | ||
| let hostIdsPlaceholders = hostIdsToFind.map((id, i)=>{ | ||
| return sails.config.datastores.default.adapter === 'sails-postgresql' ? `$${i + 1}` : '?'; | ||
| }).join(','); | ||
|
|
||
| if(sails.config.datastores.default.adapter === 'sails-postgresql') { | ||
| firstNativeQueryToSend = ` | ||
| firstNativeQueryToSend = { | ||
| sql: ` | ||
| SELECT * FROM "vulnerability" | ||
| WHERE "id" IN ( | ||
| SELECT "vulnerability" FROM "vulnerabilityinstall" | ||
| WHERE "host" IN (${hostIdsToFind.join(',')}) | ||
| );`; | ||
| WHERE "host" IN (${hostIdsPlaceholders}) | ||
| );`, | ||
| bindings: hostIdsToFind | ||
| }; | ||
| } else if(sails.config.datastores.default.adapter === 'sails-mysql') { | ||
| firstNativeQueryToSend = 'SELECT * FROM `vulnerability` '+ | ||
| 'WHERE `id` IN ('+ | ||
| 'SELECT `vulnerability` FROM `vulnerabilityinstall` '+ | ||
| 'WHERE `host` IN ('+ | ||
| hostIdsToFind.join(',')+ | ||
| ')'+ | ||
| ');'; | ||
| firstNativeQueryToSend = { | ||
| sql: 'SELECT * FROM `vulnerability` '+ | ||
| 'WHERE `id` IN ('+ | ||
| 'SELECT `vulnerability` FROM `vulnerabilityinstall` '+ | ||
| 'WHERE `host` IN ('+ | ||
| hostIdsPlaceholders+ | ||
| ')'+ | ||
| ');', | ||
| bindings: hostIdsToFind | ||
| }; | ||
| } | ||
|
|
||
|
|
||
| let rawResultFromDatabase = await sails.sendNativeQuery(firstNativeQueryToSend); | ||
| let rawResultFromDatabase = await sails.sendNativeQuery(firstNativeQueryToSend.sql, firstNativeQueryToSend.bindings); | ||
|
|
||
| for(let row of rawResultFromDatabase.rows){ | ||
| row.createdAt = Number(row.createdAt); | ||
|
|
@@ -200,17 +208,21 @@ module.exports = { | |
|
|
||
| // Build a where clause for the native query we will be sending. | ||
| let vulnerabilityInstallWhereClause; | ||
| let vulnerabilityIdsToFind = _.pluck(vulnerabilities, 'id'); | ||
| let vulnerabilityIdsPlaceholders = vulnerabilityIdsToFind.map((id, i)=>{ | ||
| return sails.config.datastores.default.adapter === 'sails-postgresql' ? `$${i + 1}` : '?'; | ||
| }).join(','); | ||
|
|
||
| // If we're including resolved install information in this report for a CSV export, we'll send a query without the uninstalledAt condition. | ||
| if(includeResolvedInstalls){ | ||
| vulnerabilityInstallWhereClause = `WHERE vulnerability IN (${_.pluck(vulnerabilities,'id').join(',')})`;// Note this where clause will work with Postgres and MySQL datastores. | ||
| vulnerabilityInstallWhereClause = `WHERE vulnerability IN (${vulnerabilityIdsPlaceholders})`;// Note this where clause will work with Postgres and MySQL datastores. | ||
| } else { // Otherwise, we'll send queries to only get unresolved installs. | ||
|
|
||
| if(sails.config.datastores.default.adapter === 'sails-postgresql') { | ||
| // If this app is configured to use a Postgres datastore, we'll need to put double quotes around the uninstalledAt column name. | ||
| vulnerabilityInstallWhereClause = `WHERE "uninstalledAt" = 0 AND vulnerability IN (${_.pluck(vulnerabilities,'id').join(',')})`; | ||
| vulnerabilityInstallWhereClause = `WHERE "uninstalledAt" = 0 AND vulnerability IN (${vulnerabilityIdsPlaceholders})`; | ||
| } else if(sails.config.datastores.default.adapter === 'sails-mysql') { | ||
| vulnerabilityInstallWhereClause = `WHERE uninstalledAt = 0 AND vulnerability IN (${_.pluck(vulnerabilities,'id').join(',')})`; | ||
| vulnerabilityInstallWhereClause = `WHERE uninstalledAt = 0 AND vulnerability IN (${vulnerabilityIdsPlaceholders})`; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -219,7 +231,7 @@ module.exports = { | |
| SELECT * FROM vulnerabilityinstall | ||
| ${vulnerabilityInstallWhereClause}`; | ||
|
|
||
| let selectedInstallsFromEntireOrg = await sails.sendNativeQuery(vulnerabilityInstallNativeQuery); | ||
| let selectedInstallsFromEntireOrg = await sails.sendNativeQuery(vulnerabilityInstallNativeQuery, vulnerabilityIdsToFind); | ||
|
|
||
| let hostsFromEntireOrg = await Host.find(); | ||
|
|
||
|
|
@@ -305,3 +317,4 @@ module.exports = { | |
|
|
||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ const baseClass = "software-script-details-modal"; | |
|
|
||
| export type IPackageInstallDetails = { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π IPackageInstallDetails.install_uuid marked optional but code assumes always present In π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
| host_display_name?: string; | ||
| install_uuid?: string; // not actually optional | ||
| install_uuid: string; | ||
| }; | ||
|
|
||
| export const renderContactOption = (url?: string) => ( | ||
|
|
@@ -201,8 +201,7 @@ export const SoftwareScriptDetailsModal = ({ | |
| onRerun, | ||
| contactUrl, | ||
| }: ISoftwareInstallDetailsProps) => { | ||
| // will always be present | ||
| const installUUID = detailsFromProps.install_uuid ?? ""; | ||
| const installUUID = detailsFromProps.install_uuid; | ||
|
|
||
| const [showInstallDetails, setShowInstallDetails] = useState(false); | ||
| const toggleInstallDetails = () => { | ||
|
|
@@ -223,6 +222,7 @@ export const SoftwareScriptDetailsModal = ({ | |
| { | ||
| ...DEFAULT_USE_QUERY_OPTIONS, | ||
| staleTime: 3000, | ||
| enabled: !!installUUID, | ||
| select: (data) => data.results as ISoftwareScriptResult, | ||
| } | ||
| ); | ||
|
|
@@ -263,6 +263,15 @@ export const SoftwareScriptDetailsModal = ({ | |
| : undefined; | ||
|
|
||
| const renderContent = () => { | ||
| if (!installUUID) { | ||
| return ( | ||
| <DataError | ||
| description="Couldn't get script details. Missing install UUID." | ||
| excludeIssueLink | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| if (isLoading) { | ||
| return <Spinner />; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,11 +93,6 @@ export const useSoftwareInstaller = ( | |
| 0 | ||
| ); | ||
|
|
||
| const fmaVersions = | ||
| isFleetMaintainedApp && "fleet_maintained_versions" in softwareInstaller | ||
| ? softwareInstaller.fleet_maintained_versions | ||
| : []; | ||
|
|
||
| const isCustomPackage = | ||
| installerType === "package" && !isFleetMaintainedApp; | ||
|
|
||
|
|
@@ -141,7 +136,6 @@ export const useSoftwareInstaller = ( | |
| isAndroidPlayStoreWebApp, | ||
| isFleetMaintainedApp, | ||
| isLatestFmaVersion, | ||
| fmaVersions, | ||
| isCustomPackage, | ||
| isIosOrIpadosApp, | ||
| sha256, | ||
|
Comment on lines
136
to
141
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π isLatestFmaVersion computed but fmaVersions never used consistently / potential undefined destructure order bug In π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,7 +338,8 @@ export const isAndroidBYO = (enrollmentStatus: MdmEnrollmentStatus | null) => { | |
| return enrollmentStatus === "On (personal)"; | ||
| }; | ||
|
|
||
| /** Android COBO (company-owned, fully managed) enrollment. */ | ||
| /** Android COBO (company-owned, fully managed) enrollment. Shares the same | ||
| * current/legacy enrollment status semantics as isAutomaticDeviceEnrollment. */ | ||
| export const isAndroidCOBO = (enrollmentStatus: MdmEnrollmentStatus | null) => { | ||
| return enrollmentStatus === "On (automatic)"; | ||
| return isAutomaticDeviceEnrollment(enrollmentStatus); | ||
| }; | ||
|
Comment on lines
338
to
345
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π isAndroidCOBO duplicates the semantics of isAutomaticDeviceEnrollment without reusing it, risking drift Changed π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ const EmptyOS = (platform: PlatformValueOptions): JSX.Element => ( | |
| <EmptyState | ||
| className={`${baseClass}__os-empty-table`} | ||
| header={`No${ | ||
| ` ${PLATFORM_DISPLAY_NAMES[platform]}` || "" | ||
| PLATFORM_DISPLAY_NAMES[platform] ? ` ${PLATFORM_DISPLAY_NAMES[platform]}` : "" | ||
| } operating systems detected`} | ||
| info="This report is updated every hour to protect the performance of your | ||
| devices." | ||
|
Comment on lines
19
to
25
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π EmptyOS header text lacks a space before 'operating systems' due to bad template logic Changed the π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,6 +229,7 @@ const WelcomeHost = ({ | |
| if (p.response) { | ||
| return ( | ||
| <Button | ||
| key={p.id} | ||
| variant="unstyled" | ||
| onClick={() => handlePolicyModal(p.id)} | ||
| > | ||
|
Comment on lines
229
to
235
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π WelcomeHost Button missing key prop and onClick handler capturing stale id via closure inside .map without React key Added π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { ITeamConfig } from "interfaces/team"; | |
| import { getErrorReason } from "interfaces/errors"; | ||
|
|
||
| import { LEARN_MORE_ABOUT_BASE_LINK } from "utilities/constants"; | ||
| import { API_NO_TEAM_ID } from "interfaces/team"; | ||
|
|
||
| import diskEncryptionAPI from "services/entities/disk_encryption"; | ||
| import teamsAPI, { ILoadTeamResponse } from "services/entities/teams"; | ||
|
|
@@ -93,7 +94,7 @@ const DiskEncryption = ({ | |
| { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π currentTeamId === 0 misused as sentinel for 'no team' throughout DiskEncryption and Passwords Replaced all three hardcoded π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
| refetchOnWindowFocus: false, | ||
| retry: false, | ||
| enabled: currentTeamId !== 0, | ||
| enabled: currentTeamId !== API_NO_TEAM_ID, | ||
| select: (res) => res.fleet, | ||
| onSuccess: (res) => { | ||
| const enableDiskEncryption = res.mdm?.enable_disk_encryption ?? false; | ||
|
|
@@ -119,7 +120,7 @@ const DiskEncryption = ({ | |
| ); | ||
| onMutation(); | ||
| setShowAggregate(diskEncryptionEnabled); | ||
| if (currentTeamId === 0) { | ||
| if (currentTeamId === API_NO_TEAM_ID) { | ||
| getUpdatedAppConfig(); | ||
| } | ||
| } catch (e) { | ||
|
|
@@ -148,7 +149,7 @@ const DiskEncryption = ({ | |
| } | ||
| }; | ||
|
|
||
| if (currentTeamId === 0 && isLoadingTeam) { | ||
| if (currentTeamId === API_NO_TEAM_ID && isLoadingTeam) { | ||
| setIsLoadingTeam(false); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π Stats.Log() computes error rate with a divide-by-zero risk before any enrollments occur
In Stats.Log() (cmd/osquery-perf/osquery_perf/stats.go), replaced the unconditional
float64(s.errors)/float64(s.osqueryEnrollments)division with a guarded computation: a localerrorRatevariable is declared and only computed as the division whens.osqueryEnrollments > 0, otherwise it stays at its zero value (0.0). Thelog.Printfcall now passeserrorRateinstead of the raw division expression, eliminating the NaN/+Inf output before any enrollments occur.π€ Prompt for AI agents
fix confidence: π’ 97 high β react π/π to teach the reviewer