Skip to content

Commit c668902

Browse files
Robert Schultheisreedloden
authored andcommitted
Add first GitHub Security Advisory on yard: GHSA-xfhh-rx56-rxcr (#397)
Additionally, improve GHSA support in specs.
1 parent 6e8e76b commit c668902

File tree

3 files changed

+45
-12
lines changed

3 files changed

+45
-12
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ Each advisory file contains the advisory information in [YAML] format:
6262
* `framework` \[String\] (optional): Name of the framework which the affected
6363
gem belongs to.
6464
* `platform` \[String\] (optional): If this vulnerability is platform-specific, name of platform this vulnerability affects (e.g. jruby)
65-
* `cve` \[String\]: CVE id.
66-
* `osvdb` \[Integer\]: OSVDB id.
65+
* `cve` \[String\]: Common Vulnerabilities and Exposures (CVE) ID.
66+
* `osvdb` \[Integer\]: Open Sourced Vulnerability Database (OSVDB) ID.
67+
* `ghsa` \[String\]: GitHub Security Advisory (GHSA) ID.
6768
* `url` \[String\]: The URL to the full advisory.
6869
* `title` \[String\]: The title of the advisory or individual vulnerability.
6970
* `date` \[Date\]: The public disclosure date of the advisory.
@@ -92,7 +93,7 @@ but are not already in this dataset. This script can be periodically run to ens
9293
this repo has all the data that is present in the GitHub Advisory data.
9394

9495
The GitHub Advisory API requires a token to access it.
95-
- It can be a completely scopeless token (recommended), it does not require any permissions at all.
96+
- It can be a completely scopeless token (recommended); it does not require any permissions at all.
9697
- Get yours at https://github.com/settings/tokens
9798

9899
To run the GitHub Advisory sync, start by executing the rake task:
@@ -108,7 +109,7 @@ GH_API_TOKEN=<your GitHub API Token> bundle exec rake sync_github_advisories
108109
- delete the GitHub data at the bottom of the yaml file
109110
- double check all the data, commit it, and make a PR
110111
- *The GitHub Advisory data is structured opposite of RubySec unfortunately:
111-
GitHub identifies version range which are vulnerable, RubySec identifies
112+
GitHub identifies version range which are vulnerable; RubySec identifies
112113
version ranges which are not vulnerable. This is why some manual
113114
work to translate is needed.*
114115

@@ -117,12 +118,13 @@ GH_API_TOKEN=<your GitHub API Token> bundle exec rake sync_github_advisories
117118

118119
Please see [CONTRIBUTORS.md].
119120

120-
This database also includes data from the [Open Source Vulnerability Database][OSVDB]
121+
This database also includes data from the [Open Sourced Vulnerability Database][OSVDB]
121122
developed by the Open Security Foundation (OSF) and its contributors.
122123

123124
[rubygems.org]: https://rubygems.org/
124-
[CVE]: http://cve.mitre.org/
125+
[CVE]: https://cve.mitre.org/
125126
[OSVDB]: http://www.osvdb.org/
127+
[GHSA]: https://help.github.com/en/articles/about-maintainer-security-advisories
126128
[CVSSv2]: https://www.first.org/cvss/v2/guide
127129
[CVSSv3]: https://www.first.org/cvss/user-guide
128130
[YAML]: http://www.yaml.org/

gems/yard/GHSA-xfhh-rx56-rxcr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
gem: yard
3+
ghsa: xfhh-rx56-rxcr
4+
date: 2019-07-02
5+
url: https://github.com/lsegal/yard/security/advisories/GHSA-xfhh-rx56-rxcr
6+
title: Possible arbitrary path traversal and file access via `yard server`
7+
description: A path traversal vulnerability was discovered in YARD <= 0.9.19 when
8+
using `yard server` to serve documentation. This bug would allow unsanitized HTTP
9+
requests to access arbitrary files on the machine of a yard server host under certain
10+
conditions.
11+
patched_versions:
12+
- ">= 0.9.20"

spec/advisory_example.rb

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@
1818
filename.gsub('OSVDB-','')
1919
end
2020
end
21+
22+
let(:filename_ghsa) do
23+
if filename.start_with?('GHSA-')
24+
filename.gsub('GHSA-','')
25+
end
26+
end
2127

22-
it "should be correctly named CVE-XXX or OSVDB-XXX" do
28+
it "should be correctly named CVE-XXX or OSVDB-XXX or GHSA-XXX" do
2329
expect(filename).
24-
to match(/^(CVE-\d{4}-(0\d{3}|[1-9]\d{3,})|OSVDB-\d+)\.yml$/)
30+
to match(/^(CVE-\d{4}-(0\d{3}|[1-9]\d{3,})|OSVDB-\d+|GHSA(-[a-z0-9]{4}){3})\.yml$/)
2531
end
2632

27-
it "should have CVE or OSVDB" do
28-
expect(advisory['cve'] || advisory['osvdb']).not_to be_nil
33+
it "should have CVE or OSVDB or GHSA" do
34+
expect(advisory['cve'] || advisory['osvdb'] || advisory['ghsa']).not_to be_nil
2935
end
3036

3137
describe "framework" do
@@ -70,6 +76,19 @@
7076
end
7177
end
7278
end
79+
80+
describe "ghsa" do
81+
subject { advisory['ghsa'] }
82+
83+
it "may be nil or a String" do
84+
expect(subject).to be_kind_of(String).or(be_nil)
85+
end
86+
it "should be id in filename if filename is GHSA-XXX" do
87+
if filename_ghsa
88+
is_expected.to eq(filename_ghsa.chomp('.yml'))
89+
end
90+
end
91+
end
7392

7493
describe "url" do
7594
subject { advisory['url'] }
@@ -192,8 +211,8 @@
192211
when Hash
193212
advisory["related"].each_pair do |name, values|
194213
describe name do
195-
it "should be either a cve, an osvdb or a url" do
196-
expect(["cve", "osvdb", "url"]).to include(name)
214+
it "should be either a cve, an osvdb, a ghsa, or a url" do
215+
expect(["cve", "osvdb", "ghsa", "url"]).to include(name)
197216
end
198217

199218
it "should always contain an array" do

0 commit comments

Comments
 (0)