Skip to content

Commit 599b3ce

Browse files
committed
feat(labrinth): overhaul malware scanner report storage and routes
1 parent 5db7302 commit 599b3ce

17 files changed

+1032
-161
lines changed

apps/labrinth/.sqlx/query-0080a101c9ae040adbaadf9e46fbc457a08e70dcde320c6852074819e41f8ad9.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-0ed2e6e3149352d12a673fddc50f9530c311eef084abb6fce35de5f37d79bcea.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-10a332091be118f580d50ceb7a8724e9a4d5b9765d52305f99f859f939c2e854.json

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-8f1f75d9c52a5a340aae2b3fd863153f5e9796b55ae753ab57b14f37708b400d.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-c1cd83ddcd112e46477a195e8bed0a1658c6ddf7a486082cdb847fab06150328.json

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-fe571872262fe7d119b4b6eb1e55d818fde0499d8e5a08e9e22bee42014877f3.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
CREATE TYPE delphi_report_issue_status AS ENUM ('pending', 'approved', 'rejected');
2+
3+
CREATE TYPE delphi_report_issue_type AS ENUM (
4+
'reflection_indirection',
5+
'xor_obfuscation',
6+
'included_libraries',
7+
'suspicious_binaries',
8+
'corrupt_classes',
9+
'suspicious_classes',
10+
'url_usage',
11+
'classloader_usage',
12+
'processbuilder_usage',
13+
'runtime_exec_usage',
14+
'jni_usage',
15+
'main_method',
16+
'native_loading',
17+
'malformed_jar',
18+
'nested_jar_too_deep',
19+
'failed_decompilation',
20+
'analysis_failure',
21+
'malware_easyforme',
22+
'malware_simplyloader',
23+
'unknown'
24+
);
25+
26+
-- A Delphi analysis report for a project version
27+
CREATE TABLE delphi_reports (
28+
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
29+
file_id BIGINT REFERENCES files (id)
30+
ON DELETE SET NULL
31+
ON UPDATE CASCADE,
32+
delphi_version INTEGER NOT NULL,
33+
artifact_url VARCHAR(2048) NOT NULL,
34+
created TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP NOT NULL,
35+
UNIQUE (file_id, delphi_version)
36+
);
37+
CREATE INDEX delphi_version ON delphi_reports (delphi_version);
38+
39+
-- An issue found in a Delphi report. Every issue belongs to a report,
40+
-- and a report can have zero, one, or more issues attached to it
41+
CREATE TABLE delphi_report_issues (
42+
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
43+
report_id BIGINT NOT NULL REFERENCES delphi_reports (id)
44+
ON DELETE CASCADE
45+
ON UPDATE CASCADE,
46+
issue_type DELPHI_REPORT_ISSUE_TYPE NOT NULL,
47+
status DELPHI_REPORT_ISSUE_STATUS NOT NULL,
48+
UNIQUE (report_id, issue_type)
49+
);
50+
CREATE INDEX delphi_report_issue_by_status_and_type ON delphi_report_issues (status, issue_type);
51+
52+
-- A Java class affected by a Delphi report issue. Every affected
53+
-- Java class belongs to a specific issue, and an issue can have zero,
54+
-- one, or more affected classes. (Some issues may be artifact-wide,
55+
-- or otherwise not really specific to any particular class.)
56+
CREATE TABLE delphi_report_issue_java_classes (
57+
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
58+
issue_id BIGINT NOT NULL REFERENCES delphi_report_issues (id)
59+
ON DELETE CASCADE
60+
ON UPDATE CASCADE,
61+
internal_class_name TEXT NOT NULL,
62+
decompiled_source TEXT NOT NULL,
63+
UNIQUE (issue_id, internal_class_name)
64+
);

0 commit comments

Comments
 (0)