build: Keep CNAME file when updating gh-pages branch
The CNAME file on the gh-pages branch is used to link the gh-pages
to the gitblit.com domain. So it needs to stay around when updating
the gh-pages branch with new documentation pages.
This is possible since Moxie 0.10.0 with a new `keep` sub-element.
Florian Zschocke [Sat, 17 Dec 2022 17:21:18 +0000 (18:21 +0100)]
doc: Cleanup Google Code links and obsolete design description
Replace the links in NOTICE to the closed down Google Code
(code.google.com) with their Github counterparts where the projects
moved to.
Gitblit used to download dependencies upon first start. This has since
long been changed and everything is bundled with Gitblit now. So reflect
this in the design.mkd document, which still said they would be
downloaded.
The update of JGit broke pushes to tickets. The ReceiveCommand now
requires all three arguments, oldId, newId and name, to be not null.
The ticket code handling pushes to tickets left name and old id as
null in certain cases. This is fixed by always providing values.
fix: Correct misaligned images in primary repository URL display
Adding style element `max-width:inherit` as suggested by @piradix, which
makes the access restriction icon be part of the URL box again.
This fixes #1437
Florian Zschocke [Mon, 21 Nov 2022 20:14:56 +0000 (21:14 +0100)]
Remove clippy.swf and update documentation
The `clippy.swf` Flash program is no longer needed and can be deleted.
The configuration property is now incorrectly named, but we keep the
name and update the documentation. Maybe it could be completely deleted
one day, when the clipboard.js solution is known to work and be universally
supported.
Florian Zschocke [Mon, 21 Nov 2022 00:11:52 +0000 (01:11 +0100)]
Add a "Copied" tooltip to the copy-to-clipboard button
This is not the ideal version, since the height is too low for the tooltip
used for the drop-down menus. Probably has something to do with the
container or something. But at least something is there now, even if
not the most beautiful.
Florian Zschocke [Sun, 20 Nov 2022 17:53:26 +0000 (18:53 +0100)]
Replace SWF clippy with clipboardjs on repository page
Shockwave Flash is dead. But Gitblit still uses it to copy the repository
URLs to the clip board. Which doesn't work anymore since no browser uses
Flash anymore, so this has degraded disgracefully.
Instead, we can use JavaScript to copy directly to the clipboard, now
that there are APIs for it. So replace the use of clippy.swf on the
repository page with clipboard.js[1]. This right now only has the
functionality to copy to clipboard but now visual feedback, yet.
Adding Ed25519 keys brings the problem that with the library currently
used, the PublicKey instance of that key is not serialisable. This
results in an exception when wicket tries to cache the UsersPage.
So change the SshKeysPanel so that the PublicKey object is removed
from the `SshKey` when the panel is detached. It can be regenerated from
the raw key data.
Florian Zschocke [Sun, 13 Nov 2022 18:25:17 +0000 (19:25 +0100)]
deps: Update Jetty to version 9.4.49.v20220914
This updates Jetty to the latest 9.x version as of writing. The 9.x is
still running on Java 8. The update needs two code changes.
`SessionManager` was replaced with `SessionHandler`. This was documented
in the Jetty documentation.
Adding the `GitblitContext` to the `WebAppContext` will result in two
instances getting created, because the code was changed that prevents
instantiation the same listener class multiple times. (The second time
is when the web.xml is read.) Instead, it must be added to the servlet
handler of the `WebAppContext`. This results in properly adhering to the
changed internal startup flow.
Florian Zschocke [Fri, 11 Nov 2022 17:53:57 +0000 (18:53 +0100)]
fix: Fix jetty crashing when redirecting HTTP to HTTPS
Jetty 9.3 changed the `setHandler` on the ServletContextHandler to no
longer automatically detect SecurityHandler, SessionHandler, etc. It
simply passes on the setHandler request to the ContextHandler class
(with a warning logged). So make sure to explicitly use the method
`setSecurityHandler` to set the ContraintSecurityHandler responsible
for the http -> https redirection.
Florian Zschocke [Fri, 11 Nov 2022 11:58:02 +0000 (12:58 +0100)]
Merge branch 'jvanhercke-jgit-default-charset' into master
This branch mostly records the commit from PR #1253, so we have it in
the code base. The changes are immediately undone, because the update
to JGit version 4.8.0, as proposed in PR #1252, renders the whole
patching of JGit obsolete.
The update is done now, against reservations in that PR, because we
guess that potential issues have been found and fixed by now. JGit
is updated to the last version on the major version 4 line: 4.11.9.
Also, since upstream JGit is at v6 by now, more updates will have to
happen later on anyways.
To make the protection against illegal character sets complete, an
additional fix for Bugtraq is included, that protects against exceptions
from bugtraq should it encounter an `encoding` that cannot be handled.
Florian Zschocke [Fri, 11 Nov 2022 11:56:47 +0000 (12:56 +0100)]
deps: Update JGit to 4.11.9.201909030838-r and other dependencies
Update JGit, and also update other dependencies where the 4.11 JGit
version uses newer versions than we do:
commond-codec updated to 1.9
commons-compress updated to 1.15
gson updated to 2.8.2
Florian Zschocke [Fri, 11 Nov 2022 11:14:55 +0000 (12:14 +0100)]
bugtraq: Catch exceptions from bugtraq and show message
Catch all exceptions, and not just IOExceptions, from bugtraq formatter.
If an exception is caught, ignore the bugtraq handling of the commit
message and show the plain message. Way better then not showing anything
just because something broke in bugtraq.
Florian Zschocke [Fri, 11 Nov 2022 11:12:13 +0000 (12:12 +0100)]
bugtraq: Fallback to UTF-8 if commit encoding is unsupported
Reading the encoding of a commit can result in a Unsupported- or
IllegalCharsetException. This happens when for whatever reason the
commit has an encoding recorded that the system doesn't understand.
Instead of completely failing, fallback to UTF-8.
Florian Zschocke [Fri, 11 Nov 2022 10:58:23 +0000 (11:58 +0100)]
Remove workaround for JGit crashing on 'utf-9' etc
Updating JGit fixed the issue that a commit in a repo with an unknown
character set throws an exception. This would crash the RepositoryManager.
The extra handling, which patches JGit classes during runtime is completely
removed.
ci: Delete nightly build artefact after testing the container
Leave the artefact until after the container has been built and tested.
In case the test fails the artefact can be still downloaded to analyse
what might have caused the container build or test to fail.
This brings back in a change that was implemented in a pull request
from 2017, but got lost in the chaos of multiple pull requests from
intermingling branches.
This does not only provide feedback when a SSH key cannot be parsed,
but it also does so in a way that the warning goes away when a correct
key is added. Admittedly, I have no idea how to properly do this with
a Wicket FeedbackMessage, all I could find on Google was highly
complicated.
Not only does this bring back (or really in) the fix for issue #1226,
but it also fixes #984.
Replace key feedback with label instead of FeedbackMessage
Since it is a pest to get rid of a Wicket FeedbackMessage in an AJAX target,
change the code to use an extra label that can provide feedback if the
key could not be parsed or was empty.
The Github 'checkout' action was updated from v1 to v3. But the behaviour
changed between the two which broke this workflow.
The old action would clone other repositories not into the workspace
but parallel to the workspace. The new version does every clone/checkout
relative to the workspace. That means that where previously the
gitblit-docker repository would be cloned in parallel to the workspace
which is gitblit/gitblit, it is now cloned into the gitblit/gitblit
directory path.
So remove all the references to `../gitblit-docker`. The files are in
the current directory now.
Florian Zschocke [Mon, 31 Oct 2022 23:50:14 +0000 (00:50 +0100)]
authority: Fix null pointer crash for deleted users
When a user had a certificate, i.e. an entry in the Gitblit Authority
database, but the user was deleted from the Gitblit database, then the
Authority application crashes upon loading. This patch prevents the
crash. The deleted user is no longer shown in the Authority. But the
database entry still is kept. This should be improved to show deleted
users and give the possibility to delete them from the Authority's
database.
Florian Zschocke [Thu, 27 Oct 2022 21:26:44 +0000 (23:26 +0200)]
deps: Update Guice version to 5.1.0
Update Guice to 5.1.0. This version is compatible with Java 17.
The gitblit patch of the servlet extension was ported to Guice 5.1.0,
too.
The update of Guice requires an update of the Guava version, too.
Thus Guava is updated to 27.0.1-jar.
Florian Zschocke [Wed, 26 Oct 2022 16:03:40 +0000 (18:03 +0200)]
ci: Update action versions in push build workflow
The workflow runs started issuing warnings because NodeJS 12 was
deprecated. Actions need to get updated to newer versions that use
NodeJS 16. This commit updates the `actions/checkout` and the
`actions/setup-java` actions to the latest version in the workflow that
builds on every push.
The new setup-java action requires the distribution to be specified,
since multiple JDK distributions are supported now. We chose Eclipse's
Temurin here which is the successor to AdoptOpenJDK, which we use for
development.
Florian Zschocke [Mon, 24 Oct 2022 22:00:03 +0000 (00:00 +0200)]
Skip SSH host key files that do not exist
Since we now do not generate a DSA host key file anymore, but keep it in
the list of potential keys so that existing keys still work, it can
happen that the files for DSA (and Ed25519) are getting loaded but they
do not exist. This results in an error in the log.
So instead check if the file exists and only try to load files that
exist. This prevents from errors (which are none) being spammed in the
log.
Create new host keys, one with ECDSA and one with Ed25519 algorithms.
For the Ed25519 currently the EdDSA library from i2p is used. This
requires some quirks, compared to a modern BouncyCastle. But the SSHD
library used cannot use BouncyCastle yet for Ed25519.
No DSA key is generated anymore, but we still support existing ones.
The version 1.69 is chosen instead of 1.70, because the moxie build
would not download the jars, trying to download `...1.7.jar` instead.
Three class deprecations are fixed. `PEMWriter` and `X509Extension`
are replaced with their drop-in replacements `JcaPEMWriter` and
`Extension`. The `PasswordFinder` deprecation note says that "it is
no longer used". It also was never used in Gitblit's code, so it is
removed from the key par provider class.
Florian Zschocke [Sun, 14 Aug 2022 12:45:58 +0000 (14:45 +0200)]
Use existing setting but with new values
Instead of adding another setting and having to explain how the new one
and the existing `requireClientCertificates` setting are interdependent,
let's use the existing setting and add new values.
It is changed from a boolean to a string, with the values `required`,
`optional` and `disabled`. To keep backward compatibility with the old
values, the `true` value is mapped to `required` and the `false` value
is mapped to `optional`.
This also removes the additional Set. What changes is that the order of
the repositories is kept, but the resulting list will have user and team
permissions intertwined.
Florian Zschocke [Sun, 13 Mar 2022 17:03:17 +0000 (18:03 +0100)]
fix: Fix StoredUserConfig not escaping control characters
The `StoredUserConfig` only escaped the escape character, i.e. backslash.
But it does not escape control characters like tab or newline. This
introduces a vulnerability where an attacker can create new entries
in their user account and create new accounts.
In addition, other characters are also not properly handled. Field values
with a comment character need to be quoted. This only happens for the
`#` character and only when the value starts with it. Also the quote
is note escaped in values.
This change completely rewrites the `escape` method of `StoredUserConfig`.
It takes care of properly escaping characters that need escaping for the
git configuration file format.
Te `StoredUserConfig` did not handle sections without a subsection.
When the subsection did not exist, i.e. was `null`, then the subsection
name would be set to the string "null". This is not how the config file
format works. It should create a `[SECTIONNAME]` entry instead.
This fix handles a `null` subsection correctly, by handling it as a
section without a subsection.
Florian Zschocke [Sun, 14 Nov 2021 11:03:46 +0000 (12:03 +0100)]
ci: Allow to force build a nightly version
Enable a switch for manual workflow triggering that overrides the check
if a new commits were made since the last build. If the input is set to
'true', a new build is run even when no new commits are present.
This is mainly so that changes to the gitblit-docker repo can be included
in builds. This could also be automated in the workflow, if need be.