Commit Graph
853 Commits
Author SHA1 Message Date
Jesse Glick 3a81319ca3 TextFileTest.tail failed on Windows when using a source checkout with Unix newlines. 2018-02-26 10:04:11 -05:00
Baptiste Mathus 0c17e82e82 Merge pull request #3185 from mikecirioli/OSS-2590
[JENKINS-48463] Update jenkins core to use  XML v1.1
2018-02-04 11:31:53 +01:00
Sam Van Oort 2a6fc653ee Fix [JENKINS-49206] by ensuring Timer threads get standard classloader (#3272)
* Fix [JENKINS-49206] by ensuring Timer threads get standard classloader

* Refactor to better fit in with existing ThreadFactor utils

* Fix javadocs
2018-02-03 13:22:53 +01:00
Baptiste Mathus 6cefcf17a8 [JENKINS-48407] Re-enable AtomicFileWriterTest#checkPermissionsRespectUmask() (#3275)
* [JENKINS-48407] Re-enable test

The previous test assumed permissions would always be the same,
when they actually depend on umask settings.

This change creates a file *not* using the temporary API, gets its
permissions then compares it to the ones obtained using
AtomicFileWriter.

Note: we now only check the given permissions, not the "non-given".

* Use assertThat(..., equalTo()) instead of a manual loop

* Remove unused imports

* Use TemporaryFolder instead of manual temporary dir creation
2018-02-02 16:17:55 +01:00
Jesse Glick ac05680bb6 Introduced ACL.lambda convenience method (#3260)
* Introduced ACL.lambda convenience method.

* Javadoc
2018-02-02 15:56:55 +01:00
mike cirioli 5f0f9f2b87 [JENKINS-48463] added try-with-resources to XmlFileTest to ensure proper
file handle cleanup in the event of failure

Fixed small nits regarding typo's and code cleanup
Added comment explaining why Xpp3 is still included as a dep
2018-01-30 09:31:15 -05:00
Baptiste Mathus 91237450bc Disable test temporarily to get the release out
Note: this test is wrong, the production code is correct.
So that is why disabling this test until we fix it is OK.
2018-01-29 11:55:44 +01:00
mike cirioli 992100ac42 [JENKINS-48463] - fixed reference to deprecated Xpp3Driver and replaced with
new default driver
2018-01-24 09:47:58 -05:00
mike cirioli 17f74fc713 Merge branch 'master' into OSS-2590 2018-01-24 09:27:57 -05:00
mike cirioli 0431cc75fd [JENKINS-48463] - Ignoring test xml1_0_withSpecialCharsShouldFail due to
KXml2Driver being tolerant of control characters which should be illegal
in an XML v1.0 content.  This test should be revisted if we switch to
another XML driver
2018-01-24 09:25:34 -05:00
mike cirioli a0f419120b [JENKINS-48463] It appears that the KXml2Driver is more tolerant of
technically illegal xml (ie. it doesn't complain if an Xml v1.0 file
contains special characters).  Added a unit test that proves this, as well
as fixing silentlyMigrateConfigsTest so that it starts with technically
valid Xml 1.0 content
2018-01-24 09:25:34 -05:00
mike cirioli b9c2148d6e [JENKINS-48463] Added a unit test that validates jenkins xml v1.0 configs
are silently migrated to xml v1.1 as they are persisted
2018-01-24 09:25:33 -05:00
mike cirioli 24a1852fc2 [JENKINS-48463] Added additional unit tests for verifying xml v1.1 compatibility
- verify can still read xml 1.0
  - verify can read xml 1.1
  - verify can read xml 1.1 with 'special' characters
  - verify that jenkins can start with a config.xml having
    <?xml version='1.1'> and special characters
2018-01-24 09:25:33 -05:00
mike cirioli 570b52dbcc [JENKINS-48463] refactored XStream2 to default to KXml2Driver by default.
Changed all explicit references of the hierarchical driver to use a static
convinience method XStream2.getDefaultDriver() to ensure all XML operations
are using the same driver.
2018-01-24 09:25:32 -05:00
mike cirioli 9a4a913e38 [JENKINS-48463] - update jenkins core to use xml v1.1
- switched to KxmlDriver (needed for xml 1.1 support)
  - updated to create xml v1.1 headers
  - updated test to use KXml2Driver explicitly
  - updated unit tests to support xml v1.1
2018-01-24 09:24:56 -05:00
Jesse Glick 976fe5aaa0 [JENKINS-49054] Work around XStream bug by looking up list type before trying to unmarshal elements. 2018-01-19 17:54:08 -05:00
Jesse Glick c5e302b237 Merge pull request #3236 from jglick/ClassFilterImplSanityTest
Minor cleanups of ClassFilterImplSanityTest
2018-01-17 11:37:23 -05:00
Baptiste Mathus ef2a432c27 Merge pull request #3233 from batmat/JENKINS-48407-2
[FIX JENKINS-48407] Permission issue after upgrade to 2.93
2018-01-17 10:25:33 +01:00
Jesse Glick c339ab4aff Minor cleanups of ClassFilterImplSanityTest. 2018-01-16 15:34:42 -05:00
Baptiste Mathus 00d9397ab4 [FIX JENKINS-48407] Test to check we have the expected permissions 2018-01-16 17:24:35 +01:00
Oleg Nenashev 260a2576f2 [JENKINS-48946] - Move whitelist ordering test to core to fail fast 2018-01-15 20:02:58 +01:00
Baptiste Mathus 438e9296f0 Merge pull request #3170 from batmat/JENKINS-34855
[FIX JENKINS-34855] Create a FileChannelWriter and use it for AtomicFileWriter "enforced" flushing
2018-01-12 10:30:32 +01:00
Jochen A. Fürbacher 6df06fc19a [JENKINS-48447] Fixed HTTP 404 error when clicking on newView sidebar link from an other view. (#3178)
* [JENKINS-48447] Fixed HTTP 404 error when clicking on newView sidebar link from an other view.

* [JENKINS-48447] Fixed unit tests for NewViewLink

* [JENKINS-48447] Load url name each time object gets initialized and adapted tests.

* [JENKINS-48447] Rewrite tests for url name; fixed indenting.

* [JENKINS-48447] Fixed more identing.

* [JENKINS-48447] Added @Restricted to NewViewLink; undo URL_NAME renaming.
2018-01-07 14:43:49 +01:00
Baptiste Mathus 3a5189ebc8 Introduce flags to disable force per instance or globally
The goal here is to:
* be able to selectively choose performance over integrity in some very
  specific cases
* be able to globally disable AtomicFileWriter integrity, and basically
  revert to previous behaviour by setting a system property.
  This flag is meant as an emergency one in case something goes very
  wron on some production system.
2018-01-04 14:35:39 +01:00
Oleg Nenashev 8eb4254b0f Merge pull request #3212 from oleg-nenashev/bug/JENKINS-48761-remoting-API
[JENKINS-48761] - Restore binary compatibility with agents running old Remoting versions
2018-01-03 23:35:56 +01:00
Oleg Nenashev 01b8ed8c71 [JENKINS-48761] - Address review comments from @jglick 2018-01-03 20:59:11 +01:00
Oleg Nenashev 6d44f7e080 [JENKINS-48766] - Create restricted API for getting info about Remoting versions 2018-01-03 11:59:24 +01:00
Oleg Nenashev 16042bd57b Merge pull request #3196 from jglick/unmarshal-JENKINS-21017
[JENKINS-21017] When unmarshalling into an existing object, reset missing fields
2017-12-29 11:56:08 +01: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
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 ddb9ad68b4 Making nullOut behavior opt-in, so limiting to AbstractItem and View (and in particular not Jenkins). 2017-12-14 13:16:42 -05:00
Jesse Glick 0a50ab9957 Merge branch 'jenkins-21017' of https://github.com/stephenc/jenkins into unmarshal-JENKINS-21017 2017-12-13 15:01:57 -05: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 1191bb0ef0 New flag to FileChannel.force() on each Writer.flush() or not
And disable FileChannel.force() in the case of AtomicFileWriter.
See the committed javadoc for the full why.
2017-12-03 23:33:44 +01:00
Baptiste Mathus 22efbad945 [JENKINS-34855] Create a FileChannelWriter 2017-12-02 10:28:49 +01: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