Hi,
Update on this issue: I found the cause and a workaround.
Setup now:
- Collaboration Server 2.5.1 (registry.greendelta.com/hub/collaboration-server@sha256:f9500c848be4bf008c192a9fcfe1af5c358e1afa87dec0d5dc9b61c7da25e889).
- openLCA 2.6.2 and 2.7.1.
- With 2.5.1, push and pull with 2FA work locally (docker compose, no proxy). In production (Kubernetes, HAProxy ingress with TLS) push still fails with 400 Bad Request.
Cause: when a git push arrives without a token, the server answers HTTP 400 (tokenRequired). The client is supposed to recognise this and ask for the token. In org.openlca.app.collaboration.navigation.actions.Actions, that check is done on the exception message:
var tokenRequired = m.endsWith("400 null");
This only matches when the HTTP response has no reason phrase. Tomcat sends HTTP/1.1 400 without one, so it works when the client talks to Tomcat directly. Our ingress, like most reverse proxies and any HTTP/2-to-HTTP/1.1 translation, sends HTTP/1.1 400 Bad Request. The message then ends with 400 Bad Request, the check fails, the token prompt never appears, and the error is shown instead. RFC 9112 says clients should ignore the reason phrase, so I think the check should use the status code rather than the message text. The same applies to the 424 null check in that method.
How I verified it:
- On a direct request, the server log shows Login attempt failed: 400 BAD_REQUEST "tokenRequired".
- Locally the client then shows a token prompt and the push succeeds. Behind the ingress, no token prompt appears.
- curl --http1.1 -I against both servers: local returns HTTP/1.1 302, production returns HTTP/1.1 302 Found.
Workaround: the server also accepts the token appended to the password. When openLCA asks for the password on push, enter <password>&token=<6-digit code>. With that, push works against our server.
It would be great if this could be fixed in the openLCA desktop app :)
Thanks!
Tal
-----
Hi,
We are hosting an instance of the CS internally in our organization. Everything works smoothly except the 2FA. When I connect to the remote repository I am prompted to enter the user name, password and token which seems to go work without a problem, but when I try to push/pull i get the following error message:
# Error pushing to remote
## Installation details
- openLCA version: 2.6.2
- Operating system: Mac OS X
- OS architecture: x86_64
- OS version: 26.6
- Native library: Intel MKL
## Full error stack trace
```
org.openlca.collaboration.model.WebRequestException: org.eclipse.jgit.api.errors.TransportException: https://lca-collaboration-server.self-hosted-instance.de/test/test: 400 Bad Request
at org.openlca.app.collaboration.navigation.actions.Actions.handleException(Actions.java:53)
at org.openlca.app.collaboration.navigation.actions.PushAction.run(PushAction.java:70)
at org.openlca.app.collaboration.navigation.actions.CommitAction.run(CommitAction.java:61)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:581)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:415)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4660)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1657)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1680)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1665)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1394)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4427)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4003)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.openlca.app.rcp.RcpApplication.start(RcpApplication.java:13)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
Caused by: org.eclipse.jgit.api.errors.TransportException: https://lca-collaboration-server.self-hosted-instance.de/test/test: 400 Bad Request
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:168)
at org.openlca.git.actions.GitPush.run(GitPush.java:47)
at org.openlca.git.actions.GitPush.run(GitPush.java:16)
at org.openlca.app.collaboration.navigation.actions.Actions$GitRemoteRunner.run(Actions.java:157)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:123)
Caused by: org.eclipse.jgit.errors.TransportException: https://lca-collaboration-server.self-hosted-instance.de/test/test: 400 Bad Request
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:729)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:637)
at org.eclipse.jgit.transport.TransportHttp.openPush(TransportHttp.java:541)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:140)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1533)
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:158)
... 4 more
```
I tried using both the secrete key and the OTP as a token, both resulted in the same error.
When I create a CS via Tools->API Clients ->CS Server -> +new CS and I use the OTP as a token, it seems the connection works as I can see the dropdown of the repositories on the server. So the issue is only for pull/push. When I remove the 2FA, the issue is resolve. I couldn't find any thing about 2FA in the documentation.
The issue occurs both when I run a local Docker image and in our production environment.
Local: docker compose on localhost:8080, no reverse proxy or TLS.
Production: Kubernetes deployment via Helm chart, MariaDB, HAProxy ingress with TLS + OpenSearch Container
docker image: registry.greendelta.com/hub/collaboration-server@sha256:bb719318a9407a944338859600e65829de841f95ee830c38e664536dc9979de6
Thanks in advance!
Tal