summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Set version to 2.14.12v2.14.12David Pursehouse2018-09-076-6/+6
| | | | Change-Id: Ia7925987947465f38be5b5ca4ef7ead970226d57
* Merge "Assume correct relative or absolute URL from Weblink provider" into ↵David Pursehouse2018-09-063-7/+16
|\ | | | | | | stable-2.14
| * Assume correct relative or absolute URL from Weblink providerSven Selberg2018-09-063-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I you have a change URL like: http://localhost:8080/c/test-project/+/688 Stepping back to parts "../../" will get you: http://localhost:8080/c/ Wich is _not_ the base url. Do not try to guess how URL is constructed but trust WebLink providers to provide an absolute or a relative URL. Provide correct relative url from Gitweb. Bug: Issue 5316 Change-Id: I7f404d470a8fe0f32ef94bb2c7b4c6a9ba68a2b8 (cherry picked from commit 69ab4a8569a690da7d6fc0c57e0a74c2d97ef6c0)
* | [project.config] Allow to add commentLink entriesHector Oswaldo Caballero2018-09-072-1/+36
| | | | | | | | Change-Id: I2fd01cb6775a905d7e602d5415102b274bd98fd3
* | ElasticVersionTest: Align tested versions w/ ElasticContainer last onesMarco Miller2018-09-061-3/+2
| | | | | | | | Change-Id: Iafc734d5f3a7e5f4ce9508f93525fe8348dd3b30
* | AbstractSubmit: Remove redundant assertion about null IOExceptionDavid Pursehouse2018-09-061-1/+1
|/ | | | | | | | | | | The call to assertThat(e).isNull() causes ErrorProne to raise a warning that there is a missing call to fail(), because it thinks that the exception is expected. Instead of asserting on the IOException, rethrow it as the cause of a new ValidationException. Change-Id: I7dd681196f8d63eb6f2a0063b55aa94d0ec1d71f
* ListMailFilter: Fix operator precedence warning raised by ErrorProneDavid Pursehouse2018-09-061-1/+2
| | | | | | | | Add grouping parenthesis to make the operator precedence explicit. See http://errorprone.info/bugpattern/OperatorPrecedence Change-Id: Ica10d3e1494e9109883ef0c327015e423e91dd31
* ListProjects: Fix operator precedence warning raised by ErrorProneDavid Pursehouse2018-09-061-2/+2
| | | | | | | | Add grouping parenthesis to make the operator precedence explicit. See http://errorprone.info/bugpattern/OperatorPrecedence Change-Id: I8a0853f8fac05218e77e1a94ebff989380246d37
* ChangeBundle: Fix operator precedence warning raised by ErrorProneDavid Pursehouse2018-09-061-3/+4
| | | | | | | | Add grouping parentheses to make the operator precedence explicit. See http://errorprone.info/bugpattern/OperatorPrecedence Change-Id: Iaf80a165e640f19bcb95b579cd3aba45ad9b20ba
* Bazel: fix error_prone_warnings_toolchain ruleDavid Pursehouse2018-09-061-1/+1
| | | | | | | | | | An incorrect target name causes the build to fail with: no such target '@bazel_tools//tools/jdk:platformclasspath8.jar' Removing the '8' suffix fixes it. Change-Id: I915239a5e1ce6403d7b6760d895aa085f00a1b83
* Elastic{Index|ReindexIT} Remove tests for 6.2 and 6.3David Pursehouse2018-09-062-22/+2
| | | | | | | | | | We don't need to test these versions all the time, so remove the tests. Support for versions 6.2 and 6.3 is kept; if we need to check for regressions we can manually enable the tests again later. Change-Id: Ia15785ad9cc995b4672814dd346e02a6ee4026a0
* ElasticVersionTest#version6: Add missing test for V6_4David Pursehouse2018-09-061-0/+1
| | | | Change-Id: I4ca4f304cdff6d8275e60856b992ee32d9c61027
* Allow more email RFC accepted chars in usernameJacek Centkowski2018-09-053-4/+13
| | | | | | | | | | | | | | | | | | | | Issue: Gerrit allows to specify email like username (especially handy when one wants to maintain unique email addresses across the server). However as opposite to what is described in [1] it allows only: ._- characters from allowed set that contains !#$%&‘*+–/=?^_`.{|}~ Considering the fact that I was able to perform clone (over SSH and HTTP) push for review, review and submit with all those characters but / this patch proposes to extend username allowed chars to !#$%&‘*+–=?^_`.{|}~ when @ is used (we have email like username) but keeps original characters set a-zA-Z0-9 when one uses single character for username. [1] https://www.mailboxvalidator.com/resources/articles/acceptable-email-address-syntax-rfc/ Change-Id: Iabb82cea5be32a68fe1d9fc65a6ca08743063a3f Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
* Make inheritance of receive.maxObjectSizeLimit optionalDavid Pursehouse2018-09-055-10/+50
| | | | | | | | | | | | | | | | Change I5f8b333e9 made the receive.maxObjectSizeLimit setting inherited from the parent project. However this is a change in behavior that users might not expect, and could have unexpected results. Rather than making this new behavior the default, make it so that it must be explicitly enabled in the site config by setting a new value, receive.inheritProjectMaxObjectSizeLimit, to true. Default the value to false when not explicitly set, to maintain backward compatibility with the behavior before change I5f8b333e9. Bug: Issue 9528 Change-Id: I63a990a61f0428148a5d26f9cf539d7d419b21ae
* Allow to inherit receive.maxObjectSizeLimit from parent projectDavid Pursehouse2018-09-0512-50/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current implementation it is possible to set the limit per project in the project.config on refs/meta/config, and at global level in $site/etc/gerrit.config. The project setting may override the global setting if it is lower. Changing the global setting requires a server restart. A limitation of this implementation is that we cannot set the limit at a project level and have it inherited to its child projects; it is necessary to explicitly set the limit on each child project. This limitation causes a lot of extra work in the case where for example we have a project hierarchy like: |- All-Projects | -- Namespace-A | | | |-- Project-A | |-- Project-B . . .. . . .. | |-- Project-X | | -- Namespace-B Where the Namespace-X projects are assumed to be "parent only" projects, if we want to set a limit for all the projects under a namespace hierarchy, we need to set it explicitly on all those projects individually rather than only on the "Namespace-X". With this change the limit is inherited from the parent project. The global limit is still respected, and the project still can't set a higher value than the global, either explicitly per project or via inheritance. Similarly, if no global limit is specified, a child project still may not set a limit higher than its parent. The inheritedValue is removed from the config info and replaced by a summary string describing how the effective value was inherited or overridden from the parent project or the global config. This string is used as the tooltip on the effective value in the UI. As a side effect of this change, it is now possible to effectively change the global limit without having to restart the server, by setting it on the All-Projects project. Note that this only works if the new limit is lower than what is already configured in the actual global limit in gerrit.config. Bug: Issue 9528 Change-Id: I5f8b333e905ed0a147526ae33ff2bab2cbe222ef
* CreateAccount: Simplify error message when username is invalidDavid Pursehouse2018-09-052-3/+2
| | | | | | | | | | | | The exception is hardcoded to mention the valid characters of the username, but doesn't actually match the characters that are allowed since it doesn't include the '@' character. To avoid the possibility of this error message becoming even more out of synch if further characters are allowed, simplify it to only say that the username is invalid. Change-Id: I036f1690442cd12f44377f44ae728f6ecb5f1346
* Merge "Bazel: Provide toolchain with activated error prone warnings" into ↵David Pursehouse2018-09-052-0/+153
|\ | | | | | | stable-2.14
| * Bazel: Provide toolchain with activated error prone warningsDavid Ostrovsky2018-09-052-0/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On recent bazel versions it's trivial to apply package specific checks. Provide custom java toolchain with all error prone warnings activated. The list of all error prone warning was borrowed from here: [1]. For compatibility reasons with Bazel releases two java_toolchains are added for now: * Compatible with Bazel 0.16.1: error_prone_warnings_toolchain_bazel_0.16 compatible with 0.16.1 * Compatible with Bazel@HEAD: error_prone_warnings_toolchain Test Plan: $ bazel build --java_toolchain //tools:error_prone_warnings_toolchain \ //... [1] https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl Change-Id: I9a098c2d43cbfd87dbc261ce2cf9085dec3431e8 (cherry picked from commit 4b60cd7febb0a9a1e4a511dfb1855cc50c588820)
* | Merge changes from topics "use-ExternalId-isValidUsername", ↵David Pursehouse2018-09-0511-39/+70
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | "move-username-regexs-to-ExternalId" into stable-2.14 * changes: Use ExternalId.isValidUsername instead of ExternalId.USER_NAME_PATTERN_REGEX Move regular expressions for user name from Account to ExternalId AccountIT: Add basic tests for creating user with {in}valid username
| * | Use ExternalId.isValidUsername instead of ExternalId.USER_NAME_PATTERN_REGEXEdwin Kempin2018-09-058-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | Since ExternalId.USER_NAME_PATTERN_REGEX is now no longer used by external callers it is made private. Change-Id: Id7a108bf39baffc52273879bbf8973dbbea0ae0c Signed-off-by: Edwin Kempin <ekempin@google.com>
| * | Move regular expressions for user name from Account to ExternalIdEdwin Kempin2018-09-0510-39/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User names are stored as external IDs, hence the regular expressions to validate the format of a user name should be part of the ExternalId class. There is one place in the GWT UI where user names are validated. Since the GWT UI doesn't have access to the ExternalId class it needs to copy two of the regular expressions. This should be OK since the format of user names is not expected to change and the GWT UI will be gone soon. It's actually a goal to remove all dependencies from the GWT UI on the Account class so that the Account class can be moved out of the reviewdb.client package and be turned into an immutable AutoValue type. Change-Id: I6ea7139019eb0e7f0e06efaf77ec4bd89d514006 Signed-off-by: Edwin Kempin <ekempin@google.com>
| * | AccountIT: Add basic tests for creating user with {in}valid usernameDavid Pursehouse2018-09-051-0/+23
|/ / | | | | | | Change-Id: I11f433a644c5d50c7ca10c1ab3f2f1223d822330
* / Revert refactoring of Account.USER_NAME_PATTERNDavid Pursehouse2018-09-058-30/+19
|/ | | | | | | | | | | | | | | | | | In changes I02ce9c6b6 ("Optimize USER_NAME_PATTERN string and its usage") and I8082b2ad3 ("Account.java: introduce compiled pattern and use where applicable"), the usage of Account.USER_NAME_PATTERN was refactored. This refactoring conflicts with separate refactoring that was done on the master branch. Instead of trying to resolve the conflicts, which ends up with the changes effectively being reverted, just revert them here. The refactoring that was done on master can then be backported here. This reverts commit 1ee03aa948553654283702220cbf36798ac1e45e. This reverts commit cf97d694febd26aeea66c6f16355a721860f80fd. Change-Id: I199d2f1531ec2b59d4263f1b72f1c967913bb9a5
* Add support for Elasticsearch 6.4.0David Pursehouse2018-09-049-4/+21
| | | | | | | | | | | | | | | According to the release notes [1] there are several breaking changes, but none of them seem to affect Gerrit's integration. Update the version manager and adapter to recognize 6.4.* as a supported version, and modify the test container to use 6.4.0 for the V6 tests. Update the reindex and ssh index tests to also test against 6.4.0. [1] https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-6.4.0.html Bug: Issue 9670 Change-Id: If0d16df1a719d45aad9c56409e14c8fcf3945bd5
* Upgrade elasticsearch-rest-client to 6.4.0David Pursehouse2018-09-044-12/+16
| | | | | | | | | | | In this version several variants of the RestClient's performRequest method are deprecated [1]. Adjust the implementation to use the recommended variant instead. [1] https://www.elastic.co/guide/en/elasticsearch/reference/6.x/breaking_64_rest_client_changes.html Change-Id: Ib09ab0a0800ed6957060c6e04352605ac5424062
* ElasticVersion: Say 'Unsupported' rather than 'Invalid'David Pursehouse2018-09-042-7/+7
| | | | | | | | | If a version number is not recognized, it is not necessarily invalid, but could just be because we didn't yet add support for it. Change the error message to be less aggressive. Change-Id: I904ff165b7e04ae0c5e7514923a75f6a74e8b005
* ElasticQueryAdapter: Move isV6 method to ElasticVersion and simplifyDavid Pursehouse2018-09-043-6/+13
| | | | | | | | | Move isV6 to ElasticVersion and simplify it to make it work with all future 6.x versions, ratehr than being hard-coded to 6.2 and 6.3. Add a test. Change-Id: Ibd17a45ebbcbbc8edcd37c8aec37090d878ebdf4
* Account.java: introduce compiled pattern and use where applicableJacek Centkowski2018-09-038-9/+22
| | | | | | | | | | | There is no point in compiling USER_NAME_PATTERN over and over again in all those places where it is used hence compiled version was added. Note that original version was kept so that there is no collateral damage in plugins that use it. Change-Id: I8082b2ad3e04a6407e9c41f969a0e274386b63ab Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
* Optimize USER_NAME_PATTERN string and its usageJacek Centkowski2018-09-032-10/+8
| | | | | | | | | | | | | | | | | | The following issues from [1] are addressed by this change: 1. common pattern part was extracted 2. USER_NAME_PATTERN string is used to indicate that account couldn't have been created as it is not compliant with it 3. number of lines was reduced in USER_NAME_PATTERN by combining relevant characters together In addition: USER_NAME_PATTERN_LAST is derived from USER_NAME_PATTERN_FIRST as they are equal. [1] https://gerrit-review.googlesource.com/c/gerrit/+/194650 Change-Id: I02ce9c6b6d3b121050178851e2121b3419e7b830 Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
* ElasticContainer: Test against Elasticsearch version 5.6.11David Pursehouse2018-09-031-1/+1
| | | | | | | | | | Version 5.6.11 is the latest on the 5.6.x series, and according to the release notes [1] there are no breaking changes since the previous release (5.6.10). [1] https://www.elastic.co/guide/en/elasticsearch/reference/5.6/release-notes-5.6.11.html Change-Id: I5341ae0fce3da52f5496dfc090a10302f244edda
* ConfigSuite: Instantiate class via getDeclaredConstructor()David Pursehouse2018-09-031-1/+1
| | | | | | | | | | ErrorProne reports a warning [1] about bypassing exception checking by instantiation with direct call to #newInstance. It also mentions that #newInstance is to be deprecated from Java 9. [1] http://errorprone.info/bugpattern/ClassNewInstance Change-Id: Id20631933bce8ab320dd5e321336bad9e181cfa0
* Merge changes Iba3a674f,I8ed3f12e,Id6617817 into stable-2.14Dave Borowitz2018-08-315-6/+10
|\ | | | | | | | | | | | | * changes: InitSshd: Use correct flag to set empty passphrase SshSession: Specify charset in constructor of Scanner Specify charset in constructors of InputStreamReader
| * InitSshd: Use correct flag to set empty passphraseGerrit Code Review2018-08-311-1/+1
| | | | | | | | | | | | | | | | | | From https://www.ssh.com/ssh/keygen/: -N "New" Provides a new passphrase for the key. -P "Passphrase" Provides the (old) passphrase when reading a key. PiperOrigin-RevId: 210948400 Change-Id: Iba3a674f81686987fef60f0fd5a5f42aa5b9dd86
| * SshSession: Specify charset in constructor of ScannerDavid Pursehouse2018-08-311-2/+3
| | | | | | | | | | | | | | | | | | ErrorProne reports a warning [1] about implicit use of the platform default charset. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: I8ed3f12ead13087c143a1235bef66de620b36ae6
| * Specify charset in constructors of InputStreamReaderDavid Pursehouse2018-08-313-3/+6
| | | | | | | | | | | | | | | | | | ErrorProne reports a warning [1] about implicit use of the platform default charset. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: Id661781773ca175b52a17cf4d80c37fad17344a8
* | GitOverHttpModule: Bind REST auth filter in its own moduleDavid Ostrovsky2018-08-314-27/+63
| | | | | | | | | | | | | | GitOverHttpModule is binding both filters for git over HTTP and for REST requests. Extract filter definition for REST requests in its own module. Change-Id: If03e76c906bc3e0cac827b49f5f087cc859be4cd
* | Ensure user authentication in AllRequestFilter filtersDavid Ostrovsky2018-08-312-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current order of filters declaration make request authentication only work when HTTP request is issued from the Gerrit UI, but not work when REST API is used. In Daemon#createWebInjector() we have this: [...] modules.add(RequestContextFilter.module()); modules.add(AllRequestFilter.module()); modules.add(RequestMetricsFilter.module()); modules.add(H2CacheBasedWebSession.module()); modules.add(sysInjector.getInstance(GitOverHttpModule.class)); [...] The are two major use cases to consider: 1. Gerrit UI request: when authenticated user session is found and set in RequestContextFilter, before AllRequestFilter, that's why in AllRequestFilter we have a user: Account: 1000000 username: admin 2. REST API request, e.g.: curl --user user http://localhost:8080/a/config/server/version "2.14.7-9-g9ebfce95b7-dirty" Here the AllRequestFilter is bound before GitOverHttpModule, that provides ProjectBasicAuthFilter filter, and thus, there is no identified user: anonymous Adapt the AllRequestFilter registration order to fix authentication also for REST API requests. This is needed for Javamelody's monitoring filter to work properly for Prometheus scraping request: curl -u user http://localhost:8080/a/monitoring?format=prometheus There is more context and discussions in these CLs: https://gerrit-review.googlesource.com/c/plugins/javamelody/+/192411 https://gerrit-review.googlesource.com/c/plugins/javamelody/+/192170 https://gerrit-review.googlesource.com/c/gerrit/+/164991 Change-Id: I925e952474440cb612080dafd917a01dba8f3330
* Update JGit dependencies to fix building from sourceGert van Dijk2018-08-302-7/+9
| | | | | | | | | | | | | | | Depends on [1] which harmonizes JGit's dependency names to align with the names used in Gerrit since change I1e75690fe. Without [2], the build will fail with errors like: "no such package '@commons_compress//jar'" Also move the 'hamcrest-library' dependency out of WORKSPACE into the jgit rules where it will be added conditionally. [1] https://git.eclipse.org/r/#/c/128354/ Change-Id: I33be13e7f36ec2bcacbb9eb0983c88c6f3082097
* Update revision of commit-message-length-pluginDavid Pursehouse2018-08-301-0/+0
| | | | | | - Use "warning" prefix to allow colorization of remote output Change-Id: Ic968dc5e894ae95f70f0e2b321745190b9c1093e
* Improve warning when starting Gerrit JVM without OOM protectionDavid Pursehouse2018-08-301-2/+2
| | | | Change-Id: Ib4ab2d5ab6a58fa34de081d8051b21411f994e70
* Merge "Warning when starting Gerrit JVM without OOM protection" into stable-2.14David Pursehouse2018-08-291-0/+5
|\
| * Warning when starting Gerrit JVM without OOM protectionLuca Milanesio2018-08-291-0/+5
| | | | | | | | | | | | | | | | | | | | When gerrit.sh gets started from a non-root user, the JVM PID is not protected against the Kernel OOM killer attacks. Instead of silently ignoring the setting, display a warning making aware of the danger and telling the user what to do. Bug: Issue 9514 Change-Id: I4c1c0e06b260e75d900f436d37f0b91d031cd24e
* | cmd-index.txt: Fix anchorsEdwin Kempin2018-08-291-5/+8
| | | | | | | | | | | | | | Links to the anchors are currently not working. Change-Id: I43c41c4d04bc665a4fe846de2d8fbc5b77bf7a81 Signed-off-by: Edwin Kempin <ekempin@google.com>
* | Update revision of commit-message-length-validator pluginDavid Pursehouse2018-08-291-0/+0
|/ | | | | | | - Remove Buck based build - Prefer using Splitter to String.split Change-Id: Icf588a3f38713b379a0e3847752c5c5852273139
* ElasticRestClientProvider: Make client field volatileDavid Pursehouse2018-08-291-1/+1
| | | | | | | | | ErrorProne reports a warning [1] that double-checked locking on non-volatile fields is unsafe. [1] http://errorprone.info/bugpattern/DoubleCheckedLocking Change-Id: I4277a4910bd93fab9f072323a69bbf19472eb590
* AbstractElasticIndexer: Specify charset for InputStreamReaderDavid Pursehouse2018-08-291-1/+1
| | | | | | | | | ErrorProne reports a warning [1] about implicit use of the platform default charset. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: I57a4d5ff4ef533312c3282a80df57e07e10a92e1
* SshCommandsIT: Use immutable type for constant field declarationsDavid Pursehouse2018-08-291-2/+1
| | | | | | | | | | ErrorProne warns [1] that constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List). [1] http://errorprone.info/bugpattern/MutableConstantField Change-Id: If42c500891ea0eb90e753620b6c1e251336217e1
* rest-api-config.txt: Fix monospace `plugin`Dave Borowitz2018-08-291-1/+1
| | | | | | The previous form `plugin ` renders as literal backticks, not monospace. Change-Id: I6b261f9897275a7c699b2df0a5e11c8d7eb0a606
* Bazel: Don't depend directly on @local_jdk in java_doc ruleDavid Ostrovsky2018-08-271-7/+3
| | | | | | | | | | | | | | To support alternative java_toolchains (e.g.: to activate all error prone warnings) we should not directly depend on @local_jdk, but use @bazel_tools//tools/jdk:current_java_runtime to get the configured JDK instead. See this issue for more context: [1]. [1] https://github.com/bazelbuild/bazel/issues/5997 Inspired-by: Liam Miller-Cushon <cushon@google.com> Change-Id: I66e1215a01f98e435e514a5442533ab15eaebd35
* ProjectConfig#getMaxObjectSizeLimit: Improve JavadocDavid Pursehouse2018-08-231-4/+1
| | | | Change-Id: I8e878b10ec332f771322fc6174eb914508f32eb8