Skip to content

Commit 2693e66

Browse files
Further elaboration of the advisory DB proposal
1 parent d37b1f6 commit 2693e66

File tree

5 files changed

+578
-3
lines changed

5 files changed

+578
-3
lines changed

proposals/advisory-db.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,53 @@ The `affected` table, if present, contains the following fields, all of which ar
103103
* `declarations`, a table that maps fully-qualified names from the package to Cabal v2.0 version ranges. These ranges must all be contained in the affected versions (specified later), and they specify that the given name is the source of the advisory in that sub-range. This allows one advisory to mention a function or datatype that is renamed at some point during development.
104104
The `versions` table contains a single mandatory key, `affected`, whose value is a string that contains a Cabal v2.0 version range.
105105

106-
Cabal v2.0 version ranges are specified using the following grammar: TODO
106+
Cabal v2.0 version ranges are specified using the following grammar:
107+
108+
```
109+
VersionNum ::= "0" | [1-9][0-9]{0-8} -- Up to nine digits, no leading 0
110+
111+
Version ::= VersionNum | VersionNum "." Version -- Any number of VersionNum, dot-separated
112+
113+
VersionRange ::=
114+
"==" Version |
115+
">" Version |
116+
"<" Version |
117+
"<=" Version |
118+
">=" Version |
119+
"^>=" Version |
120+
VersionRange "&&" VersionRange |
121+
VersionRange "||" VersionRange |
122+
"(" VersionRange ")"
123+
```
124+
125+
In the above, `&&` binds more tightly than `||`, so `VersionRange1 && VersionRange2 || VersionRange3` is equivalent to `(VersionRange1 && VersionRange2) || VersionRange3`.
126+
127+
Ordering (and thus equality) of version numbers is defined in the Haskell [Package Versioning Policy](https://pvp.haskell.org). Ordering is defined lexicographically with respect to the numeric values of version number components. This means, for instance, that `1.5.3.0 > 1.5.3`.
128+
129+
The `^>=` operator defines both lower and upper bounds for a dependency according to the following desugaring:
130+
* `^>= x ↝ >= x && < x.1`
131+
* `^>= x.y ↝ >= x.y && < x.(y+1)`
132+
* `^>= x.y.z ↝ >= x.y.z && < x.(y+1)`
133+
* `^>= x.y.z.u ↝ >= x.y.z.u && < x.(y+1)`
134+
* and so forth
135+
107136

108-
Tools that detect vulnerabilities will need to check whether advisory version ranges overlap with dependency version constraints. The algorithm for this is TODO.
109137

110138
### Recommendations Regarding Build/Freeze Files
111139

112-
TODO: Which formats do we recommend they look in to start with? `.cabal`, `cabal.freeze`? Stack users' constraints mostly come from their snapshot - how can we make this work for people with no constraints in `.cabal` and a `stack.yaml` file?
140+
TODO: How do we actually let them look at cabal files? Common stanzas and conditionals make this fairly non-trivial.
141+
142+
TODO - Recommendation will be to do the following:
143+
* First process Cabal files
144+
* Then do freeze files, which should allow processing Stackage resolver files as well
145+
* Then read stack.yaml enough to get the resolver
113146

114147
### Governance and Administration
115148

116149
The Haskell Foundation will be responsible for appointing the administrators of the database. Administrators are expected to be trusted community members who are willing to provide timely feedback in the repository. The Haskell Foundation should check from time to time that feedback is timely, and can serve as a final arbiter of disputes.
117150

151+
To begin with, the HF executive team will assemble a group of five volunteers, who will be solicited from bodies such as the Core Libraries Committee and the Hackage trustees, asking for a one-year commitment. The HF will evaluate the size and composition of the group on an ongoing basis, and may make adjustments to membership. We will recruit a set of volunteers with knowledge of cryptography, low-level exploits such as buffer overflows, the GHC RTS, network security, and security organization best practices, as well as good communication skills, and will adjust the size of the volunteer group until these areas are covered.
152+
118153
## Resources
119154

120155
This proposal requires the following:

proposals/advisory-db/README.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a proof-of-concept parser and renderer for the advisory format. It accepts an advisory on stdin, and either fails or emits an HTML rendering on stdout.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cabal-version: 2.4
2+
name: advisory-proposal
3+
version: 0.1.0.0
4+
5+
-- A short (one-line) description of the package.
6+
-- synopsis:
7+
8+
-- A longer description of the package.
9+
-- description:
10+
11+
-- A URL where users can report bugs.
12+
-- bug-reports:
13+
14+
-- The license under which the package is released.
15+
-- license:
16+
author: David Christiansen
17+
maintainer: [email protected]
18+
19+
-- A copyright notice.
20+
-- copyright:
21+
-- category:
22+
extra-source-files: CHANGELOG.md
23+
24+
executable advisory-proposal
25+
main-is: Main.hs
26+
27+
-- Modules included in this executable, other than Main.
28+
-- other-modules:
29+
30+
-- LANGUAGE extensions used by modules in this package.
31+
-- other-extensions:
32+
build-depends: base ^>=4.14.3.0,
33+
commonmark ^>= 0.2.2,
34+
text ^>= 1.2,
35+
time ^>= 1.9,
36+
Cabal ^>= 3.6.3.0,
37+
mtl ^>= 2.2,
38+
unordered-containers,
39+
containers ^>= 0.6,
40+
toml-reader ^>= 0.1
41+
hs-source-dirs: app
42+
default-language: Haskell2010

0 commit comments

Comments
 (0)