Skip to content

Commit

Permalink
CVE feed: add RSS feed format
Browse files Browse the repository at this point in the history
Add tabs to display the various feeds thanks to sftim!
  • Loading branch information
mtardy committed Mar 10, 2023
1 parent 1d514a5 commit eb0ba71
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
30 changes: 19 additions & 11 deletions content/en/docs/reference/issues-security/official-cve-feed.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Official CVE Feed
linkTitle: CVE feed
weight: 25
outputs:
- json
- html
- html
- rss
layout: cve-feed
---

Expand All @@ -14,19 +16,25 @@ the Kubernetes Security Response Committee. See
[Kubernetes Security and Disclosure Information](/docs/reference/issues-security/security/)
for more details.

The Kubernetes project publishes a programmatically accessible
[JSON Feed](/docs/reference/issues-security/official-cve-feed/index.json) of
published security issues. You can access it by executing the following command:

{{< comment >}}
`replace` is used to bypass known issue with rendering ">"
: https://github.com/gohugoio/hugo/issues/7229 in JSON layouts template
`layouts/_default/cve-feed.json`
{{< /comment >}}
The Kubernetes project publishes a programmatically accessible feed of published
security issues in [JSON feed](/docs/reference/issues-security/official-cve-feed/index.json)
and [RSS feed](/docs/reference/issues-security/official-cve-feed/feed.xml)
formats. You can access it by executing the following commands:

{{< tabs name="CVE feeds" >}}
{{% tab name="JSON feed" %}}
[Link to JSON format](/docs/reference/issues-security/official-cve-feed/index.json)
```shell
curl -L https://k8s.io/docs/reference/issues-security/official-cve-feed/index.json
```
{{% /tab %}}
{{% tab name="RSS feed" %}}
[Link to RSS format](/docs/reference/issues-security/official-cve-feed/feed.xml)
```shell
curl -Lv https://k8s.io/docs/reference/issues-security/official-cve-feed/index.json
curl -L https://k8s.io/docs/reference/issues-security/official-cve-feed/feed.xml
```
{{% /tab %}}
{{< /tabs >}}

{{< cve-feed >}}

Expand Down
25 changes: 25 additions & 0 deletions layouts/_default/cve-feed.rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{ $feed := getJSON .Site.Params.cveFeedBucket -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ $feed.title }}</title>
<link>{{ .Site.BaseURL }}docs/reference/issues-security/official-cve-feed/</link>
<description>{{ $feed.description }}</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-US</language>
<copyright>{{ .Site.Params.Copyright_k8s }}</copyright>
<lastBuildDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" $feed._kubernetes_io.updated_at | safeHTML }}</lastBuildDate>
{{ with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end -}}
{{ range $feed.items -}}
<item>
<title>{{ .id }}</title>
<link>{{ .url }}</link>
<pubDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" .date_published | safeHTML }}</pubDate>
<guid>{{ .external_url }}</guid>
<description>{{ htmlEscape .summary }}</description>
</item>
{{ end -}}
</channel>
</rss>

0 comments on commit eb0ba71

Please sign in to comment.