jenkins-infra / repository-permissions-updater

Artifactory permissions synchronization tool and data set
77 stars 1.04k forks source link

Qualys IaC Security Plugin Hosting #2931

Closed hdhaygude closed 1 year ago

hdhaygude commented 1 year ago

Repository URL

https://github.com/QIntegration/qualys-iac-security-plugin

New Repository Name

qualys-iac-security-plugin

Description

The Qualys IaC Security plugin will scan repository files and find any misconfiguration in file, It also suggest remediation regarding those misconfigurations. After scanning is done it generates report in html format

GitHub users to have commit permission

@pmgupte @hdhaygude

Jenkins project users to have release permission

qualys

Issue tracker

GitHub issues

jenkins-cert-app commented 1 year ago

Security audit, information and commands

The security team is auditing all the hosting requests, to ensure a better security by default. This message informs you that the security team was notified about the request and will soon participate in this issue to assist. The team is usually starting by a quick superficial audit and if it's not sufficient, they are planning a deeper audit.

Commands Security team only:
  • /audit-ok => the audit is complete, the hosting can continue :tada:.
  • /audit-skip => the audit is not necessary, the hosting can continue :tada:.
  • /audit-required => the superficial audit was not sufficient, a deeper look is necessary :mag:.
  • /audit-findings => the audit reveals some issues that require corrections :pencil2:.
Anyone:
  • /audit-review => the findings from the audits were corrected, this command will ping the security team to review the findings :eyes:. It's only applicable when the previous audit required changes.
Only one command can be requested per comment.

(automatically generated message)

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

yaroslavafenkin commented 1 year ago

Jenkins CERT will have a deeper look, tracked internally as JENSEC-1910.

yaroslavafenkin commented 1 year ago

/audit-required

yaroslavafenkin commented 1 year ago

Hi @hdhaygude,

Please address these issues and let me know when you're done, so I can have another look. In case of questions regarding findings feel free to ask.

yaroslavafenkin commented 1 year ago

/audit-findings

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

NotMyFault commented 1 year ago

Hey @hdhaygude,

a few things I'd like to highlight additionally to the security review:

alecharp commented 1 year ago

few comments on the plugin configuration:

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

hdhaygude commented 1 year ago

/hosting re-check

hdhaygude commented 1 year ago

Hi @yaroslavafenkin

  1. XSS Security: Do we need to use front end technology to bind table rows, any idea how to escape and append those html on UI ?
  2. Zip slip vulnerability: currently in our plugin we are extracting zip entered by user in tmp directory which we will get using System.getProperty("java.io.tmpdir"), we are uploading those extracted folder, do you know how to handle zip slip vulnerability ?
  3. CSRF attack: In jenkins by default csrf protection enabled, do you know how to handle csrf attack ?
yaroslavafenkin commented 1 year ago

Hi @hdhaygude,

hdhaygude commented 1 year ago

Hi All, @NotMyFault @yaroslavafenkin @alecharp I have done changes suggested by you, please check this pull request and give approval. https://github.com/QIntegration/qualys-iac-security-plugin/pull/1/files

NotMyFault commented 1 year ago

I've crossed out points on alecharp's and my list that you've addressed, and left open what is to address still.

hdhaygude commented 1 year ago

@NotMyFault currently Ionic icons not displaying on jelly page that is remaining, after approval I will merge to master,

yaroslavafenkin commented 1 year ago

@hdhaygude, I've also crossed out the points that are addressed on my list.

hdhaygude commented 1 year ago

Hi @yaroslavafenkin

  1. Added permission check code in TemplateScanBuilder.java line no 309 and TemplateScanBuildStep.java line no 207
  2. building html in secure way now in report.js
  3. Zip slip vulnerability will not occur because extract location is unique each time like in windows %temp%/{GUID}/ or in linux /tmp/{GUID}, you can check comment in Util.java at line no 78
hdhaygude commented 1 year ago

Hi @NotMyFault

  1. Removed tag from pom.xml
  2. Moved classes to package suggested by you
hdhaygude commented 1 year ago

@yaroslavafenkin , @NotMyFault cross out points if they are done.

yaroslavafenkin commented 1 year ago

I've had another look, none of the issues are addressed.

Zip slip is currently (as of https://github.com/QIntegration/qualys-iac-security-plugin/tree/c44bfb489cae1df02738b38e069df9f7df2de726) partially mitigated by never extracting content of zip archive. This will always be false, because you're creating a directory before the method is called here. I expect you'd want to fix that. Otherwise I don't see any signs that extraction of archive contents outside of target directory is prevented.

Also if that helps for XSS I'm using https://github.com/yaroslavafenkin/qualys-iac-sec-mock to mock responses from qualys server.

hdhaygude commented 1 year ago

@yaroslavafenkin

  1. Added validation code for zip slip as per suggested by snyk.io
  2. Added permission related check please check now
yaroslavafenkin commented 1 year ago

Zip slip seems to be correctly addressed now.

https://github.com/QIntegration/qualys-iac-security-plugin/blob/3508f9cfe561de94de39ab44dbc27e74fe374753/src/main/java/io/qualys/iac/jenkins/TemplateScanBuilder.java#L317 still missing a permission check. Also it seems wrong that method takes absolute path and returns information whether files or folders exist in the file system. Consider limiting it to workspace only.

hdhaygude commented 1 year ago

Hi @yaroslavafenkin

  1. Added permission check code and yes only limiting user to add path from workspace only, in case of user specifies only folder then concating workspace path and foldername and checking if folder or file exist or not
yaroslavafenkin commented 1 year ago

Permission checks are fine now.

XSS is still to be addressed. If you need more details about reproduction steps please let me know.

hdhaygude commented 1 year ago

@yaroslavafenkin

  1. Added fix for XSS moved html creation code from javascript to jelly tags creating html using jelly foreach loop, please check cross out point
hdhaygude commented 1 year ago

@yaroslavafenkin please approve XSS fix and cross out XSS point

NotMyFault commented 1 year ago

/audit-review


Patience is key.

yaroslavafenkin commented 1 year ago

Had another look, seems fine now, cannot reproduce XSS anymore.

yaroslavafenkin commented 1 year ago

/audit-ok

NotMyFault commented 1 year ago

/hosting re-check


The open findings from https://github.com/jenkins-infra/repository-permissions-updater/issues/2931#issuecomment-1318380597 are still to address, like the open findings by the hosting bot.

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

hdhaygude commented 1 year ago

/hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

hdhaygude commented 1 year ago

/hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

hdhaygude commented 1 year ago

/hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

github-actions[bot] commented 1 year ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check