Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support multiple namespaces in one layer #193

Closed
wants to merge 2 commits into from

Conversation

liangchenye
Copy link
Contributor

This implementation mainly adds a 'version' field to database.namespace, this change affects the following things:

  1. API
    Since namespace.Name could not represent a namespace, I use the encoded namespace.ID in Vulnerabilities API and Fixes API
  2. vulnerability & fixes sql operation
    Use namespaceID to add/remove/change vulnerabilities.
  3. database migration
    using sql migration file
    detectors
  4. test cases
    for example change debian:8 to {Name: "debian", Version: "8"}
  5. debian 'unstable'
    'unstable' is illegal as a version content, change it to '10'.

Close the previous PR since that 'head fork' became 'unknown'.

Signed-off-by: liang chenye <liangchenye@huawei.com>
Signed-off-by: liang chenye <liangchenye@huawei.com>
@Quentin-M Quentin-M added kind/design relates to the fundamental design of a component lacking/review needs to be reviewed by a maintainer component/database labels Jun 9, 2016
@Quentin-M
Copy link
Contributor

Quentin-M commented Jun 9, 2016

Hi,

Thanks for your work here!

About (1), I understand why you encrypt the namespace IDs in the API as it is preferred not to leak database IDs. However, I believe that usually, the list of Namespaces is pretty much stable as it depends mainly on the registered detectors/updaters (and not on the number of images we analyzed). I am not sure if we should make this trade-off at this level between confidentiality and readability/usability. We shall make a decision and stick to it for any later development. I'd ping @jzelinskie as he wrote the API.

About (5), is there anything that led you to use the Version type instead of a more general string? I think it might limit extensibility. For instance, you chose to replace unstable by 10 here, however, Debian 10 will eventually exist in parallel to Debian Unstable.

@Quentin-M Quentin-M self-assigned this Jun 9, 2016
@@ -220,7 +220,7 @@ The GET route for the Vulnerabilities resource displays the vulnerabilities data
###### Example Request

```json
GET http://localhost:6060/v1/namespaces/debian%3A8/vulnerabilities?limit=2 HTTP/1.1
GET http://localhost:6060/v1/namespaces/gAAAAABXTQKgma_TLKq0wr1D6wVB507N3fi9wsWMUypYOSXTDVxQ8OR5L5S6PqZ9Wh0IzWojnVmlspyTL4cyjytyra7U9vAHMA==/vulnerabilities?limit=2 HTTP/1.1
Copy link
Contributor

@jzelinskie jzelinskie Jun 9, 2016

Choose a reason for hiding this comment

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

I'd rather this be something along the lines of /v1/namespaces/debian/versions/9/vulnerabilities?limit=2 rather than using the encrypted token. Obviously, it'll be slower on the database if we don't already have the ID, but I'd rather make that sacrifice for a sane API.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, so the other APIs could also be implement in this way.

@liangchenye
Copy link
Contributor Author

About (1),

I'll use ':nsname/version/:nsversion' in all the related APIs.

About (5), is there anything that led you to use the Version type instead of a more general string? I think it might limit extensibility. For instance, you chose to replace unstable by 10 here, however, Debian 10 will eventually exist in parallel to Debian Unstable.

You are right. My original idea is we need to compare versions between a layer and its parent. But since parent's namespace version will be covered so a 'string' is sufficient.

@jzelinskie
Copy link
Contributor

@liangchenye is this ready for review? Did you change the API?

@liangchenye
Copy link
Contributor Author

liangchenye commented Jul 1, 2016

@jzelinskie no, I planed to rebase this after #175 been merged.

@vbatts
Copy link
Contributor

vbatts commented Aug 12, 2016

@liangchenye looking forward to this getting merged! 😄

vbatts added a commit to vbatts/coreos-clair that referenced this pull request Aug 12, 2016
Until quay#193 is merged, having
vulnerabilities that are tagged both rhel and centos would duplicate in
the database or use a change that requires a migration.

But presently due to the fetcher logic, the rhel provided
vulnerabilities are labelled for centos, and then the namespace does not
match and therefore not tested against.

So until such a day that a vulnerability could have both rhel and centos
label, then hack this in. It'll accomplish the same during this interim.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
@vbatts vbatts mentioned this pull request Aug 12, 2016
@jzelinskie
Copy link
Contributor

This PR is now extremely out of date, but did inspire the design decisions which does implement this behavior in #432.

@jzelinskie jzelinskie closed this Aug 14, 2017
viswajithiii pushed a commit to stackrox/scanner that referenced this pull request Oct 15, 2019
Until quay/clair#193 is merged, having
vulnerabilities that are tagged both rhel and centos would duplicate in
the database or use a change that requires a migration.

But presently due to the fetcher logic, the rhel provided
vulnerabilities are labelled for centos, and then the namespace does not
match and therefore not tested against.

So until such a day that a vulnerability could have both rhel and centos
label, then hack this in. It'll accomplish the same during this interim.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design relates to the fundamental design of a component lacking/review needs to be reviewed by a maintainer
Development

Successfully merging this pull request may close these issues.

4 participants