summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/utils
Commit message (Collapse)AuthorAgeFilesLines
* dep: Update JSoup to 1.16.2Florian Zschocke2023-10-311-4/+4
| | | | | | | Update JSoup to version 1.16.2. This requires renaming `Whitelist` to `Safelist`, because the class name was changed in version 1.15.1 in a breaking change.
* Merge pull request #1456 from flaix/sha256Florian Zschocke2023-10-151-31/+76
|\ | | | | Add SHA-256 hash calculation to StringUtils
| * Add function to calculate SHA-256 has sum to StingUtils.Florian Zschocke2023-10-151-0/+22
| |
| * Refactor StringUtils to provide message digest in common functionFlorian Zschocke2023-10-151-31/+54
| | | | | | | | | | | | | | | | | | | | The calculation of a MD5 and SHA-1 sum are all message digest implementations. Instead or replicating the same code over and over again, provide a common function for message digest calculation which can do this for different algorithms based on the algorithm name passed as a parameter. Then replace the existing `getMD5` and `getSHA1` functions by calling the common function passing the respective algorithm name.
* | Fix single quotes in MessageFormat patterns.Egor Shchegolkov2023-10-141-3/+3
|/
* bugtraq: Catch exceptions from bugtraq and show messageFlorian Zschocke2022-11-111-3/+3
| | | | | | | 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.
* Remove workaround for JGit crashing on 'utf-9' etcFlorian Zschocke2022-11-111-116/+0
| | | | | | | 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.
* Add wrapper class to return a default encodingJan Vanhercke2022-11-091-0/+116
| | | | | Unknown encodings may cause gitblit to fail to start. This modification injects a wrapper class in the JGit internal to fake a valid return value.
* Update BouncyCastle to version 1.69Florian Zschocke2022-10-251-17/+16
| | | | | | | | | | | 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.
* Fix: if statement without curly bracesQuentin2022-08-021-1/+2
|
* Changed tab to space conversionQuentin2022-08-021-1/+8
| | | | | Tabs are not always 4 spaces large. It completes the line to the 4th character.
* Detect and report if running in containerFlorian Zschocke2021-12-101-0/+74
| | | | | | | To help with analysis, try to detect if the instance is running inside a container. Some containers are detected, but this is probably not exhaustive. At least a Docker container should be detectable. Report in the runtime manager to the log if a container was detected.
* TimeUtils: Change daysAgo to calculate difference in calendar daysFlorian Zschocke2021-10-241-1/+52
| | | | | | | | | | | | | The `daysAgo` method seemed to want to normalize on a calendar day? I can't really tell what it was trying to do, but the problem is that it does not take into account any time shift due to time zones so it never really worked outside of GMT. So instead a new `calendarDaysAgo` method is added (because I am unsure on what the `daysAgo` method is trying to do. It can probably be removed). The new method cleanly calculates difference in calendar days because it normalizes the two given time stamps on the same time zone. The `timeAgo` method now used the new method. This fixes #1248.
* TimeUtils: Move unit test to same package as TimeUtils isFlorian Zschocke2021-10-231-5/+5
| | | | | | | | | | For some reason the `TimeUtilsTest` class is, like almost all tests, in the `com.gitblit.tests` package. But this way all methods in classes which we might predominately need for tests have to be public. So move the unit test class `TimeUtilsTest` to the same package as the class it is testing, i.e. `com.gitblit.utils.TimeUtils`. This way we ca set the new added methods which get the current time passed in to be at least not public.
* TimeUtils: Increase testability and add testsFlorian Zschocke2021-10-231-8/+32
| | | | | | | | | Add tests for `timeAgo` to analyse issue #1248. The tests are dependent on when they run as they time functions use the current date and time. To make them testable in a reproducible way, we need the ability to pass in what we think is "now". So add overloaded methods that take a `now` parameter so that we can pass in the current time.
* Delete password from memory in AuthenticationManagerFlorian Zschocke2020-04-051-0/+15
| | | | | | Zero out the password to remove it from memory after use. This is only a first step, implementing it for one method: `AuthenticationManager.authenticate(String, char[], String)`.
* Merge branch 'pingunaut-1166_more_secure_password_hashes' into master.Florian Zschocke2019-11-063-4/+568
|\
| * Use the new PasswordHash classes.Florian Zschocke2019-11-053-219/+57
| | | | | | | | | | | | Integrate the `PasswordHash` class and subclass in the user and password editing and authentication. Replaces the old code and the previous `SecurePasswordHashingUtils` class.
| * Add support for PBKDF2 to PasswordHashFlorian Zschocke2019-11-052-10/+326
| | | | | | | | | | | | | | | | Integrate the work of pingunaut to add support for PBKDF2 password hashing. A new class `PasswordHashPbkdf2` is added, which builds on his `SecurePasswordHashUtils` class, but makes it a subclass of `PasswordHash`. This will replace the original class when integrating the new PasswordHash way into GitBlit.
| * Add a PasswordHash class as a central place to deal with password hashes.Florian Zschocke2019-11-051-0/+220
| | | | | | | | | | | | | | | | | | | | | | | | Instead of having to deal with the implementation details of hashing and verifying passwords in multiple places, have a central unit be responsible for it. Otherwise we need to edit three different places when adding a new hashing scheme. With this class adding a new hashing scheme just requires creating a new subclass of `PasswordHash` and registering its type in the enum `PasswordHash.Type`. The rest of the code will use a common interface for all hashing schemes and doesn't need to be changed when a new one is added.
| * Update AuthenticationManager to update weakly stored passwords on loginMartin Spielmann2017-01-071-4/+20
| |
| * Added possibility to use secure hashes to store passwordsMartin Spielmann2017-01-011-0/+174
| | | | | | | | Addresses #1166
* | Escape folder names in JGitUtils to allow special characters. Fixes #999Martin Spielmann2019-06-101-3/+3
| |
* | Do not resolve symbolic links to repositories.Florian Zschocke2019-06-101-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When symbolic links under the base repository folder point to repositories outside the base repository folder, the forming of relative repository names failed and resulted in NullPointerExceptions. Create the relative path by not following symbolic links, i.e. the link name is taken as is and not resolved to the external path. This also changes the whole `exactPath` method to work on Paths, instead of Files. Fixes #891 and fixes #837.
* | Reindex tickets on server start if no index existsFlorian Zschocke2017-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check if tickets need to be reindexed when the server starts. This is the case if no ticket index exists. In that case the ticket index is built. This is done during the start of the `ITicketService`. For this the interface of `ITicketService` needed to change. The `start` method was defined abstract and the specific ticket services had to implement it. None does any real starting stuff in it. The `start` method is now final. It calls a new abstract method `onStart` which the specific ticket services need to implement. In the existing implementations I just changed `start` to `onStart`.
* | Introduce an index version for the ticket indexFlorian Zschocke2017-03-051-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to be able to update the index definition, the ticket index is assigned a version number, 2. This way the definiton can be updated and compatability with existing index files can be checked. The actual index is stored in a directory of name `indexVersion_codecVersion`. This wayit is veriy easy to check if an index of a certain version exists on the filesystem. It allows to have multiple indexes of different versions present, so that a downgrade of the software is possible without having to reindex again. Of coure, this is only possible if no new tickets were created since these would be missing in the old index. A new class `LuceneIndexStore` is introduced, which abstracts away the versioned index directory. The idea is, that this provides one place to keep the Lucene codec version and to allow to code compatibility rules into this class, so that older indices can still be used if they are compatible.
* | Fix #1114 HttpUtils getGitblitURL does not support nonstandard portsJan Breuer2017-02-151-1/+3
| | | | | | | | | | X-Forwarded-Host can contain port number and it is added twice in that situation This fix just prevent adding port number if it is already there
* | Sending email (certificate zip file) based on locale that user selectedwilliam2017-01-241-2/+30
|/
* Merge branch 'rcaa-master' into master.Florian Zschocke2016-12-131-0/+83
|\
| * Introduce SecureRandom wrapper for properly seeded static instancesFlorian Zschocke2016-12-121-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduce our own wrapper `SecureRandom` around `java.security.SecureRandom`. This a) makes sure that the PRNG is seeded on creation and not when random bytes are retrieved, and b) uses a static instance in the `UserModel` so that lags do not occur during operation due to potentially seeding getting blocked on Unix when reading from the system's entropy pool. To keep the random data still secure, the static instance will reseed all 24 hours, also a functionality of the wrapper class. This fixes #1063 and extends and closes PR #1116
* | Merge branch 'fixMentionsInTickets-985'Florian Zschocke2016-12-121-2/+3
|\ \
| * | Fix user mention regular expression and group replacement.merged--fixMentionsInTickets-985Florian Zschocke2016-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regular expression used for user mentions used to work only inside sentences. Also, since it tested for whitespace, the whitespace would get replaced, too, which would join lines together. Instead the new regex uses boundary matchers to match against word boundaires. As these are not capturing only the actual user mention can be captured and is then replaced. Also, this way the regex can ignore punctuation like in "@jim, look at this." Since Gibtlit now requires Java 7 we can use named capture groups. This makes the use of a centrally defined regular expression much safer. The (admittedly only) group to capture the user name is named "user" and can be referenced by this name. By using the name instead of a group number, the regex could be changed without the code using it breaking because the group number changed. A simple test is added for user mentions, which unfortunately has to deal with the full markdown replacement, too. Fixes #985
| * | Use REGEX_TICKET_MENTION instead of hardcoded regular expressionGlenn Matthys2016-12-101-1/+2
| |/
* | Merge pull request #1142 from fzs/merge-strategyJames Moger2016-10-281-65/+278
|\ \ | | | | | | Merge strategy
| * | Add integration strategy to merge tickes fast-forward or with commit.Florian Zschocke2016-10-281-65/+278
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Add the option to merge a ticket branch to the integration branch only when it can be fast-forwarded, or always with a merge commit, or by fast-foward if possible, otherwise with a merge commit. Adds a new property ticket.mergeType with the valid values FAST_FOWARD_ONLY, MERGE_ALWAYS and MERGE_IF_NECESSARY. Merging and canMerge were refactored to make use of a new IntegrationStrategy class for each type of strategy.
* / Issue #1076: load commit cache in a background threadTom2016-10-272-51/+68
|/ | | | | | | | | | * Make the CommitCache fully thread-safe. It was using a ConcurrentHashMap containing lists, but then handed out these lists. It also did multiple operations on that map that as a whole should be atomic. * Use isEmpty() instead of size() == 0. * Run the loading of the commit cache in a background daemon thread
* Merge pull request #1055 from gitblit/1048-TicketReferencesPaul Martin2016-06-181-3/+168
|\ | | | | Ticket Reference handling #1048
| * Ticket Reference handling #1048Paul Martin2016-04-271-3/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + Supports referencing: + Tickets from other tickets via comments + Tickets from commits on any branch + Common TicketLink class used for both commits and tickets + TicketLink is temporary and persisted to ticket as a Reference + Support deletion of ticket references + Rebasing patchsets/branches will generate new references + Deleting old patchsets/branches will remove the relevant references + Substantial testing of use cases + With and without patchsets, deleting, amending + BranchTicketService used during testing to allow end-to-end ref testing + Relocated common git helper functions to JGitUtils
* | fix baseURL handling in HttpUtils, fixes #1083Dirk Steinkopf2016-06-121-2/+14
|/
* Fix for #962 - Delete patchset abilityPaul Martin2016-04-061-7/+3
|
* Friendly URL for EditFile Page #974Paul Martin2016-03-271-0/+17
| | | | + Prevent Edit of old doc version
* Document edit capability via ProseMirror submodule #974Paul Martin2016-03-271-0/+131
| | | | | | | | | | | | + New docEdit page with links from docPage and docList + Bespoke menu system with full screen edit mode + npm required for building client side scripts + Ant script added for BuildUI which performs npm commands + Update font-awesome to 4.5.0 + Factor out to JGitUtils common code in BranchTicketService for EditFilePage + getTreeEntries + commitIndex + Merge capability for document editing
* Fix for #976 - Filestore links via browserPaul Martin2015-12-255-47/+196
| | | | | | | | | | | | | + GitLFS client support + FilestoreModel now parses meta file + Read meta heading from cache if available + Authentication based on accept headers for browser view filestore login + PathModel & PathChangeModel now understands filestore items + Zip & Rar downloads contain include filestore items + Filestore servlet returns LFS JSON error only if accepted by client + DiffStat now knows repository to allow identification of filestore items + Filestore items identified and returned via view, raw & blob links on blame, commitDiff, commit and Tree pages
* Fix 2 possible NullPointer occurencesmarco2015-11-231-1/+10
|
* Git-LFS supportPaul Martin2015-10-101-7/+14
| | | | | | | | | | | | | | + Metadata maintained in append-only JSON file providing complete audit history. + Filestore menu item + Lists filestore items + Current size and availability + Link to GitBlit Filestore help page (top right) + Hooks into existing repository permissions + Uses default repository path for out-of-box operation with Git-LFS client + accessRestrictionFilter now has access to http method and auth header + Testing for servlet and manager
* Use author date to be consistent with other tools (fixes #919)James Moger2015-09-182-3/+6
|
* Update to Pegdown 1.5.0James Moger2015-09-181-1/+2
|
* Merged #258 "Create an avatar provider that defaults to Gravatar"James Moger2015-06-151-2/+2
|\
| * Revised AvatarGenerator to be injectableJames Moger2015-06-151-2/+2
| |
* | Bump to JGit 4.0.0Luca Milanesio2015-06-123-18/+18
|/ | | | | JGit 4.0.0 fixes a memory leak but introduces a non-compatible change for closing the RevWalk: before it was release() but now is close()