fix(adhoc-sweep-fixes): 81 review findings across 40 files - #119
fix(adhoc-sweep-fixes): 81 review findings across 40 files#119flamingo[bot] wants to merge 40 commits into
Conversation
🦩 What this fix changed, finding by finding81 finding(s) fixed in this draft. (Inline placement was rejected by GitHub for this PR.) 🔴 1. fmt.Errorf format string misuses %q with an already-formatted error message, producing malformed output — (Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.) 🤖 Prompt for AI agentsfix confidence: 🔴 40 low — review closely — react 👍/👎 to teach the reviewer 🟠 2. File handle from os.OpenFile not closed before writing in HasCN's revocation path — (Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.) 🤖 Prompt for AI agentsfix confidence: 🔴 40 low — review closely — react 👍/👎 to teach the reviewer 🟠 3. Unsupported public key type panics instead of returning an error — 🤖 Prompt for AI agentsfix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer 🟠 4. index.txt not truncated before rewrite, risking stale trailing data after revocation — (Automatically downgraded: no change in this fix lands near this finding's line — verify whether it was actually addressed.) 🤖 Prompt for AI agentsfix confidence: 🔴 40 low — review closely — react 👍/👎 to teach the reviewer 🔴 5. Test file uses non-existent 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 6. Invalid 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 7. Invalid 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🔴 8. Hardcoded BitLocker recovery password committed to source in tools/mdm/windows/bitlocker/core.go — 🤖 Prompt for AI agentsfix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer 🟠 9. BitLocker CLI wraps errors with fmt.Errorf but discards Go %w chain (uses %v) — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🟠 10. All fmt.Errorf calls in tools/mdm/windows/bitlocker/core.go use %v not %w — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 11. Test calls new(...) as a function on strings, which does not compile in Go — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 12. Duplicate invalid new(...) call in second IDP username test — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 13. tools/screencap/main.go has orphaned/duplicated code causing a compile error — 🤖 Prompt for AI agentsfix confidence: 🟡 80 medium — react 👍/👎 to teach the reviewer 🔴 14. ctx from chromedp.NewContext is declared but never used, cancel is unused too — 🤖 Prompt for AI agentsfix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer 🔴 15. Invalid Go syntax: 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 16. Invalid Go syntax: 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 17. SQL injection via unsanitized device fields interpolated into raw SQL dump — 🤖 Prompt for AI agentsfix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer 🟠 18. x509.ParseCertificate error is logged but execution continues with a nil cert dereferenced — 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🔴 19. Misleading dead-code comment masks that TLS verification is never actually disabled for DisableSSL testing path — 🤖 Prompt for AI agentsfix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer 🔴 20. New GCS/OpenFrame-specific S3 logic lacks OPENFRAME sentinel comments — 🤖 Prompt for AI agentsfix confidence: 🟡 65 medium — react 👍/👎 to teach the reviewer 🔴 21. CertificateFromPEM will panic on nil block from malformed PEM input — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🟠 22. RSAKeyFromPEM and CertificateFromPEM dereference block without nil-check, and errors aren't wrapped — 🤖 Prompt for AI agentsfix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer 🔴 23. Advanced.tsx sends server_settings.live_reporting_disabled but form state is disableLiveQuery — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 24. Advanced.tsx sends discard_reports_data instead of query_reports_disabled — 🤖 Prompt for AI agentsfix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer 🔴 25. Eval() assumes fixedVersionWithEpochPrefix always contains a ':' separator, will panic on malformed/epoch-less version strings — 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🟠 26. Misspelled exported method name 🤖 Prompt for AI agentsfix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer 🔴 27. update-one-devices-compliance-status.js returns 🤖 Prompt for AI agentsfix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer 🔴 28. getInformationAboutThisUser error path returns Error object instead of throwing, same anti-pattern repeated — 🤖 Prompt for AI agentsfix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer 🔴 29. Non-existent builtin 🤖 Prompt for AI agentsfix confidence: 🟢 97 high — react 👍/👎 to teach the reviewer 🔴 30. Non-existent builtin 🤖 Prompt for AI agentsfix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer 🔴 31. Hardcoded live Fleet API token committed to repo in test script default — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 32. Mixed tabs/spaces indentation in tuf deployment.yaml template breaks Helm rendering — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 33. HasChallenge begins a transaction but never rolls back or commits on early error paths — 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🔴 34. Typo 'TEST' instead of 'TEXT' in cpe_2 table schema for sw_edition column — 🤖 Prompt for AI agentsfix confidence: 🟢 98 high — react 👍/👎 to teach the reviewer 🔴 35. MySQL credentials hardcoded/ignored in setupDS regardless of CLI flags — 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 36. jira.go doWithRetry dereferences resp.StatusCode without checking for a nil response — 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🔴 37. Shared loop variable 🤖 Prompt for AI agentsfix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer 🔴 38. get-one-compliance-status-result.js throws/returns raw Error objects instead of using Sails exit conventions — 🤖 Prompt for AI agentsfix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer 🔴 39. validateWindowLength returns true (valid) for invalid/too-short windows unless end < start — 🤖 Prompt for AI agentsfix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer 🔴 40. StorePushCert UPDATE clause references wrong table name 🤖 Prompt for AI agents |
Closes 81 review findings across 40 files.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
server/mdm/scep/depot/file/depot.go:205server/mdm/scep/depot/file/depot.go:202server/mdm/scep/depot/file/depot.go:280server/mdm/scep/depot/file/depot.go:202new(...)builtin as a value constructor for string/enum typesee/server/service/teams_test.go:396new("abc")call passed as team name payloadee/server/service/teams_test.go:399new(fleet.RoleAdmin)/new("abc")/new("DEF")calls repeated in ModifyTeam collation testee/server/service/teams_test.go:452tools/mdm/windows/bitlocker/core.go:82tools/mdm/windows/bitlocker/core.go:12tools/mdm/windows/bitlocker/core.go:42server/mdm/profiles/android_appconfig_test.go:109server/mdm/profiles/android_appconfig_test.go:124tools/screencap/main.go:168tools/screencap/main.go:180new(uint(7))used as expression in testee/server/service/categories_test.go:20new(uint(7))reused in second subtestee/server/service/categories_test.go:34tools/mdm/migration/micromdm/touchless/main.go:213tools/mdm/migration/micromdm/touchless/main.go:193server/datastore/s3/s3.go:103server/datastore/s3/s3.go:62server/mdm/nanodep/tokenpki/cert.go:60server/mdm/nanodep/tokenpki/cert.go:51frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx:168frontend/pages/admin/OrgSettingsPage/cards/Advanced/Advanced.tsx:168server/vulnerabilities/goval_dictionary/database.go:61Verfiyshould beVerifyserver/vulnerabilities/goval_dictionary/database.go:20new Error(...)instead of throwing it, defeating exits/intercept contractwebsite/api/controllers/microsoft-proxy/update-one-devices-compliance-status.js:71website/api/controllers/microsoft-proxy/update-one-devices-compliance-status.js:142new()used instead ofptr.String/&in mdm_test.goee/server/service/mdm_test.go:291new()used instead of pointer helper in hosts_openframe_test.goserver/fleet/hosts_openframe_test.go:16openframe/scripts/test_host_assignments.sh:14charts/tuf/templates/deployment.yaml:21server/mdm/scep/challenge/bolt/challenge.go:56server/vulnerabilities/nvd/db.go:44tools/mdm/assets/main.go:79server/service/externalsvc/jira.go:108errcaptured by reference across concurrent goroutines in depsyncer main.goserver/mdm/nanodep/cmd/depsyncer/main.go:178website/api/controllers/microsoft-proxy/get-one-compliance-status-result.js:32frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditAutoUpdateConfigModal/helpers.tsx:47push_certsinstead ofnano_push_certsserver/mdm/nanomdm/storage/mysql/pushcert.go:43server/datastore/mysql/users.go:302frontend/pages/SoftwarePage/SoftwareAddPage/helpers.tsx:18frontend/utilities/campaign_helpers/index.ts:147server/datastore/cached_mysql/cached_mysql.go:222tools/custom-package-parser/main.go:100tools/custom-package-parser/main.go:88tools/custom-package-parser/main.go:93tools/custom-package-parser/main.go:105tools/custom-package-parser/main.go:108tools/custom-package-parser/main.go:114tools/custom-package-parser/main.go:106tools/snapshot/snapshot.go:152tools/snapshot/snapshot.go:234tools/snapshot/snapshot.go:46tools/snapshot/snapshot.go:100tools/github-manage/pkg/ghapi/issues.go:253tools/github-manage/pkg/ghapi/issues.go:150tools/github-manage/pkg/ghapi/issues.go:158tools/github-manage/pkg/ghapi/issues.go:181emailcheckee/server/calendar/load_test/calendar_http_handler.go:172ee/server/calendar/load_test/calendar_http_handler.go:253ee/server/calendar/load_test/calendar_http_handler.go:44server/mdm/nanomdm/service/dump/dump.go:84server/mdm/nanomdm/service/dump/dump.go:93server/mdm/nanomdm/service/dump/dump.go:1cmd/fleetctl/fleetctl/user.go:271cmd/fleetctl/fleetctl/user.go:279cmd/fleetctl/fleetctl/user.go:259server/goose/migration_sql.go:132server/goose/migration_sql.go:127return errdead codeserver/goose/migration_sql.go:141PROCESSED_PACKAGEDnever updates the reportedPROCESSED_PACKAGEScounter correctlytools/gitops-migrate/migrate.sh:190tools/gitops-migrate/migrate.sh:78ee/server/service/in_house_apps.go:296ee/server/service/in_house_apps.go:118frontend/components/side_panels/QuerySidePanel/QueryTableColumns/ColumnListItem/ColumnListItem.tsx:43frontend/components/side_panels/QuerySidePanel/QueryTableColumns/ColumnListItem/ColumnListItem.tsx:44server/mdm/nanomdm/http/api/api.go:220server/mdm/nanomdm/http/api/api.go:234website/api/helpers/strings/to-html-email.js:88website/api/helpers/strings/to-html-email.js:105What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
f6d23861-693f-45a1-b5b3-570aa3bc9ea7Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.