Commit Graph

152 Commits

Author SHA1 Message Date
Ales Raszka
f326b6f664 Use PotentialNamespace in ancestry
If PotentialNamespace is available for given feature it is used instead
of detector namespace. Detector is empty in such a case.
2019-03-14 17:29:41 +01:00
Sida Chen
2d1ac2c4d5 update 2019-03-12 22:23:30 -04:00
Sida Chen
0731df972c pgsql: Remove unused test code
- Tests in complex_test.go are now in corresponding test files.
- Pgsql_test is partially moved to testutil/testdb.go
2019-03-12 22:23:30 -04:00
Sida Chen
dfa07f6d86 pgsql: Move notification to its module 2019-03-12 22:23:30 -04:00
Sida Chen
921acb26fe pgsql: Split vulnerability.go to files in vulnerability module 2019-03-12 22:23:30 -04:00
Sida Chen
7cc83ccbc5 pgsql: Split ancestry.go to files in ancestry module 2019-03-12 22:23:30 -04:00
Sida Chen
497b79a293 pgsql: Add test for migrations 2019-03-12 22:23:30 -04:00
Sida Chen
ea418cffd4 pgsql: Split layer.go to files in layer module 2019-03-12 22:23:30 -04:00
Sida Chen
176c69e59d pgsql: Move namespace to its module 2019-03-12 22:23:30 -04:00
Sida Chen
98e81ff5f1 pgsql: Move keyvalue to keyvalue module 2019-03-12 22:23:30 -04:00
Sida Chen
ba50d7c626 pgsql: Move lock to lock module 2019-03-12 22:23:30 -04:00
Sida Chen
0b32b36cf7 pgsql: Move detector to pgsql/detector module 2019-03-12 22:23:30 -04:00
Sida Chen
c50a2339b7 pgsql: Split feature.go to table based files in feature module 2019-03-12 22:23:30 -04:00
Sida Chen
43f3ea87d8 pgsql: Move batch queries to corresponding modules 2019-03-12 22:23:30 -04:00
Sida Chen
a33050637b pgsql: Move extra logic in pgsql.go to util folder
- pgsql/util/error.go contains error handling logic
- pgsql/page/page.go contains the page struct
- pgsql/monitoring contains the prometheus logic
- pgsql/pgsession contains the pgsession struct
2019-03-12 22:23:30 -04:00
Sida Chen
8bebea3643 pgsql: Split testutil.go into multiple files
- assertion.go assertions used in pgsql tests
- data.go contains go representation of data.sql
- testdb.go contains test db/tx creation logic
- testutil.go contains misc other things
2019-03-12 22:23:30 -04:00
Ales Raszka
d77dc0f0ae Use struct as a map key instead of string
String was used when Feature contains PotentialNamespace. Since it was
moved to LayerFeature we can use struct as map key instead of string.
2019-03-08 09:51:40 +01:00
Ales Raszka
a8a91379d9 Add test for potential namespace
Test verifies that potential namespace is stored in database and it can
be loaded back to structure.

The commit also fixes few typos and bugs.
2019-03-08 09:51:19 +01:00
Ales Raszka
60b0bd27fa Add namespace_id as constraints to layer_feature
If layer contains more than one potential namespace, features will be
created for each namespace. Layer_feature table now has to contains one
more constrains (namespace_id).
2019-03-07 11:22:54 +01:00
Ales Raszka
60ef726677 Move PotentialNamespace to LayerFeature
PotentialNamespace should be in LayerFeature instead of Feature struct.
Feature extractors were updated to return LayerFeature instead of
Feature.
2019-03-07 11:22:54 +01:00
Ales Raszka
44c4a6f3ce Store PotentialNamespace in database
PotentialNamespace is part of layer_feature table and it is also stored
in namespace table.
2019-03-07 11:22:32 +01:00
Ales Raszka
34c2d96b36 featurefmt: Extract PotentialNamespace
PotentialNamespace is feature namespace extracted while detecting
features in layer. It will server for special feature detector. The
current detectors return empty namespace.
2019-03-07 11:22:32 +01:00
Sida Chen
b03f1bc3a6 pgsql: Fix failed tests 2019-03-06 13:44:23 -05:00
Sida Chen
ed9c6baf4f pgsql: Fix pgsql test 2019-03-06 11:32:25 -05:00
Sida Chen
046b0e49d1 Add missing licenses 2019-03-05 11:42:59 -05:00
Jimmy Zelinskie
4fa03d1c78
Merge pull request #723 from jzelinskie/lock-tx
database: make locks SOI & add Extend method
2019-02-28 15:59:58 -05:00
Jimmy Zelinskie
961c7d4680 database: add test for lock expiration 2019-02-28 15:54:57 -05:00
Jimmy Zelinskie
a4e7873d14 database: make locks SOI & add Extend method 2019-02-28 15:46:31 -05:00
Sida Chen
f7e54c1a28
Merge pull request #695 from saromanov/fix-unchecked-error
pgsql: fix unchecked error
2019-02-27 13:05:52 -05:00
Sida Chen
5bf8365f7b pgsql: Prevent inserting invalid entry to database 2019-02-26 10:26:49 -05:00
Sida Chen
8aae73f1c8 pgsql: Remove unnecessary logs 2019-02-26 10:26:49 -05:00
Sida Chen
73bc2bc36b
Merge pull request #672 from KeyboardNerd/source_package/feature_type
Implement Feature types
2019-02-20 15:58:50 -05:00
Sida Chen
5a94499fdb update according to comments 2019-02-19 17:57:38 -05:00
Sida Chen
79af05e67d pgsql: Fix postgres queries for feature_type 2019-02-19 16:48:42 -05:00
Sida Chen
073c685c5b pgsql: Add proper tests for database migration 2019-02-19 16:48:42 -05:00
Sida Chen
00eed77b45 database: Add feature_type database model 2019-02-19 16:48:42 -05:00
Sida Chen
c6c8fce39a pgsql: Add feature_type to initial schema
feature_type is for differentiating the binary packages and source
packages.
2019-02-19 16:43:35 -05:00
Jimmy Zelinskie
cafe0976a4
Merge pull request #685 from jzelinskie/updater-cleanup
updater: remove FindLock(), use errgroup to avoid races
2019-02-14 14:57:59 -05:00
Sergey
a57d806717
pgsql: fix unchecked error 2019-01-21 17:57:52 +05:00
Ales Raszka
015a79fd5a Layer: replace arrays with slices
The current code is much cleaner because it doesn't use indexes + it
should be more memory efficient.
2019-01-16 09:12:34 +01:00
Ales Raszka
90f5592095 Feature: replace arrays with slices
The current code is much cleaner because it doesn't use indexes + it
should be more memory efficient.
2019-01-16 09:12:33 +01:00
Jimmy Zelinskie
399deab100 database: remove FindLock() 2019-01-10 13:50:46 -05:00
Sida Chen
f759dd54c0 database: Replace Parent Feature with source metadata
Feature's source feature string is directly stored in the database
instead of having the parent pointer to simplify the database.
2018-10-15 16:26:24 -04:00
Sida Chen
3fe894c5ad database: Add parent feature pointer to Feature struct
Feature now has a pointer to parent feature. If a vulnerability affects
a parent feature, this child feature will be affected.
2018-10-09 19:52:10 -04:00
Sida Chen
e657d26313 database: move dbutil and testutil to database from pkg
Move dbutil and testutil to database from pkg
Rename all "result"
2018-10-08 12:10:35 -04:00
Sida Chen
0c1b80b2ed pgsql: Implement database queries for detector relationship
* Refactor layer and ancestry
* Add tests
* Fix bugs introduced when the queries were moved
2018-10-08 11:27:15 -04:00
Sida Chen
9c49d9dc55 pgsql: Move queries to corresponding files
Aggregate queries in their corresponding files instead of having the
single file for every queries because the database is more complicated.
2018-10-08 10:42:40 -04:00
Sida Chen
dca2d4e597 pgsql: Add detector to database schema
'detector' table is added to store the metadata of detectors.
'layer_feature', 'layer_namespace', and 'ancestry_feature' tables are
modified to store the detection relationship between the
feature/namespace with the detector.
2018-10-08 10:42:40 -04:00
Sida Chen
53433090a3 pgsql: update the query format 2018-09-19 14:33:08 -04:00
Sida Chen
e160616723 database: Use LayerWithContent as Layer 2018-09-13 13:21:39 -04:00