1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-12-14 04:18:56 +03:00
Commit Graph

3148 Commits

Author SHA1 Message Date
dependabot[bot]
dd2b04f253 GHA: bump pip reuse and 2 GitHub Actions
- update `actions/checkout` from 5.0.0 to 6.0.0
- update `cross-platform-actions/action` from 0.29.0 to 0.30.0
- update pip package `reuse` from 6.1.2 to 6.2.0

Closes #1755
Closes #1756
2025-12-01 20:21:17 +01:00
Viktor Szakats
96e21c2e25 cmake: verify minimum CMake version in libssh2-config.cmake
This is the same minimum version required to build libssh2 itself (3.7).

Closes #1754
2025-12-01 20:20:56 +01:00
Viktor Szakats
69bed46a9b cmakelint: also lint CMake .in files (fixup), fix a long line
Follow-up to 9e4d307e67 #1751
2025-12-01 14:58:50 +01:00
Viktor Szakats
78cd32aada cmake: namespace all local variables in libssh2-config.cmake
Closes #1752
2025-12-01 14:50:00 +01:00
Viktor Szakats
9e4d307e67 cmakelint: also lint CMake .in files
Closes #1751
2025-12-01 14:50:00 +01:00
Viktor Szakats
2b7f82989c GHA: minor command sync with the curl repo 2025-12-01 12:23:26 +01:00
Viktor Szakats
7fd89a58fa cmake: save and restore CMAKE_MODULE_PATH in libssh2-config.cmake
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 82b09f9b3a #1322

Closes #1750
2025-11-29 15:09:48 +01:00
Viktor Szakats
78ffc2d405 GHA: move config log dumps to their separate steps
To make configure step output more readable in case of a build error.
To expose configure logs for successful builds without adding clutter.

Also:
- set shell globally for Windows jobs.
- move all Cygwin files to `D:`.

Closes #1749
2025-11-28 13:10:27 +01:00
Viktor Szakats
c124c6a987 GHA: fix using mbedtls@3 in macOS jobs
mbedtls@3 is no longer installed to default locations. Point the builds
to it explicitly.

Follow-up to b098a3c434 #1744
Closes #1748
2025-11-28 12:25:34 +01:00
Lars Nordin
81f0203c1c userauth: fix error message for EAGAIN in public-key response (#1747) 2025-11-28 11:58:05 +01:00
Viktor Szakats
b098a3c434 GHA: switch macOS jobs to versioned mbedtls@3 brew package
To avoid bumping to 4.x with the unversioned mbedtls package.

Closes #1744
2025-11-22 02:15:36 +01:00
Joshua Rogers
8ddf3b317f agent: pageant backend, bound reply copy, handle missing reply (#1711)
The Pageant transact path trusted the 32-bit length in the shared memory
mapping and could memcpy past the mapped view. It also treated
a non-positive SendMessage(WM_COPYDATA) result as success.

Changes:

Reject replies when SendMessage returns ≤ 0 and report
LIBSSH2_ERROR_AGENT_PROTOCOL.

Bound the copy by validating response_len <= PAGEANT_MAX_MSGLEN - 4
(accounting for the length prefix) to avoid OOB reads.

Impact: prevents potential out-of-bounds read and use of uninitialized
mapping contents when Pageant misbehaves or is malicious.
2025-11-17 11:25:26 +01:00
Viktor Szakats
1045cfd033 GHA/codeql: limit cron job to the origin repository (#1741)
To avoid running it in every fork, every week.
2025-11-16 23:14:22 +01:00
Viktor Szakats
f61703cc98 GHA: add actionlint job, fix reported issues
Closes #1740
2025-11-10 19:06:11 +01:00
Viktor Szakats
f97fb271e3 scripts: fix shellcheck SC2046 warnings
Also:
- use more `--` end-of-options markers.
- checksrc.sh: use literal quotes.

Closes #1739
2025-11-10 19:06:10 +01:00
Viktor Szakats
26a78929ce GHA/dependabot: group updates, other tidy-ups 2025-11-02 17:45:02 +01:00
Viktor Szakats
455f062236 GHA: run fuzzer on master commits, bump upload-artifacts
Also adjust formatting to match curl workflows.

Closes #1736
2025-10-25 00:51:35 +02:00
Viktor Szakats
d4ebb524c5 GHA: replace deprecated set-output command with $GITHUB_OUTPUT
Fixing:
```
Image build and push
The `set-output` command is deprecated and will be disabled soon. Please upgrade
to using Environment Files. For more information
see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18667440406

Ref: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Ref: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#environment-files

Closes #1735
2025-10-24 14:36:51 +02:00
Viktor Szakats
da6dec9319 GHA: set concurrency, zizmor Dependabot, set cooldown
Closes #1734
2025-10-24 14:27:34 +02:00
Viktor Szakats
3969991b68 cmake: small tidy-ups
- say "Absolute path" for include and library paths in Find modules.
- flatten an if tree.
- fix a typo in comment.

Closes #1732
2025-10-21 01:09:36 +02:00
Will Cosgrove
4ed26f5740 Fix sftp_symlink when getting SSH_FXP_STATUS response (#1731)
Move advancing past packet ID before reading the FXP_STATUS response.
2025-10-20 14:04:52 -07:00
Viktor Szakats
8dd9da3261 GHA: drop HOMEBREW_NO_AUTO_UPDATE=1 [ci skip]
Doesn't seem to be fixing the initial delay.

Follow-up to ec5ba06276 #1678
2025-10-20 15:07:03 +02:00
Viktor Szakats
bb7b68dee8 build: quote a cmake variable, drop redundant step in Cygwin CI jobs
Drop the `git config --global core.autocrlf input` step in Cygwin jobs.
It's no longer necessary. Also saving ~10 seconds per job.

Quote the cmake variable for consistency.

Closes #1730
2025-10-19 23:04:04 +02:00
Viktor Szakats
16ce0ec89b mbedtls: fix using garbage value (reported by clang-tidy)
In `_libssh2_mbedtls_pub_priv_key()` on a NON-error code path, a stack
variable was checked without initializing it first.

I found it interesting that clang-tidy did not find this when building
against the system mbedtls (2.x) with 2.x compatibility code still in.
Then it did find it when using a manual build of mbedtls 3.1.0 with
2.x compatibility code deleted from libssh2. Being such a trivial error
I wonder why no compiler ever detected it as a regular warning.

linux (clang-tidy, amd64, mbedTLS-prev [3.1.0], cmake, ON):
```
src/mbedtls.c:744:8: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors]
  744 |     if(ret) {
      |        ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18620615649/job/53091295760#step:22:44

Follow-up to 186f1a2d75 #132
Cherry-picked from #1727
Closes #1729
2025-10-18 23:59:26 +02:00
Viktor Szakats
7c92792fed GHA: bump crypto lib dependencies
Closes #1728
2025-10-18 11:03:26 +02:00
Viktor Szakats
6c6ea30d3d GHA/dependabot: minor fixes to prev
Follow-up to d223094467 #1724
2025-10-14 11:39:20 +02:00
Viktor Szakats
557611f92b checksrc: update, update local config, fix toctou in examples
Closes #1719
2025-10-14 03:29:05 +02:00
dependabot[bot]
45d52d16c3 GHA: bump components
- bump debian from `c99c733` to `1caf1c7` in /tests/openssh_server
- bump github/codeql-action from 4.30.7 to 4.30.8

Closes #1726
Closes #1725
2025-10-14 03:24:42 +02:00
Viktor Szakats
d1ba043d0a GHA/dependabot: fix Dockerfile path
Follow-up to d223094467 #1724
2025-10-14 02:55:40 +02:00
Viktor Szakats
d223094467 Dockerfile: pin Debian trixie image, enable Dependabot
- pin Debian trixie Docker image to hash.
- set Dependabot to update the pin once every month.
- set Dependabot commit message prefixes to `GHA:` (to match curl).

Closes #1724
2025-10-14 02:39:15 +02:00
Viktor Szakats
51f6259d18 GHA: stop running tests with Libgcrypt
Tests started failing after touching `sshd_config`, which bumped
the test container from Debian Bookworm to Trixie, and openssh-server
from 9.2p1 to 10.0p1 with it. OpenSSH v10 no longer supports legacy KEX
algos `diffie-hellman-group*` and `diffie-hellman-group-exchange-*`,
making libssh2 require ECDSA or ED25519 to enable `curve25519-sha256*`
or `ecdh-sha2-*`, for the tests to succeed.

libgcrypt, stock Ubuntu wolfSSL, and WinCNG CI jobs broke.

- ED25519 is only supported with OpenSSL and LibreSSL 3.7+.
- ECDSA is supported by OpenSSL and mbedTLS (unless disabled),
  by wolfSSL in certain cases (but not on Ubuntu 24.04 with the stock
  v5.6.6 build), and by WinCNG when explicitly enabled, and targeting
  Windows 10/2016 Server.

Fixed by:

- wolfSSL support received an ECDSA detection fix, that resolved
  the issue with the stock Ubuntu builds, via:
  b807dac921 #1723

- WinCNG had ECDSA enabled in CI in the job running tests, via:
  0f5843874b #1721

- to make CI pass, disable running tests with Libgcrypt in this patch.

An alternate option is to downgrade to Bookworm, with the undesired
effect that its openssh-server doesn't support ML-KEM and other modern
SSH features, meaning those could not be tested once implemented in
libssh2, e.g. in #1644.

Ref: https://www.openssh.com/txt/release-10.0
Ref: https://packages.debian.org/trixie/openssh-server
Ref: https://packages.debian.org/bookworm/openssh-server
Ref: https://packages.ubuntu.com/noble/libwolfssl-dev

Bug: https://github.com/libssh2/libssh2/pull/1718#issuecomment-3397142351
Follow-up to 4f9e6e0bfb #1718

Closes #1720
2025-10-14 01:46:26 +02:00
Viktor Szakats
b807dac921 wolfssl: fix detecting ECDSA support
Use `HAVE_ECC` as an indicator for ECDSA when building with wolfSSL.

Before this patch the OpenSSL macros were used, in particular
`OPENSSL_NO_EC`, which made ECDSA support disabled with certain
wolfSSL build configurations, e.g. the Ubuntu 24.04 one.

ECDSA is necessary to run tests with OpenSSH v10, e.g. on Debian Trixie.

Follow-up to b95e758239 #666
Ref: #1720
Closes #1723
2025-10-14 01:04:13 +02:00
Viktor Szakats
f2838c7674 cmake: link wolfSSL macOS/Unix system lib dependencies
To support linking wolfSSL statically.

Closes #1722
2025-10-14 00:13:30 +02:00
Viktor Szakats
0f5843874b appveyor: enable WinCrypt ECDSA in tests, move to Windows 2016
To make it work with OpenSSH v10 in Debian Trixie. ECDSA (or ED25519) is
required for for compatibility with the supported list of KEX algos in
OpenSSH v10. ECDSA support requires targeting Windows 10, equivalent
to Windows 2016 Server.

Also move Windows 2016 job to the last position:
Ref: b5e68bdc37 #1461

Bug: https://ci.appveyor.com/project/libssh2org/libssh2/builds/52898449/job/t79v1xi531bq3nab
Ref: #1720

Closes #1721
2025-10-13 23:15:57 +02:00
Viktor Szakats
4f9e6e0bfb REUSE: add copyright headers to more files, and .gitignore updates
Also:
- rename a spellcheck file to match curl.
- editorconfig: fix line width.
- editorconfig: make it use UTF-8.
- editroconfig: apply some rules to all files.
- .gitignore: drop dupe, drop `.DS_Store` (not created by this repo),
   sort.
- .gitignore: add for tests executables.

Closes #1718
2025-10-13 13:35:25 +02:00
Will Cosgrove
2dae302489 Update sftp_symlink to avoid out of bounds read on malformed packet #1705 (#1717)
Use buffer struct to guard against out of bounds reads and invalid packets.

Discovery Credit:
Joshua Rogers
2025-10-10 08:26:20 -07:00
Joshua Rogers
31ec5a8b55 packet: authagent_open: fix failure packet length (#1701)
Compute packet_len using strlen(AuthAgentUnavail) (not X11FwdUnAvil).
The mismatch could send 1 uninitialized byte on the wire.

Credit:
Joshua Rogers
2025-10-09 10:18:53 -07:00
Joshua Rogers
13a7145184 Fix type mismatch in "reason code" (#1706)
Credit:
Joshua Rogers
2025-10-09 10:03:39 -07:00
Joshua Rogers
4266904092 Fix error code on agent recv error (#1710)
Credit:
Joshua Rogers
2025-10-09 10:01:10 -07:00
Viktor Szakats
b889b39945 docs: convert man page sources to "curldown" format
To render in Git webviews as-is, to make it easier to edit, verify,
and to sync up with curl.

- add options to not build the `.3` man pages:
  - autotools: `--disable-docs`
  - cmake: `LIBSSH2_BUILD_DOCS=OFF`
- building `.3` man pages requires Perl after this patch.
- drop `mansyntax` and the shell / `grep` / GNU `man` tool requirements with it.
- scripts and most logic were copied from curl.
- add `cd2nroff` from curl, with edits to relax curl-specific checks.
- used `nroff2cd` (from curl) to convert from `.3` to `.md`. Then
  manually fixed copyrights, inline function references and a couple
  of other things.

Credits-to: Daniel Stenberg

Ref: eefcc1bda4
Ref: https://github.com/curl/curl/pull/12730
Ref: https://github.com/libssh2/www/issues/25#issuecomment-3289431671

Closes #1660
2025-10-09 04:05:38 +02:00
Viktor Szakats
cea796fc2d openssl: drop support for OpenSSL <1.1.1, LibreSSL <2.7 (2018-03-21)
- OpenSSL 1.0.2 is officially not supported for open source,
  OpenSSL 1.1.0 is officially not supported at all.
  https://openssl-library.org/policies/releasestrat/index.html

- LibreSSL 2.6.x and older are just old. 2.7.0 was released on 2018-03-21.

Closes #1668
2025-10-09 03:41:33 +02:00
dependabot[bot]
9abb4e7872 GHA: bump reuse from 5.1.1 to 6.1.2
Closes #1716
2025-10-08 14:31:59 +02:00
dependabot[bot]
aa334c77d7 GHA: bump github/codeql-action from 3.30.5 to 4.30.7
Closes #1715
2025-10-08 14:31:58 +02:00
Viktor Szakats
5dd317fa19 GHA/dependabot: fix pip directory
Before this patch the Depenadabot updater picked up these two files:
- ci/spellcheck-words.txt
- LICENSES/FSFULLR.txt
2025-10-08 14:16:02 +02:00
Joshua Rogers
c3d8976c03 Remove unused kex state variable exchange_hash (#1713)
kex: completely remove unused exchange_hash it's unused.
2025-10-07 10:18:00 -07:00
Will Cosgrove
c097c6811c Downcast packet length checks #1707 (#1714)
Downcast size_t values to uint32_t before comparing so the addition isn't upcast to size_t. 

Credit: 
Joshua Rogers
2025-10-07 10:16:38 -07:00
Viktor Szakats
f29de5870b ci/GHA: show full versions next to pinned actions
Closes #1695
2025-10-03 14:24:16 +02:00
Viktor Szakats
ab7dd8999a ci/GHA: pass zizmor a GH token, fix warnings found
For a complete, online, check.

After this patch the check takes 25s, up from a fraction of a second.

Closes #1694
2025-10-03 11:56:54 +02:00
dependabot[bot]
af2de52f59 ci/GHA: bump actions
docker/login-action from 3.5.0 to 3.6.0
github/codeql-action from 3.30.4 to 3.30.5

Closes #1692
Closes #1693
2025-10-02 01:38:14 +02:00
Viktor Szakats
61d51cb449 cmake: tidy up passing compiler and linker options
- prefer `set_property()` over `target_compile_options()`, to use
  the modern style.

  Follow-up to 8017592163 #939

- prefer to append to compiler/linker options in examples/tests.
  To prevent accidentally overriding a previously set option.

  Follow-up to 14a709a72f #1686
  Follow-up to 854cfa8292 #1524

- replace `LINK_FLAGS` with `LINK_OPTIONS` that superceded it, for
  CMake 3.13+.

  Follow-up to 854cfa8292 #1524
  https://cmake.org/cmake/help/v4.1/prop_tgt/LINK_OPTIONS.html

Closes #1690
2025-09-29 13:32:46 +02:00