I've recently migrated from Snyk Scan pipe to Bitbucket Dependency Scanner, but I'm running into an issue.
I'm using
script: - pipe: atlassian/bitbucket-dependency-scanner:0.5.0 variables: NVD_API_KEY: $NVD_API_KEY EXTRA_ARGS: - "--failOnCVSS=7"
and I expect for it to generate a CodeInsights report when it fails, just like Snyk Scan does, but Bitbucket Dependency Scanner doesn't.
It generates a report only if it succeeds, but I want the pipeline to fail in case a vulnerability needs to be addressed.
Can the code for the pipe be changed to something like
...
try:
process = subprocess.run(
scan_command,
check=True,
text=True,
encoding='utf-8',
capture_output=True
)
except subprocess.CalledProcessError as e:
if e.returncode != 0:
if self.should_create_report:
self.log_info('Generating CodeInsights reports...')
self.create_code_insights_report()
self.fail(message=f'Dependency scan failed. The result status code: {e.returncode}, {e.output} {e.stderr}')
self.log_warning(f' detect result status code: {e.returncode}, {e.output} {e.stderr}')
else:
self.log_info(process.stdout)
if self.should_create_report:
self.log_info('Generating CodeInsights reports...')
self.create_code_insights_report()
...
instead of the current version below?
...
try:
process = subprocess.run(
scan_command,
check=True,
text=True,
encoding='utf-8',
capture_output=True
)
except subprocess.CalledProcessError as e:
if e.returncode != 0:
self.fail(message=f'Dependency scan failed. The result status code: {e.returncode}, {e.output} {e.stderr}')
self.log_warning(f' detect result status code: {e.returncode}, {e.output} {e.stderr}')
else:
self.log_info(process.stdout)
if self.should_create_report:
self.log_info('Generating CodeInsights reports...')
self.create_code_insights_report()
...
I'd open a PR myself to discuss it if it were possible.
Hello @Roberto Schiavone ,
and welcome to the Community!
Thank you very much for the feedback.
I've shared this with the pipe's development team and they have created an internal feature request to implement this functionality.
While this is not available in the official pipe, you have the option to fork the pipe and make your own adjustments/modifications for your use case.
Thank you, @Roberto Schiavone !
Patrik S
Thank you for your feedback!
The new pipe's version with support levels of cvss is released:
- pipe: atlassian/bitbucket-dependency-scanner:0.7.0 variables: NVD_API_KEY: $NVD_API_KEY EXTRA_ARGS: - "--failOnCVSS=7"
Best regards,
Oleksandr Kyrdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.