Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('noSensitiveInfoInRepositories', () => {
project_id: 1,
compliance_check_id: 1,
severity: 'critical',
title: 'The organization(s) (org1,org2) has not enabled secret scanning by default. 2 (66.7%) repositories do not have the secret scanner enabled',
title: 'The organization(s) (org1, org2) has not enabled secret scanning by default. 2 (66.7%) repositories do not have the secret scanner enabled',
description: 'Check the details on https://example.com'
}
],
Expand All @@ -158,7 +158,7 @@ describe('noSensitiveInfoInRepositories', () => {
compliance_check_id: 1,
severity: 'critical',
status: 'failed',
rationale: 'The organization(s) (org1,org2) has not enabled secret scanning by default. 2 (66.7%) repositories do not have the secret scanner enabled'
rationale: 'The organization(s) (org1, org2) has not enabled secret scanning by default. 2 (66.7%) repositories do not have the secret scanner enabled'
},
{
compliance_check_id: 1,
Expand All @@ -173,7 +173,7 @@ describe('noSensitiveInfoInRepositories', () => {
project_id: 1,
compliance_check_id: 1,
severity: 'critical',
title: 'Enable secret scanning for new repositories for the organization(s) (org1,org2) and 2 (66.7%) repositories',
title: 'Enable secret scanning for new repositories for the organization(s) (org1, org2) and 2 (66.7%) repositories',
description: 'Check the details on https://example.com'
}
]
Expand Down
8 changes: 4 additions & 4 deletions src/checks/validators/adminRepoCreationOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ module.exports = ({ organizations = [], check, projects = [] }) => {
result.rationale = 'Only Admins can create public repositories in the organization(s)'
} else if (failedOrgs.length) {
result.status = 'failed'
result.rationale = `Not Only Admins can create public repositories in the following (${failedOrgs.join(',')}) organization(s)`
alert.title = `Not Only Admins can create public repositories in the following (${failedOrgs.join(',')}) organization(s)`
result.rationale = `Not Only Admins can create public repositories in the following (${failedOrgs.join(', ')}) organization(s)`
alert.title = `Not Only Admins can create public repositories in the following (${failedOrgs.join(', ')}) organization(s)`
alert.description = `Check the details on ${check.details_url}`
task.title = `Limit public repo creation to admins for the following (${failedOrgs.join(',')}) organization(s)`
task.title = `Limit public repo creation to admins for the following (${failedOrgs.join(', ')}) organization(s)`
task.description = `Check the details on ${check.details_url}`
} else if (unknownOrgs.length) {
result.status = 'unknown'
result.rationale = `It was not possible to confirm if only admins can create public repositories in the following (${unknownOrgs.join(',')}) organization(s)`
result.rationale = `It was not possible to confirm if only admins can create public repositories in the following (${unknownOrgs.join(', ')}) organization(s)`
}
// Include only the task if was populated
if (Object.keys(task).length > Object.keys(baseData).length) {
Expand Down
8 changes: 4 additions & 4 deletions src/checks/validators/githubOrgMFA.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ module.exports = ({ organizations = [], check, projects = [] }) => {
result.rationale = 'The organization(s) have 2FA enabled'
} else if (failedOrgs.length) {
result.status = 'failed'
result.rationale = `The organization(s) (${failedOrgs.join(',')}) do not have 2FA enabled`
alert.title = `The organization(s) (${failedOrgs.join(',')}) do not have 2FA enabled`
result.rationale = `The organization(s) (${failedOrgs.join(', ')}) do not have 2FA enabled`
alert.title = `The organization(s) (${failedOrgs.join(', ')}) do not have 2FA enabled`
alert.description = `Check the details on ${check.details_url}`
task.title = `Enable 2FA for the organization(s) (${failedOrgs.join(',')})`
task.title = `Enable 2FA for the organization(s) (${failedOrgs.join(', ')})`
task.description = `Check the details on ${check.details_url}`
} else if (unknownOrgs.length) {
result.status = 'unknown'
result.rationale = `The organization(s) (${unknownOrgs.join(',')}) have 2FA status unknown`
result.rationale = `The organization(s) (${unknownOrgs.join(', ')}) have 2FA status unknown`
}
// Include only the task if was populated
if (Object.keys(task).length > Object.keys(baseData).length) {
Expand Down
10 changes: 5 additions & 5 deletions src/checks/validators/noSensitiveInfoInRepositories.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function getRepoFailures (repositories) {

function buildOrgMessage (failedOrgs, unknownOrgs) {
if (failedOrgs.length) {
return `The organization(s) (${failedOrgs.join(',')}) has not enabled secret scanning by default`
return `The organization(s) (${failedOrgs.join(', ')}) has not enabled secret scanning by default`
}
if (unknownOrgs.length) {
return `It was not possible to confirm if the organization(s) has enabled secret scanning for new repositories in the following (${unknownOrgs.join(',')}) organization(s)`
return `It was not possible to confirm if the organization(s) has enabled secret scanning for new repositories in the following (${unknownOrgs.join(', ')}) organization(s)`
}
return 'The organization(s) has secret scanning for new repositories enabled'
}
Expand Down Expand Up @@ -152,16 +152,16 @@ module.exports = ({ data: ghOrgs, check, projects }) => {
projectRepositories.length,
failedRepos.length
)
taskTitle = `Enable secret scanning for new repositories for the organization(s) (${failedOrgs.join(',')}) and ${failedRepos.length} (${percentageOfFailedRepos}) repositories`
taskTitle = `Enable secret scanning for new repositories for the organization(s) (${failedOrgs.join(', ')}) and ${failedRepos.length} (${percentageOfFailedRepos}) repositories`
} else if (failedOrgs.length) {
taskTitle = `Enable secret scanning for new repositories for the organization(s) (${failedOrgs.join(',')})`
taskTitle = `Enable secret scanning for new repositories for the organization(s) (${failedOrgs.join(', ')})`
} else if (failedRepos.length) {
const percentageOfFailedRepos = generatePercentage(
projectRepositories.length,
failedRepos.length
)
// @TODO: The list of failed repos can be very big, so we might need to truncate it or remove it in future releases based on community feedback.
taskTitle = `Enable secret scanning for ${failedRepos.length} (${percentageOfFailedRepos}) repositories (${failedRepos.join(',')}) in GitHub`
taskTitle = `Enable secret scanning for ${failedRepos.length} (${percentageOfFailedRepos}) repositories (${failedRepos.join(', ')}) in GitHub`
}

// Only push if we really have something to do
Expand Down