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

Plugin hosting request for traceable-plugin #3977

Open
dhruv-singhal-github opened this issue Jun 18, 2024 · 34 comments
Open

Plugin hosting request for traceable-plugin #3977

dhruv-singhal-github opened this issue Jun 18, 2024 · 34 comments
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci security-audit-done The hosting request code passed the security audit with success

Comments

@dhruv-singhal-github
Copy link

dhruv-singhal-github commented Jun 18, 2024

Repository URL

https://github.com/Traceableai/traceable-xast-jenkins-plugin

New Repository Name

traceable-plugin

Description

This is a plugin by Traceable AI that helps in API Security Testing by finding vulnerabilities in very early stages, giving developers and Product security engineers more time and context to prioritize mitigation of vulnerabilities and build resilient systems by scanning APIs for vulnerabilities by changing the data in the existing API specifications as required to introduce vulnerabilities.

GitHub users to have commit permission

@dhruv-singhal-github
@samarth-gupta-traceable

Jenkins project users to have release permission

dhruv_singhal
traceableai

Issue tracker

Jira

@dhruv-singhal-github dhruv-singhal-github added the hosting-request Request to host a component in jenkinsci label Jun 18, 2024
Copy link

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.

  • ⛔ Required: The following usernames in 'GitHub Users to Authorize as Committers' are not valid GitHub usernames or are Organizations: dhruv-singhal-github samarth-gupta-traceable

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

@jenkins-cert-app
Copy link
Collaborator

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 a Jenkins Security Scan was triggered on your repository.
It takes ~10 minutes to complete.

Commands

The bot will parse all comments, and it will check if any line start with a command.

Security team only:

  • /audit-ok => the audit is complete, the hosting can continue 🎉.
  • /audit-skip => the audit is not necessary, the hosting can continue 🎉.
  • /audit-findings => the audit reveals some issues that require corrections ✏️.

Anyone:

  • /request-security-scan => the findings from the Jenkins Security Scan were corrected, this command will re-scan your repository 🔍.
  • /audit-review => the findings from the audit were corrected, this command will ping the security team to review the findings 👀. It's only applicable when the previous audit required changes.

Only one command can be requested per comment.

(automatically generated message, version: 1.28.6)

@jenkins-cert-app jenkins-cert-app added the security-audit-todo The security team needs to audit the hosting request code label Jun 18, 2024
Copy link

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

@github-actions github-actions bot added bot-check-complete Automated hosting checks passed and removed needs-fix labels Jun 18, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 7 finding(s) 🔍.

Please follow the instructions below for every identified issues:

  • Implement the recommended fix to address the issue.
  • If you think it's a false positive, suppress the warning directly within the code.
  • Alternative, you write an explanation here about why you think it's irrelevant. That will require a manual review, leading to a slower process.

After addressing the findings through one of the above methods:

  • If all modifications have been made to the code, please initiate a new security scan by triggering the /request-security-scan command.
  • If there are any unresolved findings (those not corrected or suppressed), request a review from the Jenkins security team by using the /audit-review command.

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#30
Field should be reviewed whether it stores a password and is serialized to disk: traceableCliKeyFileName
TraceableASTGenerateReportAction.java#27
Field should be reviewed whether it stores a password and is serialized to disk: clientToken

Jenkins: Generally unsafe method calls

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#63
Potentially unsafe invocation of Runtime#exec
TraceableASTInitAndRunStepBuilder.java#469
Potentially unsafe invocation of Runtime#exec
TraceableASTInitStepBuilder.java#430
Potentially unsafe invocation of Runtime#exec
TraceableASTRunStepBuilder.java#90
Potentially unsafe invocation of Runtime#exec
TraceableApiInspectorStepBuilder.java#104
Potentially unsafe invocation of Runtime#exec

@jenkins-cert-app jenkins-cert-app added security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request and removed security-audit-todo The security team needs to audit the hosting request code labels Jun 18, 2024
@daniel-beck
Copy link
Contributor

daniel-beck commented Jun 18, 2024

All of

Jenkins: Generally unsafe method calls

look like real findings: User input can be used as commands. This plugin also doesn't seem to support distributed builds, but haven't looked closely enough to be sure. I recommend this not be hosted in the current state unless thoroughly reviewed.

@dhruv-singhal-github
Copy link
Author

@daniel-beck do you know the reason for the following check failing?

The following usernames in 'GitHub Users to Authorize as Committers' are not valid GitHub usernames or are Organizations: dhruv-singhal-github samarth-gupta-traceable

Both usernames are valid usernames when you search on github.

@daniel-beck
Copy link
Contributor

Obsolete since Tim edited your comment, see #3977 (comment).

@dhruv-singhal-github
Copy link
Author

/request-security-scan

@jenkins-cert-app jenkins-cert-app added security-audit-todo The security team needs to audit the hosting request code and removed security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Jun 19, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 1 finding(s) 🔍.

Please follow the instructions below for every identified issues:

  • Implement the recommended fix to address the issue.
  • If you think it's a false positive, suppress the warning directly within the code.
  • Alternative, you write an explanation here about why you think it's irrelevant. That will require a manual review, leading to a slower process.

After addressing the findings through one of the above methods:

  • If all modifications have been made to the code, please initiate a new security scan by triggering the /request-security-scan command.
  • If there are any unresolved findings (those not corrected or suppressed), request a review from the Jenkins security team by using the /audit-review command.

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#31
Field should be reviewed whether it stores a password and is serialized to disk: traceableCliKeyFileName

@jenkins-cert-app jenkins-cert-app added security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request and removed security-audit-todo The security team needs to audit the hosting request code labels Jun 19, 2024
@dhruv-singhal-github
Copy link
Author

dhruv-singhal-github commented Jun 19, 2024

@daniel-beck This seems a false positive because this is not the actual cert value but the file name of the cert

@daniel-beck
Copy link
Contributor

daniel-beck commented Jun 19, 2024

because this is not the actual cert value but the file name of the cert

Yep, that one's fine. Suppress the finding, or don't if there are no plans to use the security scan in your repo.

FWIW it's unclear to me why the RunAction2 needs to persist a token that's only used once in #onAttached, that seems unnecessary. I suggest you review what you persist to disk vs. what needs to be persisted.

Replacing Runtime#exec with ProcessBuilder took care of the rudimentary security check, but it still looks like a vulnerability that could allow users with Job/Configure to execute arbitrary code on the controller. https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/8cd9f4b8d983bd42e2cf866741299005d2779bb1/src/main/resources/io/jenkins/plugins/traceable/ast/shell_scripts/api_inspector.sh#L11 looks really concerning.

@dhruv-singhal-github
Copy link
Author

@daniel-beck how do you suggest we solve this, since we do need to run scripts based on parameters from users.

@daniel-beck
Copy link
Contributor

daniel-beck commented Jun 26, 2024

@dhruv-singhal-github First, determine whether they need to run on the controller. Tools generally run on the node that performs other build steps as well, typically an agent. https://www.jenkins.io/redirect/distributed-builds/

If you're absolutely sure it needs to happen on the controller (and not just out of convenience), try the same or similar script without eval. I don't see why that would be needed.

Note that most scripts have a shebang line and this one does not, and those that have it hardcode a path to /bin/bash so I wonder whether all of this works reliably anyway. Most (all?) of these scripts do not appear to do anything you wouldn't be able with Java, so it's unclear what they're needed for anyway.

@dhruv-singhal-github
Copy link
Author

/request-security-scan

@jenkins-cert-app jenkins-cert-app added security-audit-todo The security team needs to audit the hosting request code and removed security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Aug 13, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 6 finding(s) 🔍.

Please follow the instructions below for every identified issues:

  • Implement the recommended fix to address the issue.
  • If you think it's a false positive, suppress the warning directly within the code.
  • Alternative, you write an explanation here about why you think it's irrelevant. That will require a manual review, leading to a slower process.

After addressing the findings through one of the above methods:

  • If all modifications have been made to the code, please initiate a new security scan by triggering the /request-security-scan command.
  • If there are any unresolved findings (those not corrected or suppressed), request a review from the Jenkins security team by using the /audit-review command.

Remoting: Unsafe Callable

You can find detailed information about this finding here.

ApiInspector.java#50
Potentially unsafe Callable implementation ApiInspector#checkRoles
DownloadTraceableCliBinary.java#54
Potentially unsafe Callable implementation DownloadTraceableCliBinary#checkRoles
GenerateReport.java#51
Potentially unsafe Callable implementation GenerateReport#checkRoles
RunScript.java#50
Potentially unsafe Callable implementation RunScript#checkRoles

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#22
Field should be reviewed whether it stores a password and is serialized to disk: traceableCliKeyFileName
TraceableApiInspectorStepBuilder.java#26
Field should be reviewed whether it stores a password and is serialized to disk: traceableToken

@jenkins-cert-app jenkins-cert-app added security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request and removed security-audit-todo The security team needs to audit the hosting request code labels Aug 13, 2024
@dhruv-singhal-github
Copy link
Author

/request-security-scan

@jenkins-cert-app jenkins-cert-app added security-audit-todo The security team needs to audit the hosting request code and removed security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Aug 14, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan did not find anything dangerous with your plugin, congratulations! 🎉


💡 The Security team recommends that you are setting up the scan in your repository by following our guide.

@jenkins-cert-app jenkins-cert-app added security-audit-done The hosting request code passed the security audit with success and removed security-audit-todo The security team needs to audit the hosting request code labels Aug 14, 2024
@dhruv-singhal-github
Copy link
Author

@daniel-beck have made the changes of running the commands on agent rather than on controller, can you please have a look. Thank You!

@mawinter69
Copy link
Contributor

@dhruv-singhal-github
Copy link
Author

@mawinter69 made the changes, can you please review. Thank You.

@mawinter69
Copy link
Contributor

The names you used in the @Symbol annotations are very generic. When people use the snippet generator, I think it is good when already from the name the purpose can be guessed. So instead of scanResult maybe scanTraceableResult or traceableScanResult might be better. Same for the other steps. That generic name also increases the risk of name clashes when another plugin wants to use the same name.

@dhruv-singhal-github
Copy link
Author

Done.

@mawinter69
Copy link
Contributor

/hosting re-check

Copy link

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

@dhruv-singhal-github
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Sep 9, 2024

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

@dhruv-singhal-github
Copy link
Author

@alecharp @slide what further steps do we need to do to host this plugin?

@slide
Copy link
Contributor

slide commented Sep 17, 2024

@alecharp @slide what further steps do we need to do to host this plugin?

I haven't been super active in hosting stuff for a little while, so I will defer to @alecharp and learn the new flow.

@dhruv-singhal-github
Copy link
Author

@alecharp can you explain the first and the last point.

  1. What automatic tests look like can you give an example.
  2. Didn't understand what translations you are talking about , are you referring to .HTML files here?

@dhruv-singhal-github
Copy link
Author

@alecharp made the changes for all the points, just these two are remaining.

@dhruv-singhal-github
Copy link
Author

@alecharp Any updates on this ?

@dhruv-singhal-github
Copy link
Author

@alecharp can we host this plugin if the final iteration looks good?

@timja
Copy link
Member

timja commented Oct 25, 2024

  1. https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/pom.xml#L115 is included in the parent pom, see https://github.com/jenkinsci/plugin-pom/#formatting
  2. developers shouldn't be included in the pom: https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/pom.xml#L24-L29, the data is sourced from this repository
  3. your tag template: https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/.github/release-drafter.yml#L2 doesn't match what you have configured in the pom.xml
  4. your github action (which you should be able to delete) is using Java 11, whereas your Jenkinsfile is 17 and 21, is there a reason for this? https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/.github/workflows/build.yml#L22
  5. As @alecharp suggested either delete this or ideally implement a test: https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/src/test/java/io/jenkins/plugins/traceable/ast/TraceableASTPluginBuilderTest.java
  6. Please write a better description or leave it empty (this shows up in the plugin manager): https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/main/src/main/resources/index.jelly

(I've not ran the code / inspected the code too closely, generally looks ok)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci security-audit-done The hosting request code passed the security audit with success
Projects
None yet
Development

No branches or pull requests

7 participants