Merge ~ilasc/launchpad:add-vulnerability-model into launchpad:master

Proposed by Ioana Lasc
Status: Superseded
Proposed branch: ~ilasc/launchpad:add-vulnerability-model
Merge into: launchpad:master
Diff against target: 85 lines (+73/-0)
2 files modified
database/schema/patch-2210-38-1.sql (+9/-0)
database/schema/patch-2210-42-0.sql (+64/-0)
Reviewer Review Type Date Requested Status
Launchpad code reviewers Pending
Review via email: mp+415802@code.launchpad.net

This proposal has been superseded by a proposal from 2022-02-18.

Commit message

Add vulnerability, vulnerabilityactivity and bugvulnerability

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) wrote :

Diagram: https://dbdiagram.io/d/612378e36dc2bb6073b6ecce

The next MP (ORM) will contain the proposed the enum for "what_changed" on vulnerabilityactivity, but pasting it here for detail:

class VulnerabilityChanges(DBEnumeratedType):
    """Type of change in vulnerability

    We use this enum to track changes occuring in
    data stored in the vulnerability table.
    """

    STATUS = DBItem(0, """
        Status

        The status of the vulnerability changed.
        """)

    DESCRIPTION = DBItem(1, """
        Description

        The description of the vulnerability changed.
        """)

    NOTES = DBItem(2, """
        Notes

        The notes on the vulnerability changed.
        """)

    MITIGATION = DBItem(3, """
        Mitigation

        Mitigation for this vulnerability changed.
        """)

    IMPORTANCE = DBItem(4, """
        Importance

        The importance assigned for this vulnerability changed.
        """)

    IMPORTANCE_EXPLANATION = DBItem(5, """
        Importance explanation

        The importance explanation changed for this vulnerability.
        """)

    PRIVACY = DBItem(6, """
        Privacy

        The privacy for this vulnerability changed.
        """)

Unmerged commits

8b78acb... by Ioana Lasc

Add vulnerability, vulnerabilityactivity and bugvulnerability

d543821... by Guruprasad

Disallow NULL values for Bug.lock_status

Merged from https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/415259

b50f902... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to 131c1c72b603

a8c7550... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to a794baa81a31

bc051c7... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to 88281672bd33

60cd026... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to 3910f9b2ecef

0578e4e... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to fb383037dc57

1e26cc5... by Patch Queue Manager <email address hidden>

Automatic merge from stable up to 27c3ab425c24

d3185b6... by Guruprasad

Disallow NULL values for Bug.lock_status

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-38-1.sql b/database/schema/patch-2210-38-1.sql
2new file mode 100644
3index 0000000..6519b25
4--- /dev/null
5+++ b/database/schema/patch-2210-38-1.sql
6@@ -0,0 +1,9 @@
7+-- Copyright 2022 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+ALTER TABLE Bug
13+ ALTER COLUMN lock_status SET NOT NULL;
14+
15+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 38, 1);
16diff --git a/database/schema/patch-2210-42-0.sql b/database/schema/patch-2210-42-0.sql
17new file mode 100644
18index 0000000..2ad467e
19--- /dev/null
20+++ b/database/schema/patch-2210-42-0.sql
21@@ -0,0 +1,64 @@
22+-- Copyright 2022 Canonical Ltd. This software is licensed under the
23+-- GNU Affero General Public License version 3 (see the file LICENSE).
24+
25+SET client_min_messages=ERROR;
26+
27+CREATE TABLE vulnerability (
28+ id serial PRIMARY KEY,
29+ distribution integer REFERENCES Distribution NOT NULL,
30+ cve integer REFERENCES CVE,
31+ status integer,
32+ description text,
33+ notes text,
34+ mitigation text,
35+ importance integer NOT NULL,
36+ importance_explanation text,
37+ private boolean DEFAULT false NOT NULL
38+);
39+
40+COMMENT ON TABLE vulnerability IS 'Expresses the notion of whether a CVE affects a distribution.';
41+COMMENT ON COLUMN vulnerability.distribution IS 'Indicates control by the pillar''s owner.';
42+COMMENT ON COLUMN vulnerability.cve IS 'Intentionally nullable, since we need to track vulnerabilities not associated with CVEs.';
43+COMMENT ON COLUMN vulnerability.status IS 'Indicates current status of the vulnerability.';
44+COMMENT ON COLUMN vulnerability.cve IS 'Overrides the cve description.';
45+COMMENT ON COLUMN vulnerability.notes IS 'Free-form notes; may need some formatting machinery.';
46+COMMENT ON COLUMN vulnerability.mitigation IS 'Explain why we''re ignoring something.';
47+COMMENT ON COLUMN vulnerability.importance IS 'Indicates work priority, not severity.';
48+COMMENT ON COLUMN vulnerability.importance_explanation IS 'Used to explain why our importance differs from somebody else''s CVSS score.';
49+COMMENT ON COLUMN vulnerability.private IS 'Indicates privacy of the vulnerability.';
50+
51+CREATE INDEX vulnerability__distribution__cve__idx
52+ ON vulnerability (distribution, cve);
53+
54+CREATE TABLE vulnerabilityactivity (
55+ id serial PRIMARY KEY,
56+ vulnerability integer REFERENCES Vulnerability NOT NULL,
57+ changer integer REFERENCES Person NOT NULL,
58+ date_changed timestamp without time zone NOT NULL,
59+ what_changed integer NOT NULL,
60+ old_value text,
61+ new_value text
62+);
63+
64+COMMENT ON TABLE vulnerabilityactivity IS 'Tracks changes to vulnerability rows.';
65+COMMENT ON COLUMN vulnerabilityactivity.vulnerability IS 'Indicates the vulnerability that the changes refer to.';
66+COMMENT ON COLUMN vulnerabilityactivity.changer IS 'Indicates the person that made the changes.';
67+COMMENT ON COLUMN vulnerabilityactivity.date_changed IS 'Indicates the date when the vulnerability details last changed.';
68+COMMENT ON COLUMN vulnerabilityactivity.what_changed IS 'Indicates what field changed for the vulnerability by means of an enum.';
69+COMMENT ON COLUMN vulnerabilityactivity.old_value IS 'Indicates the value prior to the change.';
70+COMMENT ON COLUMN vulnerabilityactivity.new_value IS 'Indicates the current value.';
71+
72+CREATE INDEX vulnerabilityactivity__vulnerability__changer__idx
73+ ON vulnerabilityactivity (vulnerability, changer);
74+
75+CREATE TABLE bugvulnerability (
76+ bug integer REFERENCES Bug NOT NULL,
77+ vulnerability integer REFERENCES Vulnerability NOT NULL
78+);
79+
80+COMMENT ON TABLE bugvulnerability IS 'Links a vulnerability to the bug.';
81+
82+CREATE INDEX bugvulnerability__bug__vulnerability__idx
83+ ON bugvulnerability (bug, vulnerability);
84+
85+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 42, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: