Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: gerrit
Branch: stable-3.10
Author: Luca Milanesio <
Link:
Allow UploadValidator plugins to return validation errors to clients
Expand for full commit details
Allow UploadValidator plugins to return validation errors to clients
The introduction of Change 192677 in JGit [1] has propagate all the
HTTP status codes to the Git client, causing the breakage of all
plugins that were implementing the UploadValidationListener interface.
UploadValidationListener(s) were introduced to:
"
[...] block the upload operation by throwing a ValidationException.
The exception's message text will be reported to the end-user over
the client's protocol connection.
"
The HTTP status processing in the Smart-HTTP protocol in Git [2]
says that the HTTP servers should use the HTTP status codes 404,
410, 403 and 304 for some of the operations, however, those have
been ignored by the JGit server-side stack for many releases until
JGit v6.1, where they have been then propagated as-is to the Git
client in [1].
The only way at the moment that a validation exception can be
reported to the Git client is therefore to return an HTTP 200
so that the JGit server will propagate it to the Git client and
can be displayed as expected.
[1] https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/192677
[2] https://git-scm.com/docs/http-protocol#_general_request_processing
Bug: Issue 389368407
Release-Notes: Fix the reporting of UploadValidationListener(s) feedback to the Git client
Change-Id: I671f0bb3263f34ad0eea00f45629323fc66de7c9
Files:
- M
java/com/google/gerrit/server/git/validators/UploadValidationException.java
Hash: fb2a49123c0c7b7ac86fccb562f108a98394a351
Date: Sun Jan 12 09:35:53 2025
ap...@google.com <ap...@google.com> #3
Project: gerrit
Branch: stable-3.10
Author: Luca Milanesio <
Link:
Test UploadValidatorListener validation message is returned during upload-pack
Expand for full commit details
Test UploadValidatorListener validation message is returned during upload-pack
Add the missing test that verifies Change 56191 which introduced the
UploadValidationListener extension point and its management in the
UploadValidators during the PreUploadHook phase of JGit upload-pack.
The lack of testing of the UploadValidationListener has lead to the
Issue 389368407 which would have been avoided if the extension had
a proper test coverage.
Release-Notes: skip
Change-Id: I7bdd511a48ac5094073d2f1a639943a83ec3ae89
Files:
- M
javatests/com/google/gerrit/acceptance/git/AbstractGitOverHttpServlet.java
Hash: c67675f05ec05c77d503684a15beda5dfd9b142a
Date: Sun Jan 12 13:54:42 2025
Description
*** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!! *** Do not submit bugs for chrome/android and issues with your company's *** Gerrit setup here. Those issues belong in different issue trackers.
What steps will reproduce the problem?
What is the expected output?
The message "foo" is sent to the client and the upload-pack is terminated.
What do you see instead?
The Git client receives:
error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
Please provide any additional information below.
This regression has been caused byhttps://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/192677 where any HTTP status codes reported by JGit are sent as HTTP status codes to the Git client, which believes the RPC has failed.
This has been working until Gerrit v3.4 (using JGit 5.13) and then started to fail from Gerrit v3.5 (using JGit 6.x) onwards.