fleetdm / fleet

Open device management
https://fleetdm.com
Other
5.22k stars 611 forks source link

Avoid unnecessary prepared statements in "select config from team" uncached queries #30206

Closed iansltx closed 2 weeks ago

iansltx commented 2 weeks ago

For #30199. This is one of a few approaches to mitigate the issue the customer is seeing.

This is SQLi-safe because we're dealing with an unsigned int parameter, sprintf'd %d. Existing tests fully cover this path.

Checklist for submitter

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 62.13%. Comparing base (36bf6d9) to head (46aff33). Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
server/datastore/mysql/teams.go 50.00% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #30206 +/- ## ========================================== - Coverage 64.14% 62.13% -2.02% ========================================== Files 1867 1866 -1 Lines 182671 182678 +7 Branches 5334 5334 ========================================== - Hits 117175 113502 -3673 - Misses 56283 60084 +3801 + Partials 9213 9092 -121 ``` | [Flag](https://app.codecov.io/gh/fleetdm/fleet/pull/30206/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fleetdm) | Coverage Δ | | |---|---|---| | [backend](https://app.codecov.io/gh/fleetdm/fleet/pull/30206/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fleetdm) | `62.87% <50.00%> (-2.23%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fleetdm#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow: - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.