internal/store/migrations/0081_security_scans.up.sql

v1.46.0
gitbay/internal/store/migrations/0081_security_scans.up.sql

24 lines · 1014 bytes

 1-- Code scanning: an opt-in, scheduled build of the instance's security
 2-- job per repository, whose SARIF results the runner uploads. Its own
 3-- schedule rather than a row in build_schedules, which a push replaces
 4-- wholesale from .gitbay/ci.yml.
 5CREATE TABLE security_scans (
 6    repo_id      INTEGER PRIMARY KEY REFERENCES repos(id) ON DELETE CASCADE,
 7    next_run     TEXT NOT NULL DEFAULT '',
 8    last_results TEXT NOT NULL DEFAULT '',
 9    issue_number INTEGER NOT NULL DEFAULT 0
10);
11
12-- What each repo was last told about. The fingerprint leaves the line
13-- out, so a finding that moves is the same finding.
14CREATE TABLE security_findings (
15    repo_id     INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
16    fingerprint TEXT NOT NULL,
17    tool        TEXT NOT NULL,
18    rule        TEXT NOT NULL,
19    level       TEXT NOT NULL DEFAULT '',
20    path        TEXT NOT NULL,
21    line        INTEGER NOT NULL DEFAULT 0,
22    message     TEXT NOT NULL DEFAULT '',
23    PRIMARY KEY (repo_id, fingerprint)
24);