z-arnott / Vega

0 stars 0 forks source link

Storage facade Iteration 2 #24

Closed z-arnott closed 1 year ago

z-arnott commented 1 year ago

Overview

Builds on PR #19 closes #21

Once this PR is merged the Parser and Risk Analysis components can be integrated with the storage facade

Provides API to:

  1. read packages by session id
  2. read package by sbom reference string
  3. write package
    • (takes Package object from types.utils)
    • updates entry in database if present, inserts otherwise
  4. read vulnerabilities by session id
  5. read vulnerabilities by package
  6. write vulnerability
    • (takes Vulnerability object from types.utils)
    • updates entry in database if present, inserts otherwise

This iteration does not provide:

  1. Block writes
  2. read a single vulnerability by any vulnerability attribute
  3. method to purge database by session

Other fixes are bundled in:

  1. remove duplicate package and vulnerability types
  2. change packageid to string (match sbom id provided by user input)
  3. switch any type definitions that include undefined to include null instead
    • justification: https://basarat.gitbook.io/typescript/recap/null-undefined JavaScript (and by extension TypeScript) has two bottom types : null and undefined. They are intended to mean different things: Something hasn't been initialized : undefined. Something is currently unavailable: null.
  4. fix syntax errors in package-lock.json (missing brackets and commas)
z-arnott commented 1 year ago

note: error handling was tested with manual tests (changing supabase query within the funcitons) and is not included in the automated test coverage

z-arnott commented 1 year ago

updated with bug fixes in read/write vulnerability functions updated test cleanup (purging junction by session id) @rhass-uta