Skip to content

Commit

Permalink
feat(sast): add danger rule (#6012)
Browse files Browse the repository at this point in the history
* add danger rule

* const

* test no or

* let instead of const

* no type

* test

* change to data_flow

* warn to fail
  • Loading branch information
RabeaZr committed Feb 8, 2024
1 parent 6b125f4 commit 0712249
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion dangerfile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { danger, fail, schedule } = require('danger');
const { danger, fail, schedule, warn } = require('danger');

const IGNORE_VAR = [
'key', 's3_key', 's3_file_key', 'local_file_path', 'self.s3_bucket', 'e', 'error', 'str(e)', 'path', 'customer_name',
Expand Down Expand Up @@ -86,3 +86,18 @@ async function failIfLoggingLineContainsSensitiveData() {
}

schedule(failIfLoggingLineContainsSensitiveData);

async function alertPublicInterfaces() {
let changedFiles = danger.git.modified_files || [];

for (const changedFile of changedFiles) {
if (changedFile.endsWith("report_types.py")) {
fail("You've changed `report_types.py` file, that contains the contract for checkov input and output. Make sure to stay backwards compatible.")
}
if (changedFile.endsWith("report.py")) {
fail("You've changed `report.py` file, that contains the contract for checkov input and output. Make sure to stay backwards compatible.")
}
}
}

schedule(alertPublicInterfaces)

0 comments on commit 0712249

Please sign in to comment.