1967 Commits
Author SHA1 Message Date
Devin Carr 0355484d9b TUN-10822: Remove fetching protocol percentage from remote
Stop fetching protocol rollout percentages from DNS TXT records.
Remove the obsolete remote selector, percentage-fetching API, and
related tests, and simplify protocol selector construction.
2026-08-27 13:29:13 -07:00
Devin Carr e34698e4d4 chore: Clean up unused code
Delete the unused tunnelsForHA implementations and stale edge
discovery test mocks. Remove unpopulated metrics and simplify
the stream copy path by dropping its permanently disabled debug
implementation.
2026-08-27 08:38:54 -07:00
Devin Carr 0b177d3d22 TUN-10820: Remove test-only stdin reconnect control
Remove the hidden stdin-control flag and ReconnectSignal plumbing used to
force tunnel reconnections through stdin. Delete the associated component
test and supervisor control implementation.

Serve QUIC and HTTP/2 connections directly with the caller context instead
of wrapping them in an additional errgroup for reconnect signals. Automatic
reconnection after genuine transport failures remains unchanged.

This removal should help simplify the supervisor loop a bit and make way
for better improvements in this area.

Closes TUN-10820
2026-08-26 13:30:40 -07:00
João "Pisco" Fernandes 37cb18bad3 VULN-142146: Update GitLab R2 token path (cloudflared-pkgs) to protected branches
Closes VULN-142146
2026-08-26 15:25:17 +01:00
Devin Carr 001e9aa9cf TUN-10725: Remove unused certificate configuration 2026-08-26 12:08:44 +01:00
Devin Carr a9c0d487b9 chore: bump gorilla/websocket for GO-2026-6278
https://pkg.go.dev/vuln/GO-2026-6278

Closes GO-2026
2026-08-26 10:52:11 +01:00
João "Pisco" Fernandes d1df7985bd chore: Update distrolesss images in amd64 2026-08-20 10:54:27 +01:00
João "Pisco" Fernandes 733bfb9399 Release 2026.8.2 2026.8.2 2026-08-14 12:22:52 +01:00
Miguel da Costa Martins Marcelino f5270f9959 VULN-141859: Revert path normalization
Reverting path normalization, as it was breaking some specific use-cases.
2026-08-14 12:17:11 +01:00
João "Pisco" Fernandes e341ffbed3 Release 2026.8.1 2026.8.1 2026-08-13 14:00:16 +01:00
Miguel da Costa Martins Marcelino eb18889794 VULN-141859: Fix missing trailing slash
Fixing missing trailing slash. Path.clean was removing trailing slashes, which ended up being an issue for Wordpress.
2026-08-13 13:41:19 +01:00
João "Pisco" Fernandes aba66df755 Release 2026.8.0 2026.8.0 2026-08-12 17:59:22 +01:00
Miguel da Costa Martins Marcelino b4f47e2ab5 VULN-141859: Normalize request path
This PR is fixing VULN-141859. Basically, this follows on [RFC-3986](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4) clean algorithm by taking<span dir=""> a path with dot parts like </span>`./`<span dir=""> or </span>`../`<span dir=""> and cleaning them, outputting an absolute path</span> (RFC can be found [here](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4)).

The bulk of the changes are introduced in `canonicalizeRequestPath`, which does the following: (1) Rejects paths escaping root, (2) applies path.Clean, (3) preserves trailing slash, and (4) clears RawPath so that escaping matches the canonical Path.

We also added tests to test the normalization logic we added.
2026-08-12 17:57:33 +01:00
João "Pisco" Fernandes e8ccca2924 TUN-10557: Bump quic-go v0.59.1
This reverts commit a53d9e5d44.
2026-08-12 16:12:32 +01:00
Eduardo Gomes 5dcadf1aea AUTH-9041 Generate ephemeral keypair for login token transfer
## Problem

`NewEncrypter` loaded the token transfer keypair from `cloudflared_priv.pem` and `cloudflared_pub.pem` in the current working directory, generating and persisting them only when absent. An attacker who could place those files in a directory a user later ran cloudflared from — a repository checkout, an extracted archive, a shared or world-writable directory — knew the resulting public key in advance.

That public key is sent to the edge as the token transfer capability, and the transfer service treats it as a bearer address with no identity binding. Knowing it ahead of time let an attacker poll for the victim's credential: the account-scoped API token written to `cert.pem` by `tunnel login`, or the application JWT from `access login`. The victim's login still succeeded, so the theft left no visible trace.

## Fix

Always derive the keypair from `box.GenerateKey` and never read or write it to disk. The on-disk path is removed entirely, along with the filesystem imports, so restoring it would require a visible import change in review. `NewEncrypter` no longer takes filename arguments — note this is a change to an exported signature, though the only in-tree caller is `RunTransfer`.

Also reject payloads shorter than the 24-byte nonce in `Decrypt`, which previously panicked on a slice out of range. The smallest valid payload is 40 bytes, so the guard cannot reject legitimate input.

Jira: AUTH-9041 VULN-141861
2026-08-12 11:56:02 +01:00
Daniel Herzig 61a0b0b3c7 TUN-10748: Add FIPS image variant for Cloudflared tunnel
Adds a FIPS image variant for the Cloudflared Tunnel. 

Closes TUN-10748
2026-08-11 16:17:15 +01:00
Eduardo Gomes d96b8c85cd AUTH-9012 Verify Access app identity with signed metadata
## Problem

`GetAppInfo` trusted unsigned `CF-Access-Domain` and `CF-Access-Aud` response headers when selecting cached Access tokens. An attacker-controlled endpoint could spoof another application's identity, causing cloudflared to load and send that application's cached token.

## Fix

Discover applications through the edge's signed metadata JWT, validate its claims and requested hostname, and verify its RS256 signature against a canonicalized Cloudflare Access JWKS endpoint. Cache JWKS atomically, refresh on key rotation, and validate cached token audiences before use.

This relies on access-edge-engine [early return for cf-access-metadata-requests](https://gitlab.cfdata.org/cloudflare/ea/access-edge-engine/-/blob/main/bin/access-engine-server/src/engine/http/mod.rs?ref_type=heads#L1464-1472) when processing seldhosted apps

Jira: AUTH-9012 VULN-141860

Tested manually previous working behaviour and the VULN fix
2026-08-10 17:18:14 +00:00
Miguel da Costa Martins Marcelino 73f535b57b chore: Bump grpc to v.1.83.0 to fix vulnerability
Bumping GRPC to v.1.83.0 to fix a vulnerability: https://pkg.go.dev/vuln/GO-2026-6061

This is preventing us from merging PRs.
2026-08-07 17:38:36 +01:00
João "Pisco" Fernandes 3a2b45c2a5 Release 2026.7.3 2026.7.3 2026-07-22 17:32:46 +01:00
João "Pisco" Fernandes 78865b19bc fix: Bump golang.org/x/text and its dependencies to fix CVE 2026-07-22 16:49:49 +01:00
Rhys Rustad-Elliott 12e11208ae VULN-143514: Windows svc: use --token-file instead of --token
As with recent changes with Linux and MacOS, use --token-file instead of --token when installing the service for Windows.

The secret token was viewable by an unprivileged user by looking at the registry entry HKLM\\SYSTEM\\CurrentControlSet\\Services\\Cloudflared\\ImagePath, which stores the full command-line invocation of cloudflared (complete with --token ).

We fix this by storing the token in a file and restricting access to it.

The canonical way of protecting a secret token on Windows is to use the CryptProtectData and CryptUnprotectData functions in dpapi.h, which encrypt/unencrypt data using an OS-managed secret key. See here:

https://learn.microsoft.com/en-us/windows/win32/api/dpapi/

While we could use the DPAPI to encrypt/decrypt the token before writing it out to disk, this has two problems:

1) We would break existing Windows installs using --token-file with an unencrypted token file
2) We would introduce an inconsistency between how --token-file works on Linux/MacOS and Windows

Because of this, we keep things consistent and just add logic to cloudflared to protect the token file by modifying the permissions of the token file.

Windows's permission model differs completely from Linux and MacOS, so a Windows-specific function is used to restrict the token file's permissions. We strip ACLs from the file such that it's only readable by SYSTEM and Administrators.

Also done by this MR:

* Improve "service install --help" output on Windows to be in-line with Linux and MacOS
* Change uses of path.Join that work with file paths to be filepath.Join instead, which will use the correct platform-specific path separator (\\ on windows or / on \*nix) instead of only forward slashes
* Pull out constant string in MacOS service
2026-07-22 13:14:58 +00:00
Miguel da Costa Martins Marcelino 2206516c3b TUN-10701: Use curves for prechecks
Use curves when running pre-checks. Although it is not something critical, pre-checks should closely match the current cloudflared behavior when trying to establish connections to the edge. Adding curves here matches the current behavor.
2026-07-20 10:00:35 +00:00
João "Pisco" Fernandes 8679787525 Release 2026.7.2 2026.7.2 2026-07-15 12:01:07 +01:00
Rhys Rustad-Elliott 45c0f22e97 VULN-118896: MacOS service: use --token-file instead of --token
* Refactor directory-related functions in macos_service.go to pull out common logic
* Use --token-file instead of --token when installing cloudflared with a token on MacOS such that the secret token will not show up in the output of "ps aux" (or similar)
* Improve the "service install" help text on MacOS to distinguish between the "service install " and "service install \<token\>" cases
2026-07-15 10:52:25 +01:00
João "Pisco" Fernandes e8956c10ac Update gcr.io/distroless/base-debian13:nonroot-arm Docker digest to 7a4876f88 2026-07-14 19:31:56 +01:00
Renovate 541a608dde Update gcr.io/distroless/base-debian13:nonroot-amd64 Docker digest to ce2a20e 2026-07-14 18:36:36 +01:00
Miguel da Costa Martins Marcelino 6fd720a4a4 chore: Change internal image name
Changing image name. The image is currently under `/tun/cloudflared/cloudflared-daemon/master`. We want to instead have it under `/tun/cloudflared/cloudflared/master`. Adding the `daemon` suffix does not add much value.
2026-07-14 16:43:53 +00:00
Renovate 60a8c3da17 Update gcr.io/distroless/base-debian13:nonroot Docker digest to b78832f
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| gcr.io/distroless/base-debian13 | final | digest | `ab7554b` → `b78832f` |

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`)
  - Only on Sunday and Saturday (`* * * * 0,6`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTcuNSIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ny41IiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
2026-07-14 17:40:32 +01:00
João "Pisco" Fernandes 2601f87b57 chore: Remove bookworm internal register publish
Bookworm has been deprecated and therefore our internal
repository no longer accepts the publish of new packages.
We are then removing the publish to the internal repositories of bookworm.
2026-07-13 11:28:14 +01:00
Rhys Rustad-Elliott f70adda11c VULN-118896: Linux service: Use --token-file instead of --token
When installed with a token, e.g.,

$ cloudflared service install \<token\>

cloudflared will set itself up to be run by the init system using the --token argument. This results in tokens being visible in the output of ps aux by unprivileged users. Change this such that this installation method instead puts the token in a file with mode 600 in /etc/cloudflared and uses the --token-file flag instead.
2026-07-13 09:57:07 +00:00
João "Pisco" Fernandes ecb88678f1 Release 2026.7.1 2026.7.1 2026-07-09 13:06:21 +01:00
Miguel da Costa Martins Marcelino 43bfec0bcd Revert "TUN-10621: Propagate max wait timeout"
This reverts merge request !1859
2026-07-09 13:00:02 +01:00
João "Pisco" Fernandes 86fccede6d Release 2026.7.0 2026.7.0 2026-07-08 13:08:05 +01:00
João "Pisco" Fernandes a53d9e5d44 Revert "TUN-10557: Bump quic-go v0.59.1"
This reverts commit 02eb75b56d.
2026-07-08 11:48:16 +01:00
João "Pisco" Fernandes 9171757c66 chore: Bump go-chi to version 5.3.1 2026-07-08 11:36:00 +01:00
Miguel da Costa Martins Marcelino c06b2d43e9 TUN-10621: Test websocket path
Adding a test that tries to exercise the race condition for the websocket path. The sequence is as follows:

1. The test starts by writing the payload to the mock server
2. Then, it closes the write side of the connection.
3. It waits for 3 seconds to make the race window explicit: the bug in cloudflared would have closed the connection and we would not be able to read.
4. Read the message.

With the fix applied, we should be able to read the full message.
2026-07-01 18:27:12 +01:00
Renovate a9d023b7a2 Migrate config renovate.json 2026-06-30 17:19:15 +01:00
João "Pisco" Fernandes f76f75b449 ci: add Semgrep OSS scanning workflow
## Summary
Port from https://github.com/cloudflare/cloudflared/pull/1639 to GitLab
2026-06-30 09:36:55 +01:00
Miguel da Costa Martins Marcelino 5c66bd68ab TUN-10621: Propagate max wait timeout
This PR addresses an issue where cloudflared prematurely closes the origin connection before the upstream-to-downstream goroutine finishes reading, causing intermittent connection drops when a client immediately closes the write-side of a connection.

When a client finishes writing data, it immediately closes its side of the connection. Under the current implementation in cloudflared's downstream-to-upstream goroutine does not wait for the second stream to complete. It unblocks the moment the first stream writes to the channel. Once this happens, the pipe returns control to `proxyTCPStream`, which prematurely closes the origin connection. Consequently, when the upstream-to-downstream goroutine attempts to read the remaining data from the origin connection, the connection is already gone, leading to unexpected failures.

We started propagating the `TimeoutAfterFirstClose` configuration/parameter. This allows the proxy to wait for a designated period, giving the second stream sufficient time to finish processing and read all remaining data before `proxyTCPStream` tears down the origin connection.
2026-06-29 10:57:12 +00:00
Christopher Meng dba2d33a6b Consolidate init-system detection into shared inits package 2026-06-25 17:24:46 +00:00
Christopher Meng 6b0571b598 Fix lint issues 2026-06-25 17:24:46 +00:00
Christopher Meng d5e0c2bb89 Fix broken installed-service detection in systemd uninstall
systemctl list-units exits 0 whether or not any pattern matches, so the
filter was a no-op and every unit was always treated as installed.
Detect installed units by checking for the unit file on disk instead.
2026-06-25 17:24:46 +00:00
Christopher Meng 77e8965e28 Add OpenRC support
Generate a clean init script at /etc/init.d/cloudflared backed by
OpenRC's supervise-daemon supervisor, plus a companion
/etc/conf.d/cloudflared for operator overrides.
2026-06-25 17:24:46 +00:00
Renovate 8066821462 Pin dependencies
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| gcr.io/distroless/base-debian13 | final | pinDigest |  → `ab7554b` |

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`)
  - Only on Sunday and Saturday (`* * * * 0,6`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMjQuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIyNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
2026-06-25 17:12:51 +00:00
Miguel da Costa Martins Marcelino 1e4ebe5471 chore: Fix renovate
Fixing renovate in cloudflared.
2026-06-25 16:36:46 +00:00
Miguel da Costa Martins Marcelino 02eb75b56d TUN-10557: Bump quic-go v0.59.1
This adds back the quic-go bump.
2026-06-18 18:20:39 +00:00
MiguelMarcelino 81a53555aa Release 2026.6.1 2026.6.1 2026-06-18 14:39:02 +01:00
Miguel da Costa Martins Marcelino 2bcaf09734 Revert "TUN-10557: Bump quic-go v0.59.1"
This reverts merge request !1850
2026-06-18 13:30:00 +00:00
Miguel da Costa Martins Marcelino 3315fa6e0f TUN-10630: Fix precheck protocol override
As it stands, cloudflared prechecks are not taking the `protocol` flag into consideration and is instead falling back to the default protocol, which is QUIC. Prechecks should report the protocol cloudflared will use, not the default protocol.
2026-06-18 10:56:53 +00:00
Miguel da Costa Martins Marcelino ad11e67340 chore: Fix warnings
Fixing warnings in cloudflared before making any further changes.
2026-06-16 16:53:56 +00:00