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

Add CVE Information to Release Notes #1441

Merged
merged 4 commits into from
Mar 1, 2021

Conversation

puerco
Copy link
Member

@puerco puerco commented Jul 27, 2020

What type of PR is this?

/kind design

What this PR does / why we need it:

This PR introduces a minor change to the release notes template to add a security section with CVE data read from a map file (see #1373).

This is a WIP intended to discuss the way the information will look like when presented in the release notes document.

When applied, this test will add a new section to the release notes markdown output with information added from a CVE map. A sample of the output can be viewed here.

Tests are not included, they will be written and added to this PR once we settle on a design.

Which issue(s) this PR fixes:

Related to #1373 and kubernetes/enhancements#1833
Closes #1354

Special notes for your reviewer:

/hold for final design, tests and until #1373 merges

Does this PR introduce a user-facing change?

* Release notes libraries will now recognize CVE information in the `datafields` section of the release notes map files.
* Add CVE vulnerability info to template.go to be rendered when a map defines a `cve` section

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/design Categorizes issue or PR as related to design. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jul 27, 2020
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. labels Jul 27, 2020
@tallclair tallclair self-assigned this Oct 19, 2020
@justaugustus
Copy link
Member

/retest

@justaugustus
Copy link
Member

@kubernetes/release-engineering -- please review!

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 20, 2020
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

/lgtm

@tpepper
Copy link
Member

tpepper commented Oct 20, 2020

/lgtm

@justaugustus
Copy link
Member

@kubernetes/product-security-committee for review as well


{{.Description}}

__Rating:__ {{.Rating}} — __Score:__ {{.Score}} — __Published:__ {{.Published}}
Copy link
Member

Choose a reason for hiding this comment

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

What are Rating and Score? Is this referring to the severity bucket, and the numerical severity rating?
If so, we usually format those like:

Severity: Medium (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H)

If you don't want to include the full CVSS rating, you could just put the numeric score in parentheses.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I've modified the template to report following your suggestion. Added a new field for the vector too.


__Rating:__ {{.Rating}} — __Score:__ {{.Score}} — __Published:__ {{.Published}}

{{if .LinkedPRs -}}
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to just link to the tracking issue (e.g. kubernetes/kubernetes#92914) rather than the specific PRs. The tracking issue should have all the detail needed, and is generally what we consider the source of truth for vulnerability details.

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 I've dropped the PRs from the output in favor of a new link to the tracking issue


This release contains changes that address the following vulnerabilities:
{{range .}}
### {{.Title}}
Copy link
Member

Choose a reason for hiding this comment

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

I would like the CVE number to be included in the title, e.g. CVE-2020-8559: Privilege escalation from compromised node to cluster

I'm not sure if we just want to make it convention to set the title like that, or explicitly break the CVE into a separate field.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 👍

@saschagrunert
Copy link
Member

@puerco are you still working on this or do you need help to carry it over the finishing line?

@puerco
Copy link
Member Author

puerco commented Feb 5, 2021

Are you planning to work on this or should we move the topic back into the open discussion?

Yes I'll retake this now as my secondary work.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 22, 2021
@puerco
Copy link
Member Author

puerco commented Feb 22, 2021

OK, Ive modified the CVE data structure and the output format to better reflect @tallclair 's suggestions. Here's a sample of the output. And the corresponding map to generate:

---
pr: 97407
datafields:
  cve:
    id: CVE-2020-8559
    vector: CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H
    rating: Medium
    score: 6.4
    title: Privilege escalation from compromised node to cluster
    issue: https://github.com/kubernetes/kubernetes/issues/92914
    issues:
      - 92941
      - 92969
      - 92970
      - 92971
    description: >
      If an attacker is able to intercept certain requests to the Kubelet, they
      can send a redirect response that may be followed by a client using the
      credentials from the original request. This can lead to compromise of
      other nodes.
      
      If multiple clusters share the same certificate authority trusted by the
      client, and the same authentication credentials, this vulnerability may
      allow an attacker to redirect the client to another cluster. In this
      configuration, this vulnerability should be considered High severity.

This PR adds the capability to read CVE data from a map and
uses it when rendering the release notes document. It incoroporates
tallclair suggestions.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 23, 2021
@puerco puerco changed the title [WIP] Add CVE Information to template.go Add CVE Information to Release Notes Feb 23, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 23, 2021
cve.CVSSRating != "Medium" &&
cve.CVSSRating != "High" &&
cve.CVSSRating != "Critical" {
return errors.New("Invalida CVSS rating")
Copy link
Member

Choose a reason for hiding this comment

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

Typo -> Invalid

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️ Thanks!

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@justaugustus
Copy link
Member

cc: @kubernetes/sig-security

Copy link
Member

@tpepper tpepper left a comment

Choose a reason for hiding this comment

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

Looks like good start, but suggest stricter validation. Since this is a critical bit of text in the notes, it is important to rigorously enforce the data is well formatted for the readers.

if cve.Description == "" {
return errors.New("CVE description missing from CVE data")
}

Copy link
Member

Choose a reason for hiding this comment

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

I can see the new TrackingIssue perhaps being empty, but can't tell if that's intended. A couple changes to consider depending on if it is required or not

  • in notes.go CVEData comment the TrackingIssue as "Optional link to the vulnerability tracking issues"
  • add a validator here to require it to be non-empty (or set it to "n/a"?)
  • conditionally print the "Tracking Issue: {{.TrackingIssue}}" portion of the template only if non-empty

Copy link
Member Author

Choose a reason for hiding this comment

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

I've modified it to make the field optional. Once it is in use we can decide if we enforce it.

return errors.New("CVSS score missing from CVE data")
}

if cve.ID == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Should this validate more that the id is of the expected form for a CVE?

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️ Added a basic regexp validation

return errors.New("CVSS vector string missing from CVE data")
}

if cve.CVSSScore == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Should validate versus the known range of 0..10.

}

if cve.CVSSVector == "" {
return errors.New("CVSS vector string missing from CVE data")
Copy link
Member

Choose a reason for hiding this comment

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

Is there a library that can validate the form is the expected CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:H sort of form?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm trying this one and seems to do the job just fine: https://github.com/spiegel-im-spiegel/go-cvss

@puerco
Copy link
Member Author

puerco commented Feb 23, 2021

I've addressed @tpepper 's remarks and added a small test for the CVE data validation function.

@puerco
Copy link
Member Author

puerco commented Feb 23, 2021

/test pull-release-verify

…ang 1.16)

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
@tpepper
Copy link
Member

tpepper commented Feb 25, 2021

Update lgtm.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 1, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cpanato, puerco, saschagrunert, xmudrii

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cpanato,puerco,saschagrunert,xmudrii]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@saschagrunert
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 1, 2021
@k8s-ci-robot k8s-ci-robot merged commit d22c94c into kubernetes:master Mar 1, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Mar 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/design Categorizes issue or PR as related to design. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding security details to release notes
8 participants