Commit Graph
819 Commits
Author SHA1 Message Date
Larry Singleton 8e78ab1c66 [JENKINS-48227] Use "Files.createTempDirectory" to create temp directory (#3161)
* Use "Files.createTempDirectory" to create temp directory instead
See SonarQube critical vulnerability squid:S2976 (tag: owasp-a9)
https://next.sonarqube.com/sonarqube/coding_rules#rule_key=squid%3AS2976

* [JENKINS-48227]
Creating a utility "static Path toPath(File file) throws IOException" method,
which wraps InvalidPathException to IOException so that it will be checked.
- also fixed public static final reference
- fixed broken test cases
- added new test cases for toPath() and createTempDir()

* Revert back to public static int

* adjustments due to merges

* Add posix check to determine if Posix FileAttributes should be included
in call to Files.createTempDirectory()

* Remove reference to private element

* Updated to use explicit imports
2017-12-22 17:38:57 +01:00
Devin Nusbaum 1270ba3b40 [JENKINS-48405] Use NIO in tryOnceDeleteFile and makeWritable (#3169)
* Use NIO in tryOnceDeleteFile and makeWritable

* Don't try to set PosixFileAttributes on Windows

* Do not create arbitrary exceptions in makeWritable to fix test failures on Windows

* Remove unhelpful layer of exception wrapping

* Add test exercising Util#makeWritable in Util#tryOnceDeleteFile

* Add test for deleting a non-existant file

* Return early if changing permissions with NIO succeeds
2017-12-16 09:23:41 +01:00
Jesse Glick d6dfd42a47 TextFileTest 2017-12-08 18:15:28 -05:00
Jesse Glick 9b419100af AtmostOneTaskExecutorTest 2017-12-08 15:59:31 -05:00
Jesse Glick a8251f66d5 RSADigitalSignatureConfidentialKeyTest 2017-12-08 15:51:44 -05:00
Jesse Glick 046fca7e2f RSAConfidentialKeyTest 2017-12-08 15:49:41 -05:00
Jesse Glick 3982680022 HexStringConfidentialKeyTest 2017-12-08 15:46:17 -05:00
Jesse Glick 1cad7b5ff2 HMACConfidentialKeyTest 2017-12-08 14:00:05 -05:00
Jesse Glick 5d7ea02e57 DefaultConfidentialStoreTest 2017-12-08 13:31:54 -05:00
Jesse Glick 27c83f9c4f CryptoConfidentialKeyTest 2017-12-08 13:25:49 -05:00
Jesse Glick 5b0cca7705 SecretTest 2017-12-08 13:19:33 -05:00
Jesse Glick dbdcaaf36b SecretRewriterTest 2017-12-08 13:01:47 -05:00
Baptiste Mathus 616a62aab4 Merge pull request #3165 from batmat/JENKINS-34855-more-AtomicFileWriter-harnessing
[JENKINS-34855] more AtomicFileWriter test harnessing
2017-12-01 23:49:38 +01:00
Devin Nusbaum fdccc0e838 [JENKINS-36088] Use NIO implementations of chmod and mode by default (#3135)
* Use NIO for FilePath#chmod and IOUtils#mode

* Add tests for NIO mode and chmod implementations

* Add test, remove new method, and update JavaDoc

* Provide system property to use native implementations of chmod and mode

* Revert unrelated whitespace modification

* Don't remove exception from throws and put imports in original location

* Fix broken JavaDoc links

* Ignore file type bits (above 0o7777) in Util#modeToPermission

* Use octal for constants and don't include file type bits

* Revert unnecessary changes to TarArchiverTest

* Add assertion that non-permission bits are ignored by chmod

* Use NIO copy with StandardCopyOption.COPY_ATTRIBUTES in copyToWithPermissions where possible

* Catch InvalidPathException and convert it to IOException

* Create utility method for File#toPath and use File#createDirectories after review

* Remove useless calls to toAbsolutePath and getAbsoluteFile

* Fix typos and use octal for constant after review

* Add test for behavior of copyToWithPermission with special bits
2017-12-01 10:01:34 +03:00
Baptiste Mathus b32bc8d277 Merge pull request #2548 from christ66/JENKINS-34855
[JENKINS-34855] AtomicFileWriter is not Atomic
2017-11-29 15:45:57 +01:00
Baptiste Mathus 0437c31a6d More coverage around AtomicFileWriter behaviour 2017-11-29 15:04:52 +01:00
Baptiste Mathus 4f2e261505 Be more defensive if provided destPath is wrong
The path could already exist, *but* not be a directory.
Nice catch James.

Associated tests.
2017-11-28 23:18:18 +01:00
Jesse Glick 5f8f42624e Introducing ItemGroup.allItems and similar default methods (#3148)
* Introducing ItemGroup.allItems and similar default methods.

* Do not get me started.
2017-11-28 12:28:50 +03:00
Baptiste Mathus 3e7d4ea978 Merge remote-tracking branch 'upstream/master' into JENKINS-34855
# Conflicts:
#	core/src/main/java/hudson/util/AtomicFileWriter.java
2017-11-21 00:41:37 +01:00
Baptiste Mathus dcd800f256 Force line break 2017-11-20 15:55:44 +01:00
Devin Nusbaum 52fa4d90b9 [JENKINS-39179] [JENKINS-36088] Always use NIO to create and detect symbolic links and Windows junctions (#3133)
* Always use NIO to detect symlinks

* Make assertion failure message consistent

* Catch NoSuchFileException to keep tests passing

* Make method name more specific and simlify assumption

* Remove obsolete comment and reword the main comment in isSymlink

* Deprecate Kernel32Util#isJunctionOrSymlink

* Use assumptions for junction creation and add messages to assumptions

* Replace deprecated code with recommended alternative

* Add comment explaining call to DosFileAttributes#isOther

* Do not fall back to native code when creating symlinks

* Log FileSystemExceptions when creating symbolic links

* Catch InvalidPathException and rethrow as IOException

* Deprecate Kernel32Utils#createSymbolicLink and #getWin32FileAttributes

* Preserve original logging behavior on Windows and remove useless call to Util#displayIOException
2017-11-16 17:08:10 +01:00
Jesse Glick b6751222ba [JENKINS-47909] Handle false hex escapes. 2017-11-09 12:15:23 -05:00
Jesse Glick 08d50a929a Merge commit '048e313aa95844e2366a0611192415abbcf4b5ee' into security-master 2017-11-06 07:13:57 -05:00
Oleg Nenashev 5bcf35b1d4 Merge pull request #3086 from tinexw/JENKINS-6290-TransientViewActionFactory
[JENKINS-6290] Add New View link to sidebar
2017-11-04 10:17:09 +01:00
Jesse Glick 209a5ad1a5 Merge commit 'c2aca606e3dc45384c38785e1ced4780733bd906' into security-master 2017-10-30 10:18:02 -04:00
Antonio Muniz f546ffc9ea [JENKINS-44851] Agents JVM must be 1.8+ now (#2915)
* [JENKINS-44851] Agents JVM must be 1.8+ now

* [JENKINS-44851] Fix tests

* Fix old Java 6 and 7 tests (an exception is expected now)
* Add new tests to Java 8
* Fix messages
2017-10-28 12:53:39 +02:00
Jesse Glick f266a7f6aa Merge commit '790068c8486cdd4741336f9d61de72a9a6537a30' into security-master 2017-10-23 09:09:19 -04:00
Emilio Escobar a82c4fcc51 [JENKINS-47500] Secret.decrypt launches ArrayIndexOutOfBoundsException when data is "{}" (#3097)
* [JENKINS-47500] unit test for JENKINS-47500 bug

* [JENKINS-47500] return null when the data is just {}

* [JENKINS-47500] added more cases
2017-10-22 00:03:45 +02:00
Jesse Glick 19714f2018 Deprecate isBuildBlocked & getWhyBlocked in favor of getCauseOfBlockage, which you needed to implement anyway. 2017-10-19 13:06:35 -04:00
Jesse Glick a9246c2887 Merge branch 'security-stable-2.73' into security-master 2017-10-19 12:28:51 -04:00
Jesse Glick a2491e323b Merge branch 'security-stable-2.60' into security-stable-2.73 2017-10-19 12:28:07 -04:00
Jesse Glick 87b7ba7d31 Merge branch 'security-stable-2.46' into security-stable-2.60 2017-10-19 12:19:45 -04:00
Rebecca Ysteboe 566a8ddb88 [SECURITY-499] Sanitize user id <-> filename conversion 2017-10-19 12:14:51 -04:00
tinexw 1242889f8e [JENKINS-6290] Add New View link to sidebar 2017-10-15 21:59:07 +02:00
Jon ce2d0f97bd [JENKINS-46759] Fixed bug in build queue filtering for views (#3008)
* [JENKINS-46759] Fixed bug related to views which filters build queue, jobs which has multiple sub steps were filtered incorrectly.

* Added test case for build queue filtering in views.

* [JENKINS-46759] Improved code based on feedback from PR; Fixed logic bug, moved logic to separate method and added limit to number of iteration when looking for owner task.
2017-10-14 11:49:22 +02:00
Baptiste Mathus 61016e1a84 Add @Issue to reference JENKINS-44052 2017-10-01 13:29:17 +02:00
Baptiste Mathus ff36adf0d2 [JENKINS-44052] Document & fix intended behaviour (#3043)
* [JENKINS-44052] Document & fix intended behaviour

The unit was actually ignored...

* Add tests for getTimeInSeconds
2017-10-01 12:54:22 +03:00
Robert Sandell 3adfed4b06 [JENKINS-44657] Move sub-job's buildsdir when outside of itemrootdir (#2932)
* A test to verify JENKINS-44657 is working in core

* [JENKINS-44657] Move sub-job's buildsdir when outside of itemrootdir.

* [JENKINS-44657] Fix UsageStatisticsTest

Because we've added a test dependency that affects it.

* [JENKINS-44657] Normalize the path before comparing

* [JENKINS-44657] Use MockFolder instead of folders-plugin

for tests

* [JENKINS-44657] Document and annotate isDefaultBuildDir

* [JENKINS-44657] isDescendant doesn't throw IOException any more

* [JENKINS-44657] catch InvalidPathException and rethrow as IOException
2017-09-23 22:59:39 +03:00
Oliver Gondža dbb5e443b9 [JENKINS-46680] Disconnect computer on ping timeout (#3005)
* [JENKINS-46680] Reproduce in unittest

* [FIX JENKINS-46680] Reset SlaveComputer channel before closing it on ping timeout

* [JENKINS-46680] Attach channel termination offline cause on ping timeouts
2017-09-15 18:44:50 +02:00
Jesse Glick b3e2ed8a37 [JENKINS-29537] Merged #2993: amended EnvironmentContributingAction signature. 2017-08-25 14:28:24 -04:00
Akbashev Alexander c60735a124 [JENKINS-29537] EnvironmentContributingAction compatible with Workflow (#2975)
* [JENKINS-29537] EnvironmentContributingAction compatible with Workflow

+ Adds new method with default implementation in EnvironmentContributingAction to support Runs
+ Marks AbstractBuild as deprecated
+ Adds default implementation for deprecated method for backward
compatiblity.

* Tiny improvements in javadoc
2017-08-22 10:33:10 +02:00
Nikolas Falco bb86f57242 [JENKINS-14807] Fix path separator when EnvVars overrides variable like
PATH+XYZ

The getEnvironment(Node, TaskListener) now returns an environment setup
correctly with the platform value of the computer node where the job is
executed.

(cherry picked from commit cf0183d1ed)
2017-08-03 09:29:34 +02:00
Nikolas Falco cf0183d1ed [JENKINS-14807] Fix path separator when EnvVars overrides variable like
PATH+XYZ

The getEnvironment(Node, TaskListener) now returns an environment setup
correctly with the platform value of the computer node where the job is
executed.
2017-07-10 13:51:30 +02:00
Oleg Nenashev e7cdd6517c [JENKINS-39370] - Update Remoting in Jenkins core to 3.10 (#2886)
* Update Remoting in Jenkins core to 3.8

* JENKINS-39370 - Introduce support of Work Directories in remoting (opt-in).
* PR 129 - Allow configuring java.util.logging settings via a property file (-loggingConfig or JUL system property). See the Logging page for more details.
* JENKINS-37567 - Change of the code signing certificate

More info: https://github.com/jenkinsci/remoting/blob/master/CHANGELOG.md#38

* [JENKINS-39370] - Add direct tests for JNLP Launcher start with -workDir

* Pick Remoting 3.9

* Improve error message of LauncherTest#remoteKill()

* Update Remoting to 3.10
2017-07-01 07:54:48 +02:00
Jesse Glick d13b1361e1 Adding some interface default method implementations (#2879)
* Adding some interface default method implementations rather than catching AbstractMethodError or providing partial implementation classes.

* Show Javadoc warnings and errors, but not ‘Generating …/core/target/site/apidocs/jenkins/model/lazy/class-use/AbstractLazyLoadRunMap.html...’ and the like.

* Javadoc fixes.

* Review comments from @oleg-nenashev.

* Test fixes.

* Remove the unused import
2017-05-20 12:32:52 +02:00
Oliver Gondža 6f44ff7dee [FIXED JENKINS-43279] Make sure Cloud.PROVISION is properly initialized
(cherry picked from commit d35dfcb24f)
2017-05-02 15:05:32 +02:00
Daniel Beck f7075e6077 Merge branch 'security-stable-2.46' into security-master 2017-04-16 23:01:34 +02:00
Daniel Beck 59ec129068 Merge branch 'security-stable-2.32' into security-stable-2.46 2017-04-16 22:52:09 +02:00
Daniel Beck 7a764161c5 Merge branch 'security-stable-2.19' into security-stable-2.32 2017-04-16 22:46:29 +02:00
Daniel Beck 48b68bee14 Merge branch 'security-stable-2.7' into security-stable-2.19 2017-04-16 22:38:32 +02:00