14672 Commits

Author SHA1 Message Date
Edward Thomson
26c68a2739 Merge pull request #6477 from libgit2/ethomson/v1.5.2
v1.5.2
v1.5.2
2023-02-15 10:03:30 +00:00
Edward Thomson
914c680e13 meta: add changelog for v1.5.2 2023-02-14 16:28:52 +00:00
Edward Thomson
0ea92046f5 meta: update version numbers to 1.5.2 2023-02-14 16:28:08 +00:00
Edward Thomson
448de4d6b3 Merge pull request #6474 from libgit2/ethomson/v1.5.2
v1.5: support SSH known hosts on Windows
2023-02-14 16:19:51 +00:00
Edward Thomson
41e3f6dd54 test: isolate home directory separately from global config 2023-02-14 10:08:50 +00:00
Eric Huss
1dfdf4b8b9 Set all SSH hostkey preferences that are available 2023-02-14 09:39:08 +00:00
Edward Thomson
bef34cb213 ci: convert PATH correctly to Cygwin format on Windows
We provide `BUILD_PATH` to our build script; provide it and mutate
`PATH` when running our tests as well.

We were previously using `cygpath` to try to convert a _list_ of Windows
paths into cygwin / Unix style `PATH` format. This does not work -- it
treats the path list as a single path (with semicolons -- understandably
as those are allowed characters in a Windows path).

For example, `C:\One;C:\Two;C:\Three` is converted to
`/c/one;c:/two;c:/three`.

Add a new function to convert path lists, so that paths are split by
semicolon and fed to `cygpath` independently, then re-joined with a
colon. This means that our example `C:\One;C:\Two;C:\Three` is correctly
converted to `/c/one:/c/two:/c/three`.
2023-02-14 09:39:02 +00:00
Edward Thomson
49a1164ad3 ci: limit test runner to build path
We provide `BUILD_PATH` to our build script; provide it and mutate
`PATH` when running our tests as well.
2023-02-14 09:38:54 +00:00
Edward Thomson
bd3539a43c ci: run clone tests in online 2023-02-14 09:38:21 +00:00
Edward Thomson
ec8f69db54 tests: known_hosts manipulating ssh clone tests
Teach the clone tests how to clone from github.com, when given a keypair
with a passphrase and known_hosts data. This allows us to better
exercise our known_hosts checking and ensure that the lifecycle of the
certificate callback matches our expectations.
2023-02-14 09:37:42 +00:00
Edward Thomson
8ee6a043e7 ci: compile against libssh2 on windows 2023-02-14 09:36:46 +00:00
Edward Thomson
fd5ea5775a ssh: give a realistic error message
I spent an hour banging my head against this, when it was because the
remote didn't trust my key.
2023-02-14 09:36:21 +00:00
Edward Thomson
a64acc6a44 ssh: support windows known_hosts files
Use `git_sysdir_find_homedir_file` to identify the path to the home
directory's `.ssh/known_hosts`; this takes Windows paths into account by
preferring `HOME`, then falling back to `HOMEPATH` and `USERPROFILE`
directories.
2023-02-14 09:36:13 +00:00
Edward Thomson
3d5f28254a sysdir: provide actual home directory
Provide a mechanism to look up the user's home directory, using the same
mechanism that we use for locating the global configuration path (a
fancy name for saying "the home directory").

SSH known hosts lookups now use this, instead of simply looking at the
HOME environment variable, to support Windows-style home directory
lookups in `HOME`, `HOMEPATH`, or `USERPROFILE`.
2023-02-14 09:36:02 +00:00
Edward Thomson
0544bbf106 sysdir: move windows sysdir functions out of shared util
The windows sysdir functions are libgit2-specific and for git
compatibility only; remove them from the shared util directory and bring
them into the libgit2 source tree.
2023-02-14 09:35:40 +00:00
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