Skip to content

Commit 46f52ab

Browse files
authored
Merge pull request #540 from jtnord/remove-FileOnMaster-and-SECURITY-1322-migration
Remove FileOnMasterKeyStroreSource and SECURITY-1322 migration
2 parents 046204d + 74c696b commit 46f52ab

File tree

13 files changed

+3
-442
lines changed

13 files changed

+3
-442
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@
169169
</goals>
170170
</execution>
171171
</executions>
172+
<configuration>
173+
<compatibleSinceVersion>1354</compatibleSinceVersion>
174+
</configuration>
172175
</plugin>
173176
<plugin>
174177
<groupId>org.antlr</groupId>

src/main/java/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl.java

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@
3737
import hudson.util.FormValidation;
3838
import hudson.util.Secret;
3939
import java.io.ByteArrayInputStream;
40-
import java.io.File;
4140
import java.io.IOException;
4241
import java.io.ObjectStreamException;
4342
import java.io.Serializable;
4443
import java.nio.charset.StandardCharsets;
45-
import java.nio.file.Files;
46-
import java.nio.file.InvalidPathException;
47-
import java.nio.file.Paths;
4844
import java.security.KeyStore;
4945
import java.security.KeyStoreException;
5046
import java.security.NoSuchAlgorithmException;
@@ -58,7 +54,6 @@
5854
import java.util.logging.LogRecord;
5955
import java.util.logging.Logger;
6056

61-
import jenkins.model.Jenkins;
6257
import net.jcip.annotations.GuardedBy;
6358
import org.apache.commons.fileupload.FileItem;
6459
import org.apache.commons.lang.StringUtils;
@@ -335,72 +330,6 @@ protected static FormValidation validateCertificateKeystore(String type, byte[]
335330
}
336331
}
337332

338-
/**
339-
* Let the user reference a file on the disk.
340-
* @deprecated This approach has security vulnerabilities and should be migrated to {@link UploadedKeyStoreSource}
341-
*/
342-
@Deprecated
343-
public static class FileOnMasterKeyStoreSource extends KeyStoreSource {
344-
345-
/**
346-
* Our logger.
347-
*/
348-
private static final Logger LOGGER = Logger.getLogger(FileOnMasterKeyStoreSource.class.getName());
349-
350-
/**
351-
* The path of the file on the controller.
352-
*/
353-
private final String keyStoreFile;
354-
355-
public FileOnMasterKeyStoreSource(String keyStoreFile) {
356-
this.keyStoreFile = keyStoreFile;
357-
}
358-
359-
/**
360-
* {@inheritDoc}
361-
*/
362-
@NonNull
363-
@Override
364-
public byte[] getKeyStoreBytes() {
365-
try {
366-
return Files.readAllBytes(Paths.get(keyStoreFile));
367-
} catch (IOException | InvalidPathException e) {
368-
LOGGER.log(Level.WARNING, "Could not read private key file " + keyStoreFile, e);
369-
return new byte[0];
370-
}
371-
}
372-
373-
/**
374-
* {@inheritDoc}
375-
*/
376-
@Override
377-
public long getKeyStoreLastModified() {
378-
return new File(keyStoreFile).lastModified();
379-
}
380-
381-
/**
382-
* {@inheritDoc}
383-
*/
384-
@Override
385-
public String toString() {
386-
return "FileOnMasterKeyStoreSource{" +
387-
"keyStoreFile='" + keyStoreFile + '\'' +
388-
"}";
389-
}
390-
391-
private Object readResolve() {
392-
if (!Jenkins.get().hasPermission(Jenkins.RUN_SCRIPTS)) {
393-
LOGGER.warning("SECURITY-1322: Permission failure migrating FileOnMasterKeyStoreSource to UploadedKeyStoreSource for a Certificate. An administrator may need to perform the migration.");
394-
Jenkins.get().checkPermission(Jenkins.RUN_SCRIPTS);
395-
}
396-
397-
LOGGER.log(Level.INFO, "SECURITY-1322: Migrating FileOnMasterKeyStoreSource to UploadedKeyStoreSource. The containing item may need to be saved to complete the migration.");
398-
SecretBytes secretBytes = SecretBytes.fromBytes(getKeyStoreBytes());
399-
return new UploadedKeyStoreSource(secretBytes);
400-
}
401-
402-
}
403-
404333
/**
405334
* Let the user reference an uploaded file.
406335
*/

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/config.jelly

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/config_de.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/config_fr.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/config_it.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/config_ja.properties

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/help-keyStoreFile.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/help-keyStoreFile_fr.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/main/resources/com/cloudbees/plugins/credentials/impl/CertificateCredentialsImpl/FileOnMasterKeyStoreSource/help-keyStoreFile_it.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)