1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-17 04:22:32 +03:00
Commit Graph

3136 Commits

Author SHA1 Message Date
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
Viktor Szakats
a7b3fdb416 ci/GHA: use --enable-option-checking=fatal, fix fallout
Follow-up to 1f79b00505 #1685

Closes #1689
2025-09-28 00:23:46 +02:00
Viktor Szakats
549d90b83e cmake: enable picky warnings for MSC_VERSION=1944
Closes #1687
2025-09-27 22:07:15 +02:00
Viktor Szakats
31f23ac017 ci/GHA: sync MSVC job names with others [ci skip]
i.e. drop 'cmake' from them.
2025-09-27 21:53:47 +02:00
Viktor Szakats
14a709a72f cmake: pass picky C options to C targets only (and not to C++ ossfuzz)
This also means that we no longer pass any picky warning option to
ossfuzz. It's probably not worth maintaining picky C++ options for this
single, small target.

Silencing:
```
cc1plus: warning: command-line option '-Wbad-function-cast' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wenum-int-mismatch' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wjump-misses-init' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wmissing-parameter-type' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wnested-externs' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wold-style-declaration' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wold-style-definition' is valid for C/ObjC but not for C++
cc1plus: warning: command-line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18063134305/job/51402236388#step:7:15

Closes #1686
2025-09-27 21:50:34 +02:00
Viktor Szakats
1f79b00505 ci/GHA: fix Linux autotools jobs to honor their zlib settings
Also rename `crossoptions` variables to `options`.

Closes #1685
2025-09-27 21:08:48 +02:00
Viktor Szakats
9ce9909df5 ci/GHA: merge cmake/autotools steps, other misc updates
- drop redundant `--parallel` cmake option for Ninja builds.
- use Ninja for aws-lc, also simplify the script.
- use global default `MAKEFLAGS`. This also makes certain
  steps faster due to missing parallelism before this patch.
- enable `-DBUILD_OSSFUZZ=ON` in a cmake job.
- split Cygwin job into steps. To sync with others.
- sync Cygwin build type name with other jobs.

Closes #1684
2025-09-27 20:04:02 +02:00
Will Cosgrove
ff50682c23 Add input bounds checking to SFTP API (#1679)
Add bounds checking to public SFTP API input to avoid possible heap corruption when passing in invalid values.

Credit:
Oblivionsage
2025-09-26 08:03:28 -07:00
dependabot[bot]
08f5df3c0e ci/GHA: bump github/codeql-action and actions/cache
- bump github/codeql-action from 3.30.3 to 3.30.4
- bump actions/cache from 4.2.4 to 4.3.0

Closes #1681
Closes #1682
2025-09-26 01:38:28 +02:00
Viktor Szakats
cd37b7047f ci/GHA: enable Dependabot pip updates
Also switch to monthly from weekly for GHA updates.

Closes #1680
2025-09-25 21:40:15 +02:00
Viktor Szakats
e990562281 ci/GHA: drop spaces from requirements.txt 2025-09-25 13:53:08 +02:00
Viktor Szakats
ec5ba06276 GHA: use reuse linter tool directly, merge linters into a single workflow
Also pin `reuse` and `cmakelang` in `requirements.txt`.

Closes #1678
2025-09-25 11:45:58 +02:00
Viktor Szakats
d414292370 ci/GHA: pin codespell, use venv
Closes #1676
2025-09-24 23:11:41 +02:00