Skip to content

Commit 1d514a5

Browse files
authored
Merge pull request #38579 from mtardy/cve-json-feed
Update CVE feed layouts for new JSON feed format
2 parents c342ef2 + 3305d7b commit 1d514a5

File tree

3 files changed

+19
-43
lines changed

3 files changed

+19
-43
lines changed

data/i18n/en/en.toml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,20 @@ other = "CVE ID"
4949
[cve_issue_url]
5050
other = "CVE GitHub Issue URL"
5151

52-
[cve_json_external_url]
53-
other = "external_url"
54-
55-
[cve_json_id]
56-
other = "id"
57-
58-
[cve_json_summary]
59-
other = "summary"
60-
61-
[cve_json_url]
62-
other = "url"
63-
6452
[cve_summary]
6553
other = "Issue Summary"
6654

6755
[cve_table]
6856
other = "Official Kubernetes CVE List"
6957

70-
[cve_url]
71-
other = "CVE URL"
58+
[cve_table_date_before]
59+
other = "(last updated: "
60+
61+
[cve_table_date_format]
62+
other = "02 Jan 2006 15:04:05 MST"
63+
64+
[cve_table_date_after]
65+
other = ")"
7266

7367
[deprecation_title]
7468
other = "You are viewing documentation for Kubernetes version:"

layouts/_default/cve-feed.json

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1 @@
1-
{
2-
"version": "https://jsonfeed.org/version/1.1",
3-
"title": "Auto-refreshing Official CVE Feed",
4-
"home_page_url": "https://kubernetes.io",
5-
"feed_url": "https://kubernetes.io/docs/reference/issues-security/official-cve-feed/index.json",
6-
"description": "Auto-refreshing official CVE feed for Kubernetes repository",
7-
"authors": [
8-
{
9-
"name": "Kubernetes Community",
10-
"url": "https://www.kubernetes.dev"
11-
}
12-
],
13-
"items": [
14-
{{ range $i, $e := getJSON .Site.Params.cveFeedBucket }}
15-
{{ if $i }}, {{ end }}
16-
{
17-
{{ T "cve_json_id" | jsonify }}: {{ .cve_id | jsonify }},
18-
{{ T "cve_json_url" | jsonify }}: {{ .issue_url | jsonify }},
19-
{{ T "cve_json_external_url" | jsonify }}: {{ .cve_url | jsonify}},
20-
{{ T "cve_json_summary" | jsonify }}: {{ replace (.summary | jsonify ) "\\u003e" ">" }}
21-
}{{ end }}
22-
]
23-
}
1+
{{ getJSON .Site.Params.cveFeedBucket | jsonify }}

layouts/shortcodes/cve-feed.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
{{ $feed := getJSON .Site.Params.cveFeedBucket }}
2+
{{ if ne $feed.version "https://jsonfeed.org/version/1.1" }}
3+
{{ errorf "Build Failed. CVE feed does not comply with JSON feed v1.1" }}
4+
{{ end }}
15
<table class="security-cves">
2-
<caption>{{ T "cve_table" }}</caption>
6+
<caption style="caption-side: top;">{{ T "cve_table" }} {{ T "cve_table_date_before" }}{{ $feed._kubernetes_io.updated_at | time.Format ( T "cve_table_date_format" ) }}{{ T "cve_table_date_after" }}</caption>
37
<thead>
48
<tr>
59
<th>{{ T "cve_id" }}</th>
6-
<th>{{ T "cve_summary"}}</th>
10+
<th>{{ T "cve_summary" }}</th>
711
<th>{{ T "cve_issue_url" }}</th>
812
</tr>
913
</thead>
1014
<tbody>
11-
{{ range $issues := getJSON .Site.Params.cveFeedBucket }}
15+
{{ range $feed.items }}
1216
<tr>
13-
<td><a href="{{ .cve_url }}">{{ .cve_id | htmlEscape | safeHTML }}</a></td>
17+
<td><a href="{{ .url }}">{{ .id | htmlEscape | safeHTML }}</a></td>
1418
<td>{{ .summary | htmlEscape | safeHTML }}</td>
15-
<td><a href="{{ .issue_url }}">#{{ .number }}</a></td>
19+
<td><a href="{{ .url }}">#{{ ._kubernetes_io.issue_number }}</a></td>
1620
</tr>
1721
{{ end }}
1822
</tbody>
19-
</table>
23+
</table>

0 commit comments

Comments
 (0)