-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akj32d7 40 review findings across 40 files #169
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
7885a78
643ce27
9de6d67
6b7093c
8204986
47a7977
1dcd43b
c193312
8f0fe5b
b9489b4
fbd958f
30ba620
3d75822
4af6f32
3e24899
2d92f05
8208c70
e53da01
68ab133
bd8417c
9dd0d13
04ba74d
b68403f
1973c42
4b28db0
8476300
c1726e0
fb5e40d
ac2d9da
d634122
e482d5e
8474427
74d34b6
30e71a2
6cd322b
b36579c
da1f4d9
4f7d21b
a09abc3
b3346c9
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 |
|---|---|---|
|
|
@@ -369,14 +369,18 @@ func generateDatabaseFromSQL(dbPath, sqlPath string) error { | |
| if err != nil { | ||
| return fmt.Errorf("creating database: %w", err) | ||
| } | ||
| defer db.Close() | ||
|
|
||
| // Execute the SQL file | ||
| if _, err := db.Exec(string(sqlContent)); err != nil { | ||
| db.Close() // Close the handle before removing the file so cleanup is reliable on all platforms (notably Windows) | ||
| os.Remove(dbPath) // Clean up partial database | ||
| return fmt.Errorf("executing SQL file: %w", err) | ||
| } | ||
|
|
||
| if err := db.Close(); err != nil { | ||
| return fmt.Errorf("closing database: %w", err) | ||
| } | ||
|
|
||
| log.Printf("β Successfully created database from %s", sqlPath) | ||
| return nil | ||
| } | ||
|
Comment on lines
369
to
386
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. 𦩠π generateDatabaseFromSQL does not roll back the file on Exec failure inside a deferred-close db handle, risking partial state under concurrent access In π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,12 +8,18 @@ services: | |
| cluster_network: | ||
| ipv4_address: 172.20.0.30 | ||
| depends_on: | ||
|
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. 𦩠π redis-cluster-setup uses depends_on without health-check condition, allowing cluster-create to race container startup In π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
| - redis-cluster-1 | ||
| - redis-cluster-2 | ||
| - redis-cluster-3 | ||
| - redis-cluster-4 | ||
| - redis-cluster-5 | ||
| - redis-cluster-6 | ||
| redis-cluster-1: | ||
| condition: service_healthy | ||
| redis-cluster-2: | ||
| condition: service_healthy | ||
| redis-cluster-3: | ||
| condition: service_healthy | ||
| redis-cluster-4: | ||
| condition: service_healthy | ||
| redis-cluster-5: | ||
| condition: service_healthy | ||
| redis-cluster-6: | ||
| condition: service_healthy | ||
|
|
||
| redis-cluster-1: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -25,6 +31,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.31 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7001", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| redis-cluster-2: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -36,6 +47,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.32 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7002", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| redis-cluster-3: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -47,6 +63,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.33 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7003", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| redis-cluster-4: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -58,6 +79,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.34 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7004", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| redis-cluster-5: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -69,6 +95,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.35 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7005", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| redis-cluster-6: | ||
| image: ${FLEET_REDIS_IMAGE:-redis:6.2} | ||
|
|
@@ -80,6 +111,11 @@ services: | |
| networks: | ||
| cluster_network: | ||
| ipv4_address: 172.20.0.36 | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-p", "7006", "ping"] | ||
| interval: 2s | ||
| timeout: 2s | ||
| retries: 15 | ||
|
|
||
| networks: | ||
| cluster_network: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| #!/bin/bash | ||
|
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 5.11 pass script writes root-owned sudoers policy without validating syntax before install In CIS_5.11_pass.sh, replaced the direct π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| # CIS 5.11 - Ensure Logging Is Enabled for Sudo | ||
| # Adds Defaults log_allowed to a sudoers.d file. | ||
| echo 'Defaults log_allowed' | /usr/bin/sudo /usr/bin/tee /etc/sudoers.d/CIS_5_11_sudoconfiguration > /dev/null | ||
| TMPFILE=$(/usr/bin/mktemp) | ||
| echo 'Defaults log_allowed' > "$TMPFILE" | ||
| if ! /usr/bin/sudo /usr/sbin/visudo -c -f "$TMPFILE" > /dev/null; then | ||
| echo "Error: sudoers syntax validation failed for CIS_5_11_sudoconfiguration" >&2 | ||
| /bin/rm -f "$TMPFILE" | ||
| exit 1 | ||
| fi | ||
| /usr/bin/sudo /bin/cp "$TMPFILE" /etc/sudoers.d/CIS_5_11_sudoconfiguration | ||
| /bin/rm -f "$TMPFILE" | ||
| /usr/bin/sudo /bin/chmod 0440 /etc/sudoers.d/CIS_5_11_sudoconfiguration | ||
| if ! /usr/bin/sudo /usr/sbin/visudo -c -f /etc/sudoers.d/CIS_5_11_sudoconfiguration > /dev/null; then | ||
| echo "Error: installed sudoers file failed validation, removing" >&2 | ||
| /usr/bin/sudo /bin/rm -f /etc/sudoers.d/CIS_5_11_sudoconfiguration | ||
| exit 1 | ||
| fi | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,10 @@ const enroll = async () => { | |
| enroll_secret: FLEET_ENROLL_SECRET, | ||
| }); | ||
|
|
||
| if (!enroll_secret) { | ||
| throw new Error("enroll_secret is empty, refusing to enroll"); | ||
| } | ||
|
|
||
| let host_identifier = host_details.system_info.hardware_serial; | ||
| if (!host_identifier) { | ||
| host_identifier = host_details.system_info.uuid; | ||
|
Comment on lines
104
to
113
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. 𦩠π Chrome extension enroll secret and node key handling has no reenroll loop guard beyond a single retry flag but node_key returned empty check happens after request completes without validating enroll_secret is non-empty In π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -297,3 +301,4 @@ chrome.alarms.onAlarm.addListener(async ({ name }) => { | |
| console.error(`unknown alarm ${name}`); | ||
| } | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,11 @@ export default class TableSystemInfo extends Table { | |
| getComputerName(hostname: string, hwSerial: string): string { | ||
|
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. 𦩠π getComputerName truthy-length checks silently misbehave for whitespace-only strings In π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| const prefix = "Chromebook"; | ||
|
|
||
| if (!!hostname?.length) { | ||
| if (!!hostname?.trim().length) { | ||
| return hostname; | ||
| } | ||
|
|
||
| if (!!hwSerial?.length) { | ||
| if (!!hwSerial?.trim().length) { | ||
| return `${prefix} ${hwSerial}`; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,12 @@ export const getWhen = (summary: IScriptBatchSummaryV2) => { | |
| } | ||
| return ( | ||
| <> | ||
| <Icon name="pending-outline" color="ui-fleet-black-50" size="small" /> | ||
| Started{" "} | ||
| <Icon | ||
| name={canceled ? "close-filled" : "pending-outline"} | ||
| color="ui-fleet-black-50" | ||
| size="small" | ||
| /> | ||
| {canceled ? "Canceled" : "Started"}{" "} | ||
| <HumanTimeDiffWithFleetLaunchCutoff | ||
| timeString={started_at} | ||
| tooltipPosition="right" | ||
|
Comment on lines
34
to
45
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. 𦩠π getWhen 'started' case ignores In π€ Prompt for AI agentsfix confidence: π‘ 70 medium β react π/π to teach the reviewer |
||
|
|
@@ -84,3 +88,4 @@ export const getWhen = (summary: IScriptBatchSummaryV2) => { | |
| return null; | ||
| } | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,8 +154,8 @@ describe("Custom variables", () => { | |
| ); | ||
| const deleteVariableHandler = http.delete( | ||
|
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. 𦩠π deleteVariableHandler parses id via string.split('/').pop() which is fragile against query strings In the π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| baseUrl("/custom_variables/:id"), | ||
| async ({ request }) => { | ||
| const id = request.url.split("/").pop(); | ||
| async ({ params }) => { | ||
| const id = params.id as string; | ||
| if (!id) { | ||
| throw new Error("Variable ID not found in request URL"); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| #!/bin/bash | ||
|
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. 𦩠π MySQL CA certificate retrieval script has no verification of downloaded bundle integrity Added π€ Prompt for AI agentsfix confidence: π‘ 80 medium β react π/π to teach the reviewer |
||
| set -euo pipefail | ||
| apk add coreutils openssl | ||
|
|
||
| wget --quiet https://truststore.pki.rds.amazonaws.com/${aws_region}/${aws_region}-bundle.pem -O ${aws_region}-bundle.dl.pem | ||
| wget --quiet --fail https://truststore.pki.rds.amazonaws.com/${aws_region}/${aws_region}-bundle.pem -O ${aws_region}-bundle.dl.pem | ||
| csplit -z -k -f cert. -b '%02d.pem' ${aws_region}-bundle.dl.pem '/-----BEGIN CERTIFICATE-----/' '{*}' | ||
|
|
||
| for filename in cert.*; | ||
|
|
@@ -12,3 +13,4 @@ do | |
| mv $${filename} ${container_path}/${aws_region}.pem | ||
| fi | ||
| done | ||
|
|
||
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.
𦩠π Growing list of per-app special-cases hardcoded inside appExists violates single-responsibility and will keep growing unbounded
Extracted the five hardcoded bundle-identifier special cases (OneDrive, GPG Suite, Adobe DNG Converter, Ableton Live, WhatsApp, Logi Tune) out of the inline
if uniqueAppIdentifier == "..."chain insideappExists's main loop into a newappVersionMatcherfunction type and anappVersionMatchersmap (keyed by bundle identifier) defined at package scope.appExistsnow looks upappVersionMatchers[uniqueAppIdentifier]once before the loop and, per result, calls the matcher (if any) before falling back to the sharedcheckVersionMatch. The localAppResultstruct was hoisted out ofappExiststo package scope so the matcher function signature could reference it. Each quirk is now a self-contained, independently referenceable/testable closure in the map rather than inlined control flow; behavior and log messages are preserved exactly. Risk: since matchers are unexported closures in a map, they can't be unit-tested individually from outside the package without also exporting the map or adding a test in this package β a complete resolution of the "independently testable" goal would additionally add table-driven tests againstappVersionMatchers, which is out of scope for this single-file fix.π€ Prompt for AI agents
fix confidence: π‘ 75 medium β react π/π to teach the reviewer