Commit Graph

123 Commits

Author SHA1 Message Date
Sida Chen
48427e9b88 api: Add detectors for RPC
Change the V3 implementation to accommondate the detectors.
2018-10-08 10:42:40 -04:00
Sida Chen
9f5d1ea4e1 v3: associate feature and namespace with detector 2018-10-01 11:04:08 -04:00
Sida Chen
f98ff58afd
Merge pull request #619 from KeyboardNerd/sidac/rm_layer
database: Remove LayerWithContent from interface
2018-09-13 14:36:26 -04:00
Sida Chen
e160616723 database: Use LayerWithContent as Layer 2018-09-13 13:21:39 -04:00
Jimmy Zelinskie
089a4e0f0a
Merge pull request #617 from jzelinskie/grpc-refactor
Introduce pkg/grpcutil
2018-09-11 14:57:13 -04:00
Jimmy Zelinskie
1ec2759550 pkg/grpcutil: init
This change refactors gRPC code used within the v3 API package into
generic code that can be used for managing gRPC and gRPC Gateway.
2018-09-11 14:46:52 -04:00
Sida Chen
6c69377343
Merge pull request #614 from KeyboardNerd/sidac/simplify
Replace Ancestry with AncestryWithContent struct in database models
2018-09-11 10:50:53 -04:00
Jimmy Zelinskie
dc6be5d1b0 api: remove handleShutdown func
This function was used for handling errors in the graceful library and
was never necessary for the v3 API.
2018-09-10 13:26:53 -04:00
Sida Chen
5d725e67b0 Replace Ancestry with AncestryWithContent struct in database models
As one of the steps to simplifies the codebase, the AncestryWithContent
struct is renamed to Ancestry, and Ancestry is removed. It will cause
the PostAncestry request to be slower.
2018-09-10 12:48:23 -04:00
Jimmy Zelinskie
0565938956 pkg/pagination: add token type
This change pulls as much pagination logic out of the database
implementation as possible. Database implementations should now be able
to marshal whatever state they need into opaque tokens with the
utilities in the pagination package.
2018-09-07 16:26:56 -04:00
Jimmy Zelinskie
30644fcc01 api: remove dependency on graceful
This library has no longer been needed since Go 1.8.
2018-09-06 16:56:33 -04:00
Sida Chen
2bbbad393b
Merge pull request #605 from KeyboardNerd/sidchen/feature
Implement Ancestry Layer-wise feature API
2018-09-06 14:08:56 -04:00
Sida Chen
2827b9342b Update Database and Worker implementation for layer-wise feature
Feature extraction algorithm is changed to associate features with
ancestry layer. Database is updated to keep the relationship.
2018-09-06 13:56:03 -04:00
Jean Michel MacKay
9df4f5bd70 Adding httputil and version packages
- Debian/RHEL/Oracle vulnsrc now use httputil to download files
- httputil sets the User-Agent to the requests as Clair/<version> (https://github.com/coreos/clair/)
- httputil holds Status2xx() which returns if the response is a http success (2xx)
- GetClientAddr moved from api/httputil to pkg/httputil
- the version packge holds a Version string which is set at build time from the git tag and sha
- the .git directory was removed from .dockerignore so that we can use the git tag to set the version
2018-09-05 14:56:39 -04:00
Sida Chen
4b64151330 Update gRPC server implementation 2018-09-05 11:34:06 -04:00
Sida Chen
6a44052e31 Update Clair V3 API to provide layer-wise feature 2018-09-05 11:33:27 -04:00
Sida Chen
d28f3214ce Add Status endpoint with Clair configuration
Implement a status endpoint providing the current lister/detector in
the current instance of Clair.
2018-08-30 16:55:18 -04:00
Jimmy Zelinskie
f550dd16a0 api/v3: remove dependency on google empty message 2018-04-23 15:49:34 -04:00
Jimmy Zelinskie
d7a751e0d4 api/v3: prototool format 2018-04-23 15:32:03 -04:00
Jimmy Zelinskie
6b9f668ea0 api/v3/clairpb: document and regenerate protos 2018-04-10 14:47:57 -04:00
Jimmy Zelinskie
a5b3e747a0
Merge pull request #538 from jzelinskie/dockerize-protogen
generate protobufs in docker
2018-04-04 16:55:50 -04:00
Jimmy Zelinskie
ec5014f8a1 api/v3/clairpb: regen protobufs 2018-04-04 16:17:49 -04:00
Jimmy Zelinskie
389b6e9927 api/v3/clairpb: generate protobufs in docker
This removes the requirement of the build machine having protobuf and
any extensions installed.
2018-04-04 16:16:50 -04:00
Sida Chen
a75b8ac7ff api,database: updated version_format documentation.
Version format documentation is updated in the example of feature
struct and created in clair.proto along with accordingly generated
swagger and protobuf files.

Fixes #514
2018-02-02 00:59:11 -05:00
Jimmy Zelinskie
4491bedf2e database/pgsql: move token lib 2017-08-21 16:25:13 -04:00
Sida Chen
0151dbaef8 API: change api port to api addr, rename RunV2 to Run.
Fixes #446
2017-08-18 18:24:34 -04:00
Sida Chen
58022d97e3 api: renamed V2 API to V3 API for consistency. 2017-08-16 17:26:53 -04:00
Sida Chen
a378cb070c API: drop v1 api, changed v2 api for Clair v3. 2017-08-10 11:19:08 -04:00
Jimmy Zelinskie
6c9a131b09 Merge pull request #408 from KeyboardNerd/grpc
v2 api with gRPC and gRPC gateway
2017-06-30 17:33:57 -04:00
Sida Chen
c6f0eaa3c8 api: fix remote addr shows reverse proxy addr problem
Uses the first ip addr in X-forwarded-for as the client's remote addr if it exists
otherwise, fall back to use default http.Request.RemoteAddr
2017-06-16 10:08:58 -04:00
Sida Chen
a4edf38566 api: v2 api with gRPC and gRPC-gateway
Newly designed API defines Ancestry as a set of layers
and shrinked the api to only the most used apis:
post ancestry, get layer, get notification, delete notification

Fixes #98
2017-06-13 15:58:10 -04:00
Sida Chen
bffa6499b7 added support for detect multiple namespaces in a layer
created table layer_namespace to store the many to many unique mapping of layers and namespaces
changed v1 api to provide a list of namespaces for each layer
changed namespace detector to use all registered detectors to detect namespaces
updated tests for multiple namespaces

Fixes #150
2017-05-24 17:01:51 -04:00
Sida Chen
9306e99368 converted to structured logging by using logrus
changed from capnslog to logrus for logging JSON structured message.

finished issue #383
2017-05-04 13:59:57 -04:00
Kevin Burke
6a50bbb8b8
api: fix 404 error logging
The first value is an integer and the second value is a string and the
format string has these backwards, leading to %!s(int=404) appearing
in the logs instead of "404".
2017-04-03 16:08:18 -07:00
Jimmy Zelinskie
6a569fd945 move config to main / decentralize config
This puts config in its relevant location and moves functions around
loading config files into the main package.

As a side effect of removing cyclic imports for the API config, the
context library is no longer used.
2017-01-27 00:36:13 -05:00
Jimmy Zelinskie
889615276a clair: move worker to top level package 2017-01-26 18:24:04 -05:00
Jimmy Zelinskie
9c63a63944 clair: mv updater clair and mv severity to db 2017-01-22 23:20:56 -05:00
Jimmy Zelinskie
00e4f70972 pkg/stopper: init from utils.Stopper 2017-01-22 23:02:51 -05:00
Jimmy Zelinskie
e7f72ef5ad utils: rm prometheus.go 2017-01-22 23:02:51 -05:00
Jimmy Zelinskie
343e24eb7e clair: remove types package
This removes the `types` package instead moving the contents to the
top-level clair package.
This change also renames the `Priority` type to `Severity` in order to
reduce confusion.
This change also removes the IsValid method and replaces it with a safe
constructor to avoid the creation of invalid values.
Many docstrings were tweaked in the making of this commit.
2017-01-22 23:02:51 -05:00
Jimmy Zelinskie
78cef02fda pkg: cerrors -> commonerr 2017-01-22 23:02:50 -05:00
Jimmy Zelinskie
03bac0f1b6 pkg: utils/tar.go -> pkg/tarutil 2017-01-22 23:02:50 -05:00
Jimmy Zelinskie
ebd0170f5b api/v1: fix JSON struct tag misnomer 2017-01-03 15:59:51 -05:00
Jimmy Zelinskie
033709eaea add registerable version formats
Since we only ever used dpkg, this change shims everything into using
dpkg.
2016-12-30 12:51:24 -05:00
Jimmy Zelinskie
d4522e9c6e api/v1: indexed layers for notifications
This change deprecates the old LayersIntroducingVulnerability for a new
one that orders output and contains an Index. This index is not
guaranteed to be consistent across multiple notifications, despite the
current Postgres implementation using the primary key of Layer table.
2016-12-06 19:23:33 -05:00
Jimmy Zelinskie
eb6117c372 Merge pull request #235 from jzelinskie/doc-move
docs: move to standard Documentation dir
2016-09-06 15:08:08 -04:00
Jimmy Zelinskie
b45b625fc8 improve v1 api docs header legibility
GitHub has changed fonts and as a result h6s are extremely small.
2016-07-11 14:35:35 -04:00
Tobias Sarnowski
ad11393a28 Updated API documentation to reflect changes to authentication scheme. (#180)
With #167, the API was changed to provide a more generic way of how Clair can retrieve the layers from a registry. This change reflects it in the documentation.
2016-05-19 10:09:43 -04:00
Jimmy Zelinskie
53e62577bc api/worker: s/Authorization/Headers (#167)
This allows clients to specify any HTTP headers that need to be used in
order to allow Clair to download a layer, rather than just the
Authorization header.
2016-05-05 13:48:10 -04:00
Jimmy Zelinskie
9b5afc79ca api/worker: introduce optional authorization
This allows clients to specify the contents of the HTTP Authorization
header so that Clair can access protected resources.
2016-05-04 15:47:14 -04:00