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 · 13 comments
Open

Plugin hosting request for traceable-plugin #3977

dhruv-singhal-github opened this issue Jun 18, 2024 · 13 comments
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request

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.

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-needs-correction The security audit revealed issues that must be corrected from the hosting request
Projects
None yet
Development

No branches or pull requests

3 participants