Skip to content

Return 0 count for team vulnerability#16897

Merged
getvictor merged 26 commits into
15919-vulnerabilities-pagefrom
16891-api-empty-states
Feb 20, 2024
Merged

Return 0 count for team vulnerability#16897
getvictor merged 26 commits into
15919-vulnerabilities-pagefrom
16891-api-empty-states

Conversation

@mostlikelee
Copy link
Copy Markdown
Contributor

#16891

  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated tests
  • Manual QA for all new/changed functionality

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 15, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (15919-vulnerabilities-page@35ca4ee). Click here to learn what that means.

Files Patch % Lines
server/datastore/mysql/vulnerabilities.go 88.67% 3 Missing and 3 partials ⚠️
server/service/vulnerabilities.go 57.14% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##             15919-vulnerabilities-page   #16897   +/-   ##
=============================================================
  Coverage                              ?   66.11%           
=============================================================
  Files                                 ?     1148           
  Lines                                 ?   101987           
  Branches                              ?     2525           
=============================================================
  Hits                                  ?    67427           
  Misses                                ?    29559           
  Partials                              ?     5001           
Flag Coverage Δ
backend 67.22% <85.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mostlikelee mostlikelee force-pushed the 16891-api-empty-states branch from 59aa66d to cab01a2 Compare February 17, 2024 20:42
@mostlikelee mostlikelee changed the base branch from 15919-vulnerabilities-page to victor/15919-team-filter February 17, 2024 20:42
LEFT JOIN vulnerability_host_counts vhc ON cm.cve = vhc.cve
`

freeSelectStmt := `
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating this statement because the cve_meta table is not populated on Fleet free

@mostlikelee mostlikelee changed the base branch from victor/15919-team-filter to 15919-vulnerabilities-page February 17, 2024 20:58
@mostlikelee mostlikelee marked this pull request as draft February 17, 2024 20:59
@getvictor getvictor marked this pull request as ready for review February 20, 2024 15:44
Copy link
Copy Markdown
Member

@getvictor getvictor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

osvs, err := ds.OSVersions(ctx, teamID, nil, nil, nil)
if err != nil {
return nil, updatedAt, ctxerr.Wrap(ctx, err, "fetching OS versions by CVE")
if err != nil && !fleet.IsNotFound(err) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if teamID == null, you should exit with error here

@getvictor getvictor merged commit 8cb6722 into 15919-vulnerabilities-page Feb 20, 2024
@getvictor getvictor deleted the 16891-api-empty-states branch February 20, 2024 15:49
getvictor added a commit that referenced this pull request Feb 20, 2024
#16906 

**IN DRAFT, WAITING ON #16897

- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: Victor Lyuboslavsky <victor@fleetdm.com>
Co-authored-by: Victor Lyuboslavsky <victor.lyuboslavsky@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants