2562 Commits

Author SHA1 Message Date
David Ostrovsky
c055d46280 Close security hole allowing normal user to become admin
Icc105c39e introduced severe security problem, allowing non admin
users that was granted modifyAccount capability to modify SSH keys
of all users, including administrators. But that means such a user
can change the authentication of an existing administrator and then
impersonate the admin to elevate their own account status to that
of an admin.

Rectify it but restricting changing of SSH keys for a user only to
members of administrators group.

Change-Id: If82965391369121b282b969e7072a2bfa3074be9
2014-10-03 09:53:34 +00:00
Khai Do
cf9bce2191 Remove the generateHttpPassword capability
Remove the Generate HTTP Password capability because it exposes a
security vulnerability.  Any user that is granted this capability
can modify an administrator's http password and impersonate the
admin user.  Other reasons for removing this capability are that
the usage of it is inconsistent with the modifyAccount capability
and this capability encourages adding additional capabilities to
restrict permissions, which is not desired.

With this change only administrators are allowed to generate and
delete other users' http passwords.

The motivation behind this change is from comments in changes
Ib1971fad and If8296539.

Change-Id: Id907cc103591eed029fd08af700bb1bb6a618ff8
2014-09-29 15:21:06 -07:00
Hugo Arès
88e33ac9f1 Add User to the http request attributes
GetUserFilter is adding the user to the request attribute so the user
who requested the URL is printed in the httpd_log but it is only
applied when running Gerrit with the embedded servlet container.

Move GetUserFilter from the gerrit-pgm to gerrit-httpd so it can be
applied when running Gerrit in a servlet container (e.g. Tomcat). Add
a parameter http.addUserAsRequestAttribute in gerrit config to
enable/disable this filter. It is enabled by default.

In tomcat, pattern %{User}r can be used in the AccessLog to print user
to get same functionality as httpd_log when running with the embedded
servlet container.

Change-Id: I591d594848a5b2d4aa9389965365e0621b39a51c
2014-09-24 12:33:52 -04:00
David Ostrovsky
37175427d5 Buck: Document how to disable buckd
See this bug report for references [1].

[1] https://github.com/facebook/buck/issues/197

Reported-by: David Borowitz <dborowitz@google.com>
Change-Id: I2113251a1be5597810b9680b64d09e18df8588dc
2014-09-22 06:13:07 +00:00
David Pursehouse
f9e62b14a5 Merge "fix documentation of REST API change query field." 2014-09-22 01:20:17 +00:00
Orgad Shaneh
905102bea2 Fix typo in dev documentation
Change-Id: Iec758ba00da6c4c2b5d8bd3b2816ad87b6c32022
2014-09-22 01:17:53 +00:00
Khai Do
2a23ec8390 fix documentation of REST API change query field.
The reference to PATCHSET_LINKS is incorrect, it should be WEB_LINKS.

Change-Id: I8c8f87bd31b5a89760393dc73e099e9acdcb8b12
2014-09-19 16:33:02 -07:00
Saša Živkov
32018141d2 Merge "Add diff pref whether the diff table header should be auto hidden" 2014-09-17 15:24:55 +00:00
Edwin Kempin
1b6c6d843c Add diff pref whether the diff table header should be auto hidden
Add a new diff preference that allows the user to decide whether the
diff table header with the patch set selection should be automatically
hidden when scrolling down more than half of a page. At the moment
this behaviour cannot be disabled, but some users find it annoying
that the header disappears and that they need to scroll up to be able
to change the patch set selection.

By default the diff table header is automatically hidden as this is
the current behaviour.

Change-Id: I1d65c5058222c924ccaf3276f7d2d83fac7f4d32
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-09-17 16:03:59 +02:00
David Pursehouse
1fe4ed6457 Allow plugins to perform validation of hashtag changes.
Plugins can validate and reject additions or removals of hashtags
on changes.

Change-Id: I138094a9dec428f0872e7182c40a77cc742cac2a
2014-09-14 16:42:34 +09:00
Edwin Kempin
853db98a5d Merge "Add stream event and hook for hashtag changes" 2014-09-12 16:20:21 +00:00
Sven Selberg
42d9d297d5 Full text search in memory for review suggestions
This change also makes it possible to configure maximum
displayed reviewers.

On some Gerrit instances the full name is formatted like:
<given name> <surname>
and email like:
<given name>.<surname>@...
This would make it impossible to get reviewer suggestions from
surnames.
Since gwtorm doesn't support sql LIKE there is no straight forward
way of filtering on substring in the DB. Hence this in memory approach.

For performance reasons this implementation differs from the default
implementation in that it does not look at the email_address in
account_external_ids but only at the preferred_email of accounts.
The default implementation does only look for 10 matches and afterwards
filters out the acconts that are not allowed to view the change.

Configuration:
suggest.maxSuggestedReviewers
Maximum number of suggested reviewers (default 10).

suggest.fullTextSearch
Enable full text search (default "false").

suggest.fullTextSearchMaxMatches
Maximum number of matches to be checked for accessability when using
full text search (default 100).

Change-Id: Ia4c3a15263783bc144e66a05854c3915392095b5
2014-09-12 15:11:41 +00:00
David Pursehouse
cb2e4853c9 Add stream event and hook for hashtag changes
The stream event is fired and the hook is executed when hashtags
are added or removed.

Change-Id: Ifa66db4d5ea3d5aecd9bf56830cd50688cc6af29
2014-09-12 16:45:54 +02:00
Edwin Kempin
4c51f70302 Merge "Allow to control target of web links" 2014-09-12 12:09:27 +00:00
David Ostrovsky
0619f65b17 Make edit's parent the base of the change
Change-Id: I53186d485638e9c761720630149e575a461f2001
2014-09-12 12:11:45 +02:00
Edwin Kempin
ceeed6b48a Allow to control target of web links
Plugins can now control the target window in which a web link should
be opened.

This is an incompatible change and plugins implementing web links must
be adapted.

Change-Id: I5aec40ce425251b10fcb912131d547982d27cd55
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-09-12 10:08:22 +02:00
Dave Borowitz
d9b8b39088 Allow users with accessDatabase to view metadata refs
Administrators may want to inspect the full ref state of a repository
without having direct git access. Reuse the accessDatabase capability
within VisibleRefFilter for this purpose. Users with this capability
can access basically all data on the server, so we are not giving
them significantly more visibility.

Change-Id: I592557528915ab216acce5fa7e057df8f2fc1640
2014-09-12 09:10:54 +02:00
David Pursehouse
1ebc047e6e Merge "Option to create a new change for every commit not in target" 2014-09-11 13:28:32 +00:00
Deniz Türkoglu
52777270d9 Option to create a new change for every commit not in target
One not-so-well-known feature of gerrit is that, you can set a
%base for the RevWalk in ReceiveCommits when pushing changes to
Gerrit. This makes it possible to push a commit for review and
override Gerrits default algorithm for creating new changes on
push to refs/for/*. For instance, one could submit a commit in
a private branch and, afterward, push the same commit to a
release branch.

Specifying the tip of the destination branch as the %base would
have an effect of creating a new change for every commit reachable
from the pushed commit and not reachable from the target branch.
This behavior seems to be wanted by some Gerrit users and is
implemented as a project config option by this change (although
it contradicts the Gerrit's philosophy of reviewing one commit once).
If a %base is explicitly set on during uploading changes,
new-change-for-all-not-in-target is ignored.

To avoid incidental pushes with merges,
new-change-for-all-not-in-target rejects uploads if changes
contain merge commits. In such cases to push a merge commit, you
need to explicitly set the %base parameter as described in
Uploading Changes / Selecting Merge Base documentation.

Bug: issue 1195
Change-Id: Ifa90184352c912885e52d2060356fcc039d0ef03
2014-09-11 15:10:08 +02:00
Edwin Kempin
f466383995 Merge "Add support for file web links" 2014-09-11 12:52:34 +00:00
Edwin Kempin
b3696c8d7a Add support for file web links
Change-Id: I362297fd483a0eeb77ee889899a636f2788cb71c
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-09-11 13:40:45 +02:00
Dave Borowitz
9c4a47051f Delete GWT DevMode launcher
There is now only one supported way to debug GWT, so remove the "SDM"
naming, as it's basically an implementation detail. Be consistent
between the launcher and class names,
gerrit_gwt_dbg -> GerritGwtDebugLauncher.

Update the documentation to be consistent as well, and link to the
article about Super Dev Mode.

Change-Id: If541bc48bf828a8af64d631d7acd6f663d5ecea1
2014-09-11 10:08:36 +00:00
Edwin Kempin
9e4fb10c5e Merge "Add support for branch web links" 2014-09-11 09:27:40 +00:00
Dave Borowitz
a5510e3490 Merge "GWT SuperDevMode: Spawn codeserver and Daemon in same process" 2014-09-10 16:51:46 +00:00
David Ostrovsky
9adf60e96f GWT SuperDevMode: Spawn codeserver and Daemon in same process
Simplify SDM experience by embedding codeserver and daemon in one
process: no multiple launch configurations must be started and
the output must not be captured in different IDE console windows.

Unfortunately, as is Codeserver implementation is based on outdated
Jetty. Replace WebServer.java from GWT project (same license like
Gerrit itself, preserving the license header) and adjust it to run
against Jetty 9 that is used by Gerrit.

This also removes the need to fetch outdated Jetty version that we
have just wiped out from gwt-dev.jar during download from Central.

Change-Id: I616a53eb080d49a2bdf7a2211067b821af9f85d7
2014-09-10 18:47:58 +02:00
Edwin Kempin
0f697bdbec Add support for branch web links
Change-Id: I1a56aa26c74a1bd6ac26aa6bc8c93adeac829e87
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-09-10 18:23:29 +02:00
David Pursehouse
de71170ac4 Add documentation for the Edit Hashtags capability
Change-Id: I34b2ec5c47834dc002efd6db024261225293dacb
2014-09-10 15:19:17 +00:00
Dariusz Luksza
45ee73ef9d Provide configuration option to disable reverse DNS lookup
Adds gerrit.disableReverseDnsLookup configuration option to disable
reverse DNS lookup during audit log entry creation for identified user.
By default this option is set to 'false'.
Setting this option to 'true' would improve push time from host without
reverse DNS entry. Currently JVM will wait for 5s until it gives up
reverse resolution, this can be bypassed by changing this new
configuration option.

Based on input from old mail thread[1]

[1]
https://groups.google.com/d/msg/repo-discuss/pqq4I0-hiUY/ZmaXA0oWvbwJ

Change-Id: I13247799e2a2e8793b3c35d9fffb8f2c069e5ce0
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2014-09-10 13:13:54 +00:00
Edwin Kempin
596cce211a Merge "Merge branch 'stable-2.10'" 2014-09-10 12:13:43 +00:00
David Pursehouse
ecc535c6ff Merge branch 'stable-2.10'
* stable-2.10:
  Release notes for Gerrit 2.9.1
  Set version to 2.9.1
  Display parents for all changes, not only merge commits
  Fix JS plugin load when using non-root Gerrit URLs
  Don't require secondary index when running daemon in slave mode
  Remove fixed limit of results returned by secondary index query

Conflicts:
	gerrit-pgm/src/main/java/com/google/gerrit/pgm/Reindex.java
	gerrit-server/src/main/java/com/google/gerrit/server/index/IndexRewriteImpl.java

Change-Id: I66a9909edc789ee826f5091ca87044e160a25926
2014-09-10 13:40:16 +02:00
Dave Borowitz
51e72b8809 Merge topic 'inline-3'
* changes:
  InlineEdit: Preserve active edit mode on change screen reload
  InlineEdit: Fix navigation for path column in file table
  InlineEdit: Respect change edits in download commands drop down
  InlineEdit: Allow restoring of files in change edit
  InlineEdit: Allow deletion of files in change edit
  InlineEdit: Support adding new files to the change
  InlineEdit: Implement SBS2 integration
  InlineEdit: Make revision resource change edit aware
  InlineEdit: Reuse edit message box to edit file content
  InlineEdit: Add change content file API for change edits
  InlineEdit: Add edit/review mode to the file table
2014-09-10 11:25:30 +00:00
Edwin Kempin
13eec766ab Merge "Add --rebase option to review command" 2014-09-10 10:07:20 +00:00
David Pursehouse
5afd5b8f00 Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Release notes for Gerrit 2.9.1
  Set version to 2.9.1
  Display parents for all changes, not only merge commits
  Fix JS plugin load when using non-root Gerrit URLs
  Don't require secondary index when running daemon in slave mode
  Remove fixed limit of results returned by secondary index query

Conflicts:
	VERSION
	gerrit-extension-api/pom.xml
	gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.java
	gerrit-plugin-api/pom.xml
	gerrit-plugin-archetype/pom.xml
	gerrit-plugin-gwt-archetype/pom.xml
	gerrit-plugin-gwtui/pom.xml
	gerrit-plugin-js-archetype/pom.xml
	gerrit-war/pom.xml

Change-Id: Id7a49d3792510653da4312e240924d47e8b52724
2014-09-10 11:35:00 +02:00
David Ostrovsky
5562fe5ee6 InlineEdit: Respect change edits in download commands drop down
Change-Id: I0f4d101b3249722cd03851f814476129f79bb022
2014-09-10 11:30:38 +02:00
David Pursehouse
ad4ed96a07 Buck: Update bash completion setup instructions
Upstream buck project changed the name of the bash completion script.

Update the documentation accordingly.

Change-Id: Iff6e4abb569f593712498b5df56692a2e30a7610
2014-09-10 11:11:11 +02:00
David Pursehouse
1d04f645d0 Buck: Add setup step to create symbolic link for buckd
To be able to run buckd from the command line, it needs to be in
the path.  Add a symbolic link to the executable in buck/bin like
we already do for the buck executable.

Change-Id: If3efcc577d3bf2fcb95ed3e8030975e7933148cb
2014-09-10 11:10:09 +02:00
Edwin Kempin
79f2ee8b9f Merge "Add support for project aware TopMenu extensions" 2014-09-10 08:50:23 +00:00
Hugo Arès
67b38e37ad Add --rebase option to review command
Feature: issue 2824
Change-Id: Ibb5bc553fea1ad9dd43a69145f27645dc33c5e52
2014-09-09 13:08:04 -04:00
Edwin Kempin
4bab57dc3d Merge "Add icon support for revision weblinks" 2014-09-09 12:15:53 +00:00
Dariusz Luksza
e8de74ff2e Add support for project aware TopMenu extensions
Currently TopMenu extensions are not context aware, which is not a
problem for most of them, but in case of the 'Projects' section this
could be problematic.

With this approach plugins cannot contribute TopMenu items that will
only be shown when a project is selected and the url (and the history
item) contains a project name.

This change improves this by adding a possibility to provide a menu
item within the 'Projects' context without the previously mentioned
limitation.

Now when a TopMenu item contains a '${projectName}' placeholder it
will be replaced with name of project that is selected in the
'Projects' section.

Change-Id: I516f129dc73b5b98fd6c2d385690e51febfc00a3
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2014-09-09 13:46:50 +02:00
Dave Borowitz
d5836cf0f3 Merge topic 'inline-3'
* changes:
  InlineEdit: Expose UiAction to rebase change edit on latest patch set
  InlineEdit: Expose UiAction to publish change edit
  InlineEdit: Expose UiAction to delete change edit
  InlineEdit: Add UiActions support for change edits
  InlineEdit: Implement CS2 integration
  InlineEdit: GET change edit using /changes/{id}/edit REST endpoint
2014-09-09 11:24:41 +00:00
Orgad Shaneh
306ed3cb52 Display parents for all changes, not only merge commits
Bug: issue 2279
Change-Id: Iab4930b53e7968f2d6ae1e874b4b474004b4557b
2014-09-09 10:10:00 +00:00
Sven Selberg
5548420a44 Add icon support for revision weblinks
Enables a plugin to provide a URL to an image that
is displayed as the img of the link.

This change breaks previous plugins using the WebLink extensionpoint
and that don't implement getImageUrl().

Change-Id: I8a59f28e0ea8d3462f9f20f8da563d949a7a2f8b
2014-09-09 02:24:50 -07:00
David Ostrovsky
cdda331099 InlineEdit: Add UiActions support for change edits
Change-Id: I69989cfb3d4ddc29de8f308095d0c44536401716
2014-09-09 11:02:51 +02:00
Deniz Türkoglu
d7559c0768 Add Java 7 requirement for building gerrit
We don't support building with Java 8 yet, add the information to
build documentation.

Change-Id: I88b28b23e7c1275a44a8c8fa6082edae5df3333a
2014-09-08 11:30:58 +02:00
Yuxuan 'fishy' Wang
f780397780 Add buck rule to generate docs for static hosting.
Add rule to build search-free documentation for static hosting, and update
dev-release documentation to reflect the new rule.

Change-Id: Ifc9284d3c44349e3099ad582fcc14ba27695f30a
2014-09-05 14:19:15 -07:00
Yuxuan 'fishy' Wang
537664ad70 Add searchbox option to replace_macros.py.
Search boxes in documentation are useful when search feature is
available, but it's useless when we host the documentation statically.
Add this option so we can generate search-free version of the
documentation.

Change-Id: I35aadee989ae04b7bbcffd67011634cd0dd085c1
2014-09-05 14:19:15 -07:00
Hugo Arès
e05b9b2858 Merge branch stable-2.10
* stable-2.10:
  Add full names for options on list groups REST API
  Add full names for options on list projects REST API
  Make `-S` an alias of `--start` in changes query REST API
  Mention deprecation of sortkey parameters in 2.9 release notes
  Set the version to 2.10-SNAPSHOT
  Run change hooks and ref-updated events after indexing is done.
  Fix Guice module auto-discover for plugin providers
  Fix broken formatting in changes REST documentation
  Restrict the input of plugin_archetype_deploy.sh
  Gracefully handle `buck audit` failure
  Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit."

Conflicts:
	VERSION
	gerrit-extension-api/pom.xml
	gerrit-plugin-api/pom.xml
	gerrit-plugin-archetype/pom.xml
	gerrit-plugin-gwt-archetype/pom.xml
	gerrit-plugin-gwtui/pom.xml
	gerrit-plugin-js-archetype/pom.xml
	gerrit-war/pom.xml

Change-Id: I01f5e9ffa67058d914485c53c8c7b64643da4c84
2014-09-05 09:06:57 -04:00
David Pursehouse
b8eee7aae1 Merge branch 'stable-2.9' into stable-2.10
* stable-2.9:
  Add full names for options on list groups REST API
  Add full names for options on list projects REST API
  Make `-S` an alias of `--start` in changes query REST API
  Mention deprecation of sortkey parameters in 2.9 release notes
  Run change hooks and ref-updated events after indexing is done.
  Fix broken formatting in changes REST documentation
  Restrict the input of plugin_archetype_deploy.sh
  Gracefully handle `buck audit` failure
  Revert "Make VisibleRefFilter.Filter reuse the refs passed from JGit."

Conflicts:
	gerrit-server/src/main/java/com/google/gerrit/server/change/PutTopic.java
	gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
	tools/pack_war.py

Change-Id: I89a9b42c049ec1365ef6dec53c73c7a10a41e888
2014-09-05 19:13:31 +09:00
David Pursehouse
025ea3e560 Make -S an alias of --start in changes query REST API
The option had been added with the name `-S`.  Change the name
to `--start` with `-S` as an alias, making it consistent with the
naming in other REST APIs.

Add the option to the documentation.

Remove the documentation of `-P` and `-N`. These options only exist
to support online reindexing from clients with outdated JS, and are
deprecated. Keeping them in the documentation will potentially
cause confusion.

Bug: Issue 2878
Change-Id: I992acf4a3d1aeebb1ef40c6fed1afcb0fe26fa92
2014-09-05 18:39:50 +09:00