Commit Graph

14657 Commits

Author SHA1 Message Date
Edward Thomson
42e5db98b9 Merge pull request #6450 from libgit2/1.5_ssh
ssh: perform host key checking by default
v1.5.1
2023-01-20 22:11:52 +00:00
Edward Thomson
1fda949267 meta: add changelog for v1.5.1 2023-01-18 23:02:12 +00:00
Edward Thomson
6a4421ff33 meta: update version numbers to 1.5.1 2023-01-18 23:00:47 +00:00
Carlos Martín Nieto
63212a929d ssh: look for a key in known_hosts to set the key type for the handshake
The server and client negotiate a single hostkey, but the "best" cipher may not
be the one for which we have an entry in `known_hosts`. This can lead to us not
finding the key in known_hosts even though we should be connecting.

Instead here we look up the hostname with a nonsense key to perform a lookup in
the known hosts and set that. This is roughly what the OpenSSH client does as
well.
2023-01-18 22:59:30 +00:00
Carlos Martín Nieto
52ebc04774 tests: move online::clone::ssh_auth_methods into the ssh test suite
We're currently running it as part of the online suite but that doesn't have any
setup for ssh so we won't find the GitHub keys we set up during the test.

It doesn't need the private key setup as we just want to make sure we see some
auth request from the server, but with the addition of hostkey checking we're
now seeing it fail when we skip these tests.
2023-01-18 22:59:30 +00:00
Carlos Martín Nieto
6e5b1498d0 tests: append the github.com ssh keys so we have access during tests
Currently just the one test needs it.

The ssh-rsa makes sure we're asking for the cipher we find in `known_hosts` as
that won't be the one selected by default. This will be relevant in later changes.
2023-01-18 22:59:30 +00:00
Carlos Martín Nieto
6d63afcee7 ssh: verify the remote's host key against known_hosts if it exists
It turns out this has been available in libssh2 for a long time and we should
have been verifying this the whole time.
2023-01-18 22:59:30 +00:00
Edward Thomson
fbea439d4b Merge pull request #6351 from libgit2/ethomson/v1.5.0
v1.5.0
v1.5.0
2022-07-13 20:06:59 -04:00
Edward Thomson
2be53a5da7 v1.5: update version numbers 2022-07-13 12:50:01 -04:00
Edward Thomson
2030358070 v1.5: update the changelog 2022-07-13 12:50:01 -04:00
Edward Thomson
fb02e339fe meta: update release.yml for security information 2022-07-13 12:27:43 -04:00
Edward Thomson
3c8a860df4 Merge pull request #6348 from lya001/fix-invalid-branch-name
Fix creation of branches and tags with invalid names
2022-07-13 10:19:14 -04:00
Edward Thomson
be08ef7fd7 Update src/libgit2/tag.c 2022-07-12 22:39:25 -04:00
Edward Thomson
b70dbaa2f2 Merge pull request #6347 from libgit2/ethomson/no_pack_v3
pack: don't pretend we support pack files v3
2022-07-12 22:12:36 -04:00
Edward Thomson
f6be8c2697 Apply suggestions from code review 2022-07-12 22:09:25 -04:00
Edward Thomson
53cfad9e4b Merge pull request #6350 from libgit2/ethomson/zlib
zlib: update bundled zlib to v1.2.12
2022-07-12 15:07:11 -04:00
Edward Thomson
4ae8704b9f Merge pull request #6349 from libgit2/ethomson/cve-2022-29187
Fixes for CVE 2022-29187
2022-07-12 14:42:50 -04:00
Mark Adler
af76267ad7 zlib: Silence some warnings from Visual Studio C. 2022-07-12 14:27:46 -04:00
Andrzej Hunt
39ba0ee604 zlib: slide_hash: add MSAN annotation to suppress known read from uninitialised memory
slide_hash knowingly reads (possibly) uninitialised memory, see comment
lower down about prev[n] potentially being garbage. In this case, the
result is never used - so we don't care about MSAN complaining about
this read.

By adding the no_sanitize("memory") attribute, clients of zlib won't
see this (unnecessary) error when building and running with
MemorySanitizer. An alternative approach is for clients to build zlib
with -fsanitize-ignorelist=... where the ignorelist contains something
like 'fun:slide_hash'. But that's more work and needs to be redone
for any and all CI systems running a given project with MSAN. Adding
this annotation to zlib's sources is overall more convenient - but
also won't affect non-MSAN builds.

This specific issue was found while running git's test suite, but has
also been reported by other clients, see e.g. #518.
2022-07-12 14:27:46 -04:00
Edward Thomson
6febb7d767 zlib: declare prototypes for new functions
The `crc32_combine_gen64` missed a prototype in our define path.
Add one.
2022-07-12 14:27:46 -04:00
Edward Thomson
2db6cdcd66 zlib: updated bundled zlib to v1.2.12 2022-07-12 14:27:46 -04:00
Edward Thomson
ed24b8bacc repo: allow users running with sudo to access their repositories
In the ownership checks implemented for CVE-2022-24765, we disallowed
users to access their own repositories when running with `sudo`.

Examine the `SUDO_UID` environment variable and allow users running
with `sudo`. This matches git's behavior.
2022-07-12 14:12:48 -04:00
Edward Thomson
af9e00321f repo: validate gitdir and gitlink ownership
To match git's behavior with CVE 2022-29187, validate not only the
working directory, but also the gitdir and gitlink (if it exists). This
a follow up to CVE-2022-24765 that was fixed earlier.
2022-07-12 14:12:48 -04:00
Edward Thomson
d1001fd05b Merge pull request #6341 from libgit2/ethomson/ownership2
Fix erroneously lax configuration ownership checks
2022-07-12 14:12:15 -04:00
yuangli
760a5acc73 Merge branch 'main' into fix-invalid-branch-name 2022-07-12 15:07:54 +01:00
yuangli
1912f145e1 tests: free resources in invalid tag name test 2022-07-11 15:53:35 +01:00
yuangli
7456e81934 tests: error when create tag with invalid name 2022-07-11 15:42:16 +01:00
yuangli
fe9bfec46b tag: refactor tag name validity checks 2022-07-11 15:35:15 +01:00
yuangli
7560ac4d2f branches: fix error message for invalid name 2022-07-11 15:25:51 +01:00
yuangli
724b5a0e97 tests: rename to follow clar naming convention 2022-07-11 15:24:34 +01:00
yuangli
2e9228e85a tests: rename test for consistency 2022-07-11 15:23:41 +01:00
yuangli
391afec497 branch: refactor branch name validity checks 2022-07-11 13:54:38 +01:00
yuangli
71fafae17a tests: error when create branch with invalid name 2022-07-11 12:03:37 +01:00
yuangli
e4f98ac4b8 tests: follow clar naming convention 2022-07-11 12:00:23 +01:00
Edward Thomson
4597b869f7 pack: don't pretend we support pack files v3
Pack files v3 are introduced in the SHA256 hash transition document
https://github.com/git/git/blob/master/Documentation/technical/hash-function-transition.txt

Obviously we do not support these yet. Stop pretending that we do.
2022-07-08 21:30:21 -04:00
Edward Thomson
56aaaf532d repo: allow admin owned configs by admin users
Allow users in the administrator group to use git configs that are owned
by administrators.
2022-07-07 10:38:01 -04:00
Edward Thomson
5bc01a7ddb fs: allow ownership match if user is in admin group
Allow the user ownership to match if the file is owned by the admin
group and the user is in the admin group, even if the current process is
not running as administrator directly.
2022-07-07 10:37:54 -04:00
Edward Thomson
433f0166c9 fs: refactor file ownership checks
Refactor the file ownership checks so that callers can provide discrete
information about the ownership expectations to a single function.
2022-07-07 10:37:49 -04:00
Edward Thomson
df354ec25d fs: remove mock naming from change ownership constants
The file ownership concepts can reflect the actual file ownership, they
are not necessarily limited to mocking the interface. Rename them so
that they can be more broadly applicable.
2022-07-07 10:37:44 -04:00
Edward Thomson
78af6b5eb6 repo: add tests for bare repo permissions
Ensure that we test opening a bare repository with odd permissions.
2022-07-07 10:37:02 -04:00
Edward Thomson
f51f66468a Revert "repo: allow administrator to own the configuration"
This reverts commit cdff2f0237.

This change erroneously allowed system users to own a worktree; this
should only be allowed when the current user is in the Administrator
group on Windows as well.
2022-07-07 10:36:52 -04:00
Edward Thomson
92ffdd2cd2 Merge pull request #6333 from jpalus/pcre2-detection
cmake: drop posix dependency from pcre* detection
2022-07-07 09:43:56 -04:00
Jan Palus
636a275218 cmake: drop posix dependency from pcre* detection
since f585b12 neither PCRE nor PCRE2 backends rely on POSIX regex, so
reflect it in library detection logic
2022-07-07 10:50:08 +02:00
Edward Thomson
50a1f6374f Merge pull request #6334 from i-tengfei/fix-rebase-interactive
fix interactive rebase detect.
2022-07-07 00:28:56 -04:00
Edward Thomson
b34b831c97 Merge pull request #6335 from kcsaul/fix/config-find-system-file
Fix internal git_sysdir_find* function usage within public git_config_find* functions
2022-07-06 23:21:30 -04:00
Edward Thomson
cdcf5b9ca2 rebase: formatting fixes 2022-07-06 23:19:28 -04:00
Edward Thomson
c2dc51e812 Merge pull request #6340 from vishwin/main
ntlmclient: LibreSSL 3.5 removed HMAC_CTX_cleanup
2022-07-06 23:14:17 -04:00
Edward Thomson
1a94d97e5f Merge pull request #6343 from libgit2/ethomson/ci
ci: update dockerfiles for mbedTLS new url
2022-07-06 13:33:06 -04:00
Edward Thomson
5afc146a6f ci: update dockerfiles for mbedTLS new url
Update the new URL for mbedTLS.
2022-07-06 13:10:33 -04:00
Edward Thomson
c70035dc09 actions: pass UID and GID to PR builds of dockerfiles 2022-07-06 13:10:33 -04:00