-
Notifications
You must be signed in to change notification settings - Fork 66
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
[JENKINS-73408] Ensure keys are FIPS compliant when running in FIPS mode, core requirement bump to 2.426.3 #210
Conversation
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
Can you add the FormValidation as if it did work (ie the upstream bugs where not present). You can test the basis of this by temproarily swapping the This means the validation would then "Just work" when run on a core with fixes and no extra work would be needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testing and the bc-fips dependency are conflicting. the BouncyCastleProvider would not be available at all in FIPS mode.
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
...t/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKeyFIPSTest.java
Outdated
Show resolved
Hide resolved
Removed the test dependency, now using bouncycastle-api only |
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
…l/BasicSSHUserPrivateKey.java Co-authored-by: Francisco Javier Fernandez <31063239+fcojfernandez@users.noreply.github.com>
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
.../plugins/sshcredentials/impl/BasicSSHUserPrivateKey/DirectEntryPrivateKeySource/config.jelly
Outdated
Show resolved
Hide resolved
src/main/resources/com/cloudbees/jenkins/plugins/sshcredentials/impl/Messages.properties
Show resolved
Hide resolved
…l/BasicSSHUserPrivateKey.java Co-authored-by: James Nord <jtnord@users.noreply.github.com>
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Show resolved
Hide resolved
…l/BasicSSHUserPrivateKey.java Co-authored-by: James Nord <jtnord@users.noreply.github.com>
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java
Outdated
Show resolved
Hide resolved
diff --git a/pom.xml b/pom.xml
index 831b562..7d58ca5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,8 +92,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
- <artifactId>bom-2.387.x</artifactId>
- <version>2543.vfb_1a_5fb_9496d</version>
+ <artifactId>bom-2.426.x</artifactId>
+ <version>3208.vb_21177d4b_cd9</version>
<scope>import</scope>
<type>pom</type>
</dependency>
|
@@ -71,7 +71,7 @@ | |||
|
|||
<properties> | |||
<changelist>999999-SNAPSHOT</changelist> | |||
<jenkins.version>2.387.3</jenkins.version> | |||
<jenkins.version>2.426.3</jenkins.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core bumps should also update the BOM artifactId
: #210 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right. we might need something to check this automatically rather than relying on human check. maybe an enforcer rule could do the job here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easiest way that is done in a few plugins is to use variables, e.g.:
https://github.com/jenkinsci/junit-plugin/blob/85201a38881e5811c8632b610d8d655f161db103/pom.xml#L18
https://github.com/jenkinsci/junit-plugin/blob/85201a38881e5811c8632b610d8d655f161db103/pom.xml#L194
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</f:entry> | ||
<script><![CDATA[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new script blocks shouldn't be introduced: https://www.jenkins.io/doc/developer/security/csp/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://issues.jenkins.io/browse/JENKINS-73408
Added checks to make sure provided SSH keys are accepted for FIPS 140.2.
Change should be transparent if not running in FIPS mode.
When provided key is not compliant an exception will be logged and thrown. Checks are done in the constructor and in
readResolve
, so invalid new keys won't be added and existing ones will be removed on startup. This also covers jcasc scenario.Also, had to bump jenkins version to
2.426.3
as this needsFIPS140
.Form validation has been added, but as https://issues.jenkins.io/browse/JENKINS-73404 is needed for it to work in
secretTextArea
.This has an unwanted side effect: creating a credential with an invalid key in FIPS mode will show an angry jenkins (and obviously, credential won't be saved). Validation was added to at least inform the user saving won't be right.
Testing done
Added 3 unit tests.
Also, tested manually, behaviour is the expected.
Attaching snapshots of form validation (won't be appearing after moving back to
secretTextArea
). Updated just one snapshot, when there's an original exception (normally raised by bouncycastle) we're attaching the original exception to formvalidation results.Submitter checklist