Skip to content

Commit fc60172

Browse files
author
Vitalie D
committed
Active Scanning and Replacing (AWS) Tokens (#254)
1 parent 6eff9f7 commit fc60172

15 files changed

+222
-3
lines changed

.dockerignore

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,19 @@
55
.travis.yml
66
Dockerfile
77
spec
8-
#IDEs folders
9-
.idea
8+
9+
# Ignore editor specific configs
10+
/.idea
11+
/.vscode
12+
.project
13+
.classpath
14+
.c9/
15+
*.launch
16+
.settings/
17+
*.sublime-workspace
18+
.generators
19+
.rakeTasks
20+
21+
# System Files
22+
.DS_Store
23+
Thumbs.db

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,19 @@ play
55
.jdk-overlay
66
.*env
77
coverage/
8+
9+
# Ignore editor specific configs
10+
/.idea
11+
/.vscode
12+
.project
13+
.classpath
14+
.c9/
15+
*.launch
16+
.settings/
17+
*.sublime-workspace
18+
.generators
19+
.rakeTasks
20+
21+
# System Files
22+
.DS_Store
23+
Thumbs.db
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- Deploy travis-logs:create_scan_results_table to pg
2+
3+
BEGIN;
4+
5+
SET client_min_messages = WARNING;
6+
7+
CREATE TABLE scan_results (
8+
id bigint NOT NULL,
9+
repository_id bigint NOT NULL,
10+
job_id bigint NOT NULL,
11+
log_id bigint NOT NULL,
12+
owner_id integer NOT NULL,
13+
owner_type character varying NOT NULL,
14+
content jsonb NOT NULL,
15+
issues_found integer NOT NULL,
16+
archived boolean,
17+
purged_at timestamp without time zone,
18+
created_at timestamp without time zone
19+
);
20+
21+
CREATE SEQUENCE scan_results_id_seq
22+
START WITH 1
23+
INCREMENT BY 1
24+
NO MINVALUE
25+
NO MAXVALUE
26+
CACHE 1;
27+
28+
ALTER SEQUENCE scan_results_id_seq OWNED BY scan_results.id;
29+
30+
ALTER TABLE ONLY scan_results
31+
ALTER COLUMN id
32+
SET DEFAULT nextval('scan_results_id_seq'::regclass);
33+
34+
ALTER TABLE ONLY scan_results
35+
ADD CONSTRAINT scan_results_pkey PRIMARY KEY (id);
36+
37+
CREATE INDEX index_scan_results_on_repository_id
38+
ON scan_results
39+
USING btree (repository_id);
40+
41+
COMMIT;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
-- Deploy travis-logs:create_scan_tracker_table to pg
2+
-- requires: logs_create_scan_status
3+
4+
BEGIN;
5+
6+
SET client_min_messages = WARNING;
7+
8+
CREATE TABLE scan_tracker (
9+
id bigint NOT NULL,
10+
log_id bigint NOT NULL,
11+
scan_status character varying,
12+
details jsonb,
13+
created_at timestamp without time zone
14+
);
15+
16+
CREATE SEQUENCE scan_tracker_id_seq
17+
START WITH 1
18+
INCREMENT BY 1
19+
NO MINVALUE
20+
NO MAXVALUE
21+
CACHE 1;
22+
23+
ALTER SEQUENCE scan_tracker_id_seq OWNED BY scan_tracker.id;
24+
25+
ALTER TABLE ONLY scan_tracker
26+
ALTER COLUMN id
27+
SET DEFAULT nextval('scan_tracker_id_seq'::regclass);
28+
29+
ALTER TABLE ONLY scan_tracker
30+
ADD CONSTRAINT scan_tracker_pkey PRIMARY KEY (id);
31+
32+
COMMIT;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Deploy travis-logs:logs_create_scan_status to pg
2+
-- requires: partman_remove_constraint
3+
4+
BEGIN;
5+
6+
SET client_min_messages = WARNING;
7+
8+
ALTER TABLE logs
9+
ADD COLUMN scan_status character varying,
10+
ADD COLUMN scan_status_updated_at timestamp without time zone,
11+
ADD COLUMN censored boolean,
12+
ADD COLUMN scan_queued_at timestamp without time zone,
13+
ADD COLUMN scan_started_at timestamp without time zone,
14+
ADD COLUMN scan_processing_at timestamp without time zone,
15+
ADD COLUMN scan_finalizing_at timestamp without time zone,
16+
ADD COLUMN scan_ended_at timestamp without time zone;
17+
18+
CREATE INDEX CONCURRENTLY IF NOT EXISTS index_logs_on_scan_status_and_id_desc ON public.logs USING btree (scan_status, id DESC);
19+
CREATE INDEX CONCURRENTLY IF NOT EXISTS index_logs_on_scan_status_and_scan_status_updated_at ON public.logs USING btree (scan_status, scan_status_updated_at);
20+
CREATE INDEX CONCURRENTLY IF NOT EXISTS index_logs_on_scan_status_and_created_at_desc ON public.logs USING btree (scan_status, created_at DESC);
21+
22+
COMMIT;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Revert travis-logs:create_scan_results_table from pg
2+
3+
BEGIN;
4+
5+
SET client_min_messages = WARNING;
6+
7+
DROP TABLE scan_results;
8+
9+
COMMIT;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Revert travis-logs:create_scan_tracker_table from pg
2+
3+
BEGIN;
4+
5+
SET client_min_messages = WARNING;
6+
7+
DROP TABLE scan_tracker CASCADE;
8+
9+
COMMIT;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Revert travis-logs:logs_create_scan_status from pg
2+
3+
BEGIN;
4+
5+
SET client_min_messages = WARNING;
6+
7+
ALTER TABLE logs
8+
DROP COLUMN scan_status,
9+
DROP COLUMN scan_status_updated_at,
10+
DROP COLUMN censored,
11+
DROP COLUMN scan_queued_at,
12+
DROP COLUMN scan_started_at,
13+
DROP COLUMN scan_processing_at,
14+
DROP COLUMN scan_finalizing_at,
15+
DROP COLUMN scan_ended_at;
16+
17+
DROP INDEX index_logs_on_scan_status_and_id_desc;
18+
DROP INDEX index_logs_on_scan_status_and_scan_status_updated_at;
19+
DROP INDEX index_logs_on_scan_status_and_created_at_desc;
20+
21+
COMMIT;

db/sqitch.plan

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ vacuum_settings [structure] 2017-04-04T19:37:24Z Dan Buch <[email protected]> #
66
log_parts_created_at_not_null [structure] 2017-04-04T19:52:23Z Dan Buch <[email protected]> # Modify log_parts.created_at to be NOT NULL with default for use with partman
77
partman [log_parts_created_at_not_null] 2017-04-04T20:24:49Z Dan Buch <[email protected]> # Enable and configure partman for log_parts
88
partman_remove_constraint 2018-04-27T11:41:39Z Igor Wiedler <[email protected]> # Remove partman constraint exclusion on log_id column
9+
logs_create_scan_status 2022-08-05T12:21:22Z Andrii Mysko <[email protected]> # Add scan status columns to logs table
10+
create_scan_tracker_table 2022-08-05T12:21:23Z Andrii Mysko <[email protected]> # Add scan_tracker table
11+
create_scan_results_table 2022-09-05T14:31:43Z Stanislav Colotinschi <[email protected]> # Add scan_results table
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Verify travis-logs:create_scan_results_table on pg
2+
3+
BEGIN;
4+
5+
SET client_min_messages = WARNING;
6+
7+
SELECT id
8+
FROM scan_results
9+
WHERE false;
10+
11+
ROLLBACK;

0 commit comments

Comments
 (0)