Commit Graph
349 Commits
Author SHA1 Message Date
Matt Sicker 59880c2fcd Add path filter support to PathRemover
This allows for simplifying FilePath to use PathRemover rather than duplicating logic.

Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-10 13:40:17 -06:00
Matt Sicker c05d00ad69 Update FilePath.delete* to use Util.delete*
This reduces duplication of file deletion strategy code and potentially fixes a regression noted in JENKINS-55448.

Signed-off-by: Matt Sicker <boards@gmail.com>
2019-01-10 11:00:54 -06:00
Wadeck Follonier 87cba3d730 Remove windows specific paths 2018-12-10 11:05:49 +01:00
Wadeck Follonier 9e8df1aebc Use different approach for relativize two paths due to Java 11 2018-12-10 10:47:19 +01:00
Daniel Beck 69eacee964 Merge branch 'security-stable-2.138' into security-stable-2.150 2018-11-21 14:25:44 +01:00
Daniel Beck 23ea44f9ae Merge branch 'security-stable-2.121' into security-stable-2.138 2018-11-21 14:22:28 +01:00
Daniel Beck 748e2f326e Merge branch 'security-stable-2.107' into security-stable-2.121 2018-11-21 13:52:38 +01:00
Wadeck Follonier c19cc70568 [SECURITY-904] 2018-11-21 13:41:15 +01:00
Daniel Beck ef5e4a0145 Merge commit 'edd303e91747380043723c1b4c7dc843b91afa51' into security-master 2018-10-08 08:16:41 +02:00
Daniel Beck 5ddb847d2a Merge branch 'security-stable-2.138' into security-master 2018-09-27 15:26:44 +02:00
Daniel Beck 9c97530127 Merge branch 'security-stable-2.121' into security-stable-2.138 2018-09-27 15:24:46 +02:00
Daniel Beck 7553c7085e Merge branch 'security-stable-2.107' into security-stable-2.121 2018-09-27 15:22:01 +02:00
Daniel Beck dc1f162afb Merge branch 'security-stable-2.89' into security-stable-2.107 2018-09-27 15:13:29 +02:00
Daniel Beck 5ed93548f8 Merge branch 'security-stable-2.73' into security-stable-2.89 2018-09-27 15:02:34 +02:00
Wadeck Follonier c3351d2e7c [SECURITY-1074] 2018-09-27 11:31:06 +02:00
Oleg Nenashev 8598492f19 Ignored Exceptions: use ‘ignored’ to supress IntellijIDEA warnings as suggested by @daniel-beck 2018-09-27 01:23:28 +02:00
Oleg Nenashev a3cc7780aa JDK11 support: refactor code to avoid underscore variable names 2018-09-21 16:47:59 -07:00
Daniel Beck 323982abd7 Merge branch 'security-stable-2.121' into security-master 2018-08-01 17:34:32 +02:00
Daniel Beck f42fe0fc63 [JENKINS-51777] Don't let tar entries escape target dir
(cherry picked from commit 7438abb88f)
2018-08-01 09:51:06 +02:00
Oliver Gondža 4cb86a5c30 [FIXED JENKINS-52417] Restrict Beta API removed in weekly: FilePath.copyFromRemotely() 2018-08-01 09:33:31 +02:00
Jesse Glick 1cac1b7a41 [JENKINS-52417] Javadoc clarifications now that INFRA-1600 is cleared up. 2018-07-15 09:53:38 -04:00
Zbynek Konecny af6dc33ff4 [JENKINS-52325] - If copy of artifact with attributes throws error, retry without attributes (#3537)
[JENKINS-52325] - If copy of artifact with attributes throws error, retry without attributes
2018-07-13 13:53:49 +03:00
Jesse Glick 3a0c2220d4 [JENKINS-52417] - Removing FilePath.copyFromRemotely (#3480)
[JENKINS-52417] - Removing FilePath.copyFromRemotely
2018-07-07 11:53:12 +02:00
Oleg Nenashev 1afd9f8c6e Merge pull request #3482 from daniel-beck/zip-slip-tar
[JENKINS-51777] Don't let tar entries escape target dir
2018-06-09 18:00:47 +02:00
Daniel Beck 7438abb88f [JENKINS-51777] Don't let tar entries escape target dir 2018-06-08 12:20:39 +02:00
Oliver Gondža d333057442 [FIX JENKINS-51082] Avoid attaching calling stacktrace as that is done by Channel already (#3417)
(cherry picked from commit 0e5fc86f4f)
2018-06-07 08:36:27 +02:00
Oliver Gondža 0e5fc86f4f [FIX JENKINS-51082] Avoid attaching calling stacktrace as that is done by Channel already (#3417) 2018-06-01 20:04:22 +02:00
Jesse Glick 63fa1785eb Converting remaining anonymous Callable and FileCallable implementations to named classes. (#3437) 2018-06-01 19:40:30 +02:00
Daniel Beck ee96b71b36 Fix an at-since 2.119 typo 2018-05-15 12:14:20 +02:00
Daniel Beck e992e1153b Merge commit '7250d8b875366ae90fa6aec13b5a5c86720e23a3' into security-master 2018-05-07 14:12:09 +02:00
aviadatsnyk 8ede53387e [JENKINS-32778] - Prevent extracting archived plugins outside of target path (#3402) 2018-05-05 14:32:34 +02:00
Matt Sicker e229f37dd9 JENKINS-13128: Preserve copied file permissions and mtime (#3400)
* JENKINS-13128: Preserve copied file permissions and mtime

This fixes a bug where files copied locally do not preserve file permissions or last modification time.

* Use IO utility methods for exception handling

* Fix invalid path exception propagation

* Revert hudson.Util
2018-05-04 15:36:33 -04:00
Daniel Beck 6e037bfa39 Cleanup since Javadoc tags 2018-04-26 17:21:30 +02:00
Daniel Beck c5497c9a57 Merge branch 'security-stable-2.107' into security-master 2018-04-26 01:49:42 +02:00
Daniel Beck 7e6c0637b1 Merge branch 'security-stable-2.89' into security-stable-2.107 2018-04-26 01:20:01 +02:00
Daniel Beck f73b827973 Merge branch 'security-stable-2.73' into security-stable-2.89 2018-04-26 00:37:06 +02:00
Wadeck Follonier 5cf0a77d44 [SECURITY-788] 2018-04-25 23:42:19 +02:00
Jesse Glick 547fd6fe6e Removing VirtualFile.asRemotable in favor of toExternalURL. 2018-04-02 15:55:40 -04:00
Jesse Glick 7b9a3e4448 [JENKINS-50237] Pick up Remoting with automatic ProxyException; and avoid BuildException to begin with. 2018-03-19 16:57:15 -04:00
Jesse Glick 8492421ce1 FilePath.exists is apparently called from LogRecorderManagerTest.loggingOnSlaves (though I cannot reproduce this). 2018-03-09 15:03:33 -05:00
Jesse Glick 73b16084f9 [JENKINS-49994] Warn about Remoting serialization of anonymous inner classes and their ilk. 2018-03-07 14:52:34 -05:00
Oleg Nenashev e5fd7b7c90 Merge pull request #3265 from jglick/simple-build-steps-should-be-simple-JENKINS-47142
[JENKINS-47142] Simplifying the logic of ArtifactArchiver.perform, making it friendlier to Pipeline
2018-02-16 20:06:33 +01:00
Jesse Glick f4b78921e8 [JENKINS-27035] Gathering command read/write events (#3071)
* Slave.JnlpJar.getURL did not work in some modes when core had a snapshot dependency on Remoting.

* Starting to implement Channel.Listener.read/write.

* Now obtaining response timing statistics.

* For now, avoiding timestamped snapshots, as it caused problems for #3120 which I have asked for help from @stephenc diagnosing.

* Simplified logging a bit.

* onResponse

* hudson.FilePath$Mkdirs is a lot more readable than hudson.FilePath$13.

* Specific snapshot.

* onJar

* LoggingChannelListener

* remoting.version=3.17

* Making a few test assertions more lenient to adapt to https://github.com/jenkinsci/remoting/pull/247.
2018-02-06 09:40:24 +01:00
Jesse Glick 193855d1fb [JENKINS-47142] Simplifying the logic of ArtifactArchiver.perform, making it friendlier to Pipeline. 2018-01-25 17:05:37 -05:00
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
Krishan Bhasin 09bcc5d653 [JENKINS-47324] - Reduce usage of File.mkdirs() in FilePath and IOUtils (#3173)
* Move an instance of renameTo() to Files.move()

* Replace an instance of File.toURI() with an instance of Path.toUri()

* Replace mkdirs() with Files.createDirectories()
Replace mkdir() with Files.createTempDirectory()

* Undo addition of createTempDirectory() as per review comments

* Return to use of FilePath#mkdirs(File) and instead modify it to use the new API.

* Undo addition of toPath() in a URI conversion as it brings no benefits.

* Replace new uses of toPath() with Util.fileToPath() to pre-handle runtime exceptions

* Remove * import.
move mkdirs() to using FilePath method instead of File method.

* Make IOUtils.mkdirs(File) use Java7 API calls

* Add back accidentally removed imports.

* Fixed use of wildcard import

* Use utility method fileToPath() to handle potential exception thrown
2017-12-14 20:52:56 +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
Kanstantsin Shautsou 1f476da2e1 Don't use onloadable things in remoting mkdirs calls.
mkdirs do remoting call by creating anonymous class.
Remoting on remote side must load outer FilePath class with imports.
FilePath had SystemProperties OnMaster.
2017-10-09 11:29:41 +03:00
Oliver Gondža fd08d75213 Merge branch 'master' into JENKINS-19473 2017-09-24 16:05:51 +02:00
Oliver Gondža 3f3e3b80a0 [JENKINS-21905] Take advantage of suppressed exceptions 2017-09-24 16:04:50 +02:00