-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Active Scanning and Replacing (AWS) Tokens (#254)
- Loading branch information
Vitalie D
committed
Jan 12, 2023
1 parent
6eff9f7
commit f411adb
Showing
15 changed files
with
221 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
-- Deploy travis-logs:create_scan_results_table to pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
CREATE TABLE scan_results ( | ||
id bigint NOT NULL, | ||
log_id bigint NOT NULL, | ||
job_id bigint NOT NULL, | ||
repository_id bigint NOT NULL, | ||
owner_id integer NOT NULL, | ||
owner_type character varying NOT NULL, | ||
created_at timestamp without time zone, | ||
content jsonb NOT NULL, | ||
issues_found integer NOT NULL, | ||
archived boolean, | ||
purged_at timestamp without time zone, | ||
token character varying NOT NULL, | ||
token_created_at timestamp without time zone | ||
); | ||
|
||
CREATE SEQUENCE scan_results_id_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
ALTER SEQUENCE scan_results_id_seq OWNED BY scan_results.id; | ||
|
||
ALTER TABLE ONLY scan_results | ||
ALTER COLUMN id | ||
SET DEFAULT nextval('scan_results_id_seq'::regclass); | ||
|
||
ALTER TABLE ONLY scan_results | ||
ADD CONSTRAINT scan_results_pkey PRIMARY KEY (id); | ||
|
||
CREATE INDEX index_scan_results_on_repository_id | ||
ON scan_results | ||
USING btree (repository_id); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-- Deploy travis-logs:create_scan_tracker_table to pg | ||
-- requires: logs_create_scan_status | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
CREATE TABLE scan_tracker ( | ||
id bigint NOT NULL, | ||
log_id bigint NOT NULL, | ||
scan_status character varying, | ||
details jsonb, | ||
created_at timestamp without time zone | ||
); | ||
|
||
CREATE SEQUENCE scan_tracker_id_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
NO MINVALUE | ||
NO MAXVALUE | ||
CACHE 1; | ||
|
||
ALTER SEQUENCE scan_tracker_id_seq OWNED BY scan_tracker.id; | ||
|
||
ALTER TABLE ONLY scan_tracker | ||
ALTER COLUMN id | ||
SET DEFAULT nextval('scan_tracker_id_seq'::regclass); | ||
|
||
ALTER TABLE ONLY scan_tracker | ||
ADD CONSTRAINT scan_tracker_pkey PRIMARY KEY (id); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- Deploy travis-logs:logs_create_scan_status to pg | ||
-- requires: partman_remove_constraint | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
ALTER TABLE logs | ||
ADD COLUMN scan_status character varying, | ||
ADD COLUMN scan_status_updated_at timestamp without time zone, | ||
ADD COLUMN scan_enqueued_at timestamp without time zone, | ||
ADD COLUMN scan_started_at timestamp without time zone, | ||
ADD COLUMN scan_ended_at timestamp without time zone, | ||
ADD COLUMN censored boolean; | ||
|
||
CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_order_by_newest ON public.logs USING btree (scan_status, id DESC); | ||
CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_and_scan_status_updated_at ON public.logs USING btree (scan_status, scan_status_updated_at); | ||
CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_and_scan_status_updated_at_where_status_running ON public.logs USING btree (scan_status, scan_status_updated_at) WHERE ((scan_status)::text = ANY ((ARRAY['started'::character varying, 'processing'::character varying, 'finalizing'::character varying])::text[])); | ||
CREATE INDEX IF NOT EXISTS index_logs_on_scan_started_at ON public.logs USING btree (scan_started_at); | ||
CREATE INDEX IF NOT EXISTS index_logs_on_scan_ended_at ON public.logs USING btree (scan_ended_at); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Revert travis-logs:create_scan_results_table from pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
DROP TABLE scan_results; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Revert travis-logs:create_scan_tracker_table from pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
DROP TABLE scan_tracker CASCADE; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Revert travis-logs:logs_create_scan_status from pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
ALTER TABLE logs | ||
DROP COLUMN scan_status, | ||
DROP COLUMN scan_status_updated_at, | ||
DROP COLUMN scan_enqueued_at, | ||
DROP COLUMN scan_started_at, | ||
DROP COLUMN scan_ended_at, | ||
DROP COLUMN censored; | ||
|
||
DROP INDEX index_logs_on_scan_status_order_by_newest; | ||
DROP INDEX index_logs_on_censored; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Verify travis-logs:create_scan_results_table on pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
SELECT id | ||
FROM scan_results | ||
WHERE false; | ||
|
||
ROLLBACK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Verify travis-logs:create_scan_tracker_table on pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
SELECT id, scan_status, details, created_at | ||
FROM scan_tracker | ||
WHERE false; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- Verify travis-logs:logs_create_scan_status on pg | ||
|
||
BEGIN; | ||
|
||
SET client_min_messages = WARNING; | ||
|
||
SELECT scan_status, scan_status_updated_at, scan_enqueued_at, scan_started_at, scan_ended_at, censored | ||
FROM logs | ||
WHERE false; | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters