Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Enforced Scanner Bug #742

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
11 changes: 1 addition & 10 deletions salus-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,4 @@ active_scanners: all
# was necessary to ensure that certain scanners pass.
# Other scanners may need to graduate from the testing phase or
# should only be enforced explicitly by custom configuration.
enforced_scanners:
- RepoNotEmpty
- Brakeman
- BundleAudit
- Gosec
- NPMAudit
- YarnAudit
- PatternSearch
- Semgrep
- CargoAudit
enforced_scanners: []
12 changes: 1 addition & 11 deletions spec/fixtures/processor/local_uri/expected_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,7 @@
"service_name": "buildkite",
"url": "http://example.com/builds/123"
},
"enforced_scanners": [
"Brakeman",
"BundleAudit",
"CargoAudit",
"Gosec",
"NPMAudit",
"PatternSearch",
"RepoNotEmpty",
"Semgrep",
"YarnAudit"
],
"enforced_scanners": [],
"report_uris": [
{
"format": "json",
Expand Down
12 changes: 1 addition & 11 deletions spec/fixtures/processor/remote_uri/expected_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,7 @@
"service_name": "buildkite",
"url": "http://example.com/builds/123"
},
"enforced_scanners": [
"Brakeman",
"BundleAudit",
"CargoAudit",
"Gosec",
"NPMAudit",
"PatternSearch",
"RepoNotEmpty",
"Semgrep",
"YarnAudit"
],
"enforced_scanners": [],
"report_uris": [
{
"format": "json",
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/salus/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
expect(config.project_name).to be_nil
expect(config.custom_info).to be_nil
expect(config.active_scanners).to eq(Set.new(Salus::Config::SCANNERS.keys))
expect(config.enforced_scanners).not_to be_empty
expect(config.enforced_scanners).to be_empty
expect(config.scanner_configs['BundleAudit']).to include('pass_on_raise' => false)
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/lib/salus/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def remove_key(json_string, encoded = false)
'ReportNodeModules',
'ReportRubyGems'
)
expect(reported_config[:enforced_scanners]).not_to be_empty
expect(reported_config[:enforced_scanners]).to be_empty
end
end
end
Expand Down Expand Up @@ -143,14 +143,14 @@ def remove_key(json_string, encoded = false)
it 'should scan the project given by a particular path' do
processor = Salus::Processor.new(repo_path: 'spec/fixtures/processor/explicit_path')
processor.scan_project
expect(processor.passed?).to eq(false)
expect(processor.passed?).to eq(true)

report_hsh = processor.report.to_h

expect(report_hsh[:project_name]).to eq('EVA-01')
expect(report_hsh[:custom_info]).to eq('Purple unit')
expect(report_hsh[:version]).to eq(Salus::VERSION)
expect(report_hsh[:passed]).to eq(false)
expect(report_hsh[:passed]).to eq(true)
expect(report_hsh[:errors]).to eq([])

expect(report_hsh[:scans]['BundleAudit'][:passed]).to eq(false)
Expand Down Expand Up @@ -178,7 +178,7 @@ def remove_key(json_string, encoded = false)
cli_scanners_to_run: %w[Brakeman NPMAudit])
processor.scan_project

expect(processor.passed?).to eq(false)
expect(processor.passed?).to eq(true)

report_hsh = processor.report.to_h

Expand All @@ -189,7 +189,7 @@ def remove_key(json_string, encoded = false)
expect(report_hsh[:project_name]).to eq('EVA-01')
expect(report_hsh[:custom_info]).to eq('Purple unit')
expect(report_hsh[:version]).to eq(Salus::VERSION)
expect(report_hsh[:passed]).to eq(false)
expect(report_hsh[:passed]).to eq(true)
expect(report_hsh[:errors]).to eq([])

expect(report_hsh[:scans]['Brakeman'][:passed]).to eq(false)
Expand Down