Commit Graph

1419 Commits

Author SHA1 Message Date
dependabot[bot]
fe952e634a build(deps): Bump serde from 1.0.204 to 1.0.209 in /rust (#6440)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.204 to
1.0.209.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/serde-rs/serde/releases">serde's
releases</a>.</em></p>
<blockquote>
<h2>v1.0.209</h2>
<ul>
<li>Fix deserialization of empty structs and empty tuples inside of
untagged enums (<a
href="https://redirect.github.com/serde-rs/serde/issues/2805">#2805</a>,
thanks <a
href="https://github.com/Mingun"><code>@​Mingun</code></a>)</li>
</ul>
<h2>v1.0.208</h2>
<ul>
<li>Support serializing and deserializing unit structs in a
<code>flatten</code> field (<a
href="https://redirect.github.com/serde-rs/serde/issues/2802">#2802</a>,
thanks <a
href="https://github.com/jonhoo"><code>@​jonhoo</code></a>)</li>
</ul>
<h2>v1.0.207</h2>
<ul>
<li>Improve interactions between <code>flatten</code> attribute and
<code>skip_serializing</code>/<code>skip_deserializing</code> (<a
href="https://redirect.github.com/serde-rs/serde/issues/2795">#2795</a>,
thanks <a
href="https://github.com/Mingun"><code>@​Mingun</code></a>)</li>
</ul>
<h2>v1.0.206</h2>
<ul>
<li>Improve support for <code>flatten</code> attribute inside of enums
(<a
href="https://redirect.github.com/serde-rs/serde/issues/2567">#2567</a>,
thanks <a
href="https://github.com/Mingun"><code>@​Mingun</code></a>)</li>
</ul>
<h2>v1.0.205</h2>
<ul>
<li>Use serialize_entry instead of serialize_key + serialize_value when
serialize flattened newtype enum variants (<a
href="https://redirect.github.com/serde-rs/serde/issues/2785">#2785</a>,
thanks <a
href="https://github.com/Mingun"><code>@​Mingun</code></a>)</li>
<li>Avoid triggering a collection_is_never_read lint in the
deserialization of enums containing flattened fields (<a
href="https://redirect.github.com/serde-rs/serde/issues/2791">#2791</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="30752ac4ff"><code>30752ac</code></a>
Release 1.0.209</li>
<li><a
href="b84e6ca4f5"><code>b84e6ca</code></a>
Improve wording of PR 2805 comments</li>
<li><a
href="87a2fb0f1a"><code>87a2fb0</code></a>
Wrap comments from PR 2805 to 80 columns</li>
<li><a
href="9eaf7b9824"><code>9eaf7b9</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/serde/issues/2805">#2805</a>
from Mingun/untagged-tests</li>
<li><a
href="7bde100237"><code>7bde100</code></a>
Replace MapRefDeserializer with value::MapDeserializer</li>
<li><a
href="da7fc795ee"><code>da7fc79</code></a>
Fix deserialization of empty struct variant in untagged enums</li>
<li><a
href="4c5fec1363"><code>4c5fec1</code></a>
Test special cases that reaches SeqRefDeserializer::deserialize_any
len==0 co...</li>
<li><a
href="6588b0ad37"><code>6588b0a</code></a>
Cover Content::Seq case in VariantRefDeserializer::struct_variant</li>
<li><a
href="0093f74cfe"><code>0093f74</code></a>
Split test newtype_enum into four tests for each variant</li>
<li><a
href="171c6da57a"><code>171c6da</code></a>
Complete coverage of
ContentRefDeserializer::deserialize_newtype_struct</li>
<li>Additional commits viewable in <a
href="https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.209">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde&package-manager=cargo&previous-version=1.0.204&new-version=1.0.209)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 14:48:32 +00:00
Thomas Eizinger
35017537c7 feat(gateway): allow out-of-order allow_access requests (#6403)
Currently, the gateway requires a strict ordering of first receiving a
`request_connection` message, following by multiple `allow_access`
messages. Additionally, access can be granted as part of the initial
`request_connection` message too.

This isn't an ideal design. Setting up a new connection is infallible,
all we need to do is send our ICE credentials back to the client.
However, untangling that will require a bit more effort.

Starting with #6335, following this strict order on the client is a more
difficult. Whilst we can send them in order, it is harder to maintain
those ordering guarantees across all our systems.

To avoid this, we change the gateway to perform an upsert for its local
ACLs for a client. In case that an `allow_access` call would somehow get
to the gateway earlier, we can simply already create the `Peer` and only
set up the actual connection later.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-28 13:10:06 +00:00
Jamil
ea33b7868f ci: Bump GUI to 1.2.1 (#6462) 2024-08-27 22:19:26 -07:00
Reactor Scram
b5a67cd2d7 fix(rust/gui-client): when the Client starts with a token but no Internet, wait for Internet and then connect (#6414)
Closes #6389 

I added a retry button since the network change detection is flaky
inside Parallels. On bare metal Windows it works fine.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-27 20:14:08 +00:00
Reactor Scram
7762741d55 fix(rust/gui-client): ignore network resets before the tunnel is ready (#6458)
Closes #6457

This PR ignores `Session::reset` requests from the GUI while the IPC
service is still raising the tunnel. This removes redundant
reconnections to the Portal and it may improve behavior on some systems.

It's not any faster on my dev laptop.

`set_dns` seemed harmless so I didn't touch that.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-27 19:28:44 +00:00
Reactor Scram
2726e1dc00 fix(rust/gui-client/windows): read DNS servers before starting connlib (#6455)
Closes #6453

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-27 18:49:41 +00:00
Thomas Eizinger
d042addc5f refactor(connlib): model "routing table updates" (#6436)
Upon receiving packets for a resource that we are not connected to,
connlib emits a "connection intent" to the portal. In case there are
gateways online for this resource, the portal sends us a "connection
details" event.

Currently, this is handled in a `create_or_reuse_connection` function.
What the current name doesn't capture is that this message is
essentially an update to connlib's "routing table", i.e. which gateway
in which site to use for the given resource. If we move this concern to
the fore-front of the design, whether or not we will make a new
connection or reuse an existing one kind of becomes secondary.

Re-framing the way we handle this messages makes it more natural to
design it in an asynchronous way, i.e. set its return type to `()` and
schedule events to be emitted. The translation of
`Request::NewConnection` is more or less 1-to-1 with the introduction of
`ClientEvent::RequestConnection`. The translation of
`Request::ReuseConnection` turns into the also renamed
`ClientEvent::RequestAccess`. This captures better what we need to do:
When we have an existing connection, we need to request access for it,
otherwise the gateway will drop all packets we send to this resource.

The motivation for this refactoring is #6335. Buffering the initial
packets while establishing a new connection opens up a race condition
where we may send `RequestAccess` before the gateway has processed
`RequestConnection`. In order to avoid this, we need to be able to
locally buffer our `RequestAccess` messages and wait until the gateway
has confirmed our connection.
2024-08-27 04:17:19 +00:00
Thomas Eizinger
a4fef5f6e7 test(connlib): index ICMP packets by custom payload (#6438)
In the `tunnel_test` test suite, we send ICMP requests with arbitrary
sequence numbers and identifiers. Due to the NAT implementation of the
gateway, the sequence number and identifier chosen by the client are not
necessarily the same as the ones sent to the resource. Thus, it is
impossible to correlate the ICMP packets sent by the client with the
ones arriving at the gateway.

Currently, our test suite thus relies on the ordering of packets to
match them up and assert properties on them, like whether they target
the correct resource. As soon as we want to send multiple packets
concurrently, this order is not necessarily stable.

ICMP echo requests can contain an arbitrary payload. We utilise this
payload to embed a random u64 that acts as the unique identifier of an
ICMP request. This allows us to correlate the packets arriving at the
gateway with the ones sent by the client, making the test suite more
robust and ready for handling concurrent ICMP packets.
2024-08-27 04:15:39 +00:00
Gabi
63c73e5bb6 feat: Internet Resource UI (#6434)
Fixes #6047

On mobile platforms the internet resource is rendered with all
non-favorite resources, since it was weird to see within the favorite
tab, for the system tray platforms it's rendered as part of favorites if
there is any favorite so that it's always visible to the user.

For mobile platforms the resource is non-clickeable, since the menu
shouldn't be of interest(maybe I should add it only for the sites?).

For non-mobile there is a sub menu where you can find the sites and the
enable/disable.

The current label for the resource is a place holder for the
screenshots, and can be set by the portal, if the portal doesn't set any
name it will just show "Internet Resource".

### Android screenshot


![image](https://github.com/user-attachments/assets/63deb25f-1cd1-4b49-be80-77570e612aa5)


### Linux Screenshot


![image](https://github.com/user-attachments/assets/7b67033d-71ee-4bac-98c8-4c5810bf43a3)


![image](https://github.com/user-attachments/assets/5bdbced5-bacd-4a09-a59c-aa853bb3baa0)

### Windows Screenshot


![image](https://github.com/user-attachments/assets/a3bbebb3-9a18-4b75-9e18-f58b1b61a7a3)

### MacOS screenshot

<img width="417" alt="image"
src="https://github.com/user-attachments/assets/5488d6e4-1cd2-42be-bcd7-3c51ec295590">

### iOS screenshot


![17044](https://github.com/user-attachments/assets/5321c363-5b43-4b1e-ac37-4fd7bdc68e28)
2024-08-27 04:08:19 +00:00
Thomas Eizinger
c1bcce1898 test(connlib): reset time between failing test runs (#6437)
`tunnel_test` uses the `FluxCapacitor` component to rapidly advance time
within a test-run. This component is also used by the logger in the
tests to print _relative_ timestamps which makes it easier to compare
different test runs.

Currently, this component is initialised in the `ReferenceState`
although it isn't really part of the test-input itself. It is only
needed during the execution of a transition.

When proptest finds a failing test run, it will reuse the same
`ReferenceState` and attempt to shrink it to find the minimally-failing
input. It does this by calling `.clone`. Because `FluxCapacitor` uses
interior mutability to advance time, this means the time isn't actually
reset to `0` whilst proptest is shrinking the input.

This has / had on impact on the outcome of the test, it only makes the
logs harder and more confusing to read.

We fix this by removing the `StateMachineTest` trait implementation of
`TunnelTest` and passing an additional parameter to `init_state`. This
trait was originally needed because we were using the "no-boilerplate"
version of `proptest-state-machine`. We have recently migrated away from
that to get more fine-grained control over logging and test execution,
meaning we no longer need this trait and can simply call these functions
ourselves.
2024-08-26 23:56:03 +00:00
dependabot[bot]
4039b9742f build(deps): Bump swift-bridge from 0.1.55 to 0.1.57 in /rust (#6441)
Bumps [swift-bridge](https://github.com/chinedufn/swift-bridge) from
0.1.55 to 0.1.57.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/chinedufn/swift-bridge/releases">swift-bridge's
releases</a>.</em></p>
<blockquote>
<h2>0.1.57</h2>
<ul>
<li>
<p>Support Failable initializers. <a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/276">#276</a>
(thanks <a
href="https://github.com/niwakadev"><code>@​niwakadev</code></a>)</p>
<pre lang="rust"><code>// Rust
<p>#[swift_bridge::bridge]
mod ffi {
extern &quot;Rust&quot; {
#[swift_bridge(Equatable)]
type FailableInitType;</p>
<pre><code>    #[swift_bridge(init)]
    fn new() -&amp;gt; Option&amp;lt;FailableInitType&amp;gt;;
}
</code></pre>
<p>}
</code></pre></p>
<pre lang="swift"><code>// Swift

let failableInitType = FailableInitType()
if failableInitType == nil {
    // ...
} else {
   // ...
}
</code></pre>
</li>
<li>
<p>Support Throwing initializers <a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/287">#287</a>
(thanks <a
href="https://github.com/niwakadev"><code>@​niwakadev</code></a>)</p>
<pre lang="rust"><code>// Rust
<p>#[swift_bridge::bridge]
mod ffi {
enum ResultTransparentEnum {
NamedField { data: i32 },
UnnamedFields(u8, String),
NoFields,
}
extern &quot;Rust&quot; {
type ThrowingInitializer;
#[swift_bridge(init)]
fn new(succeed: bool) -&gt; Result&lt;ThrowingInitializer,
ResultTransparentEnum&gt;;
fn val(&amp;self) -&gt; i32;
}
}
</code></pre></p>
<pre lang="swift"><code>// Swift

do {
</code></pre>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1b547a5f0c"><code>1b547a5</code></a>
Support throwing initializers (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/287">#287</a>)</li>
<li><a
href="495611ba39"><code>495611b</code></a>
Support failable initializers (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/276">#276</a>)</li>
<li><a
href="d2c09e2e60"><code>d2c09e2</code></a>
0.1.56</li>
<li><a
href="d3d2da4e01"><code>d3d2da4</code></a>
Upgrade macOS CI runners (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/285">#285</a>)</li>
<li><a
href="37ac2c2627"><code>37ac2c2</code></a>
Apply input module visibility to output module (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/284">#284</a>)</li>
<li><a
href="34ce1ffb6b"><code>34ce1ff</code></a>
Suppress dead_code warning when returning <code>-&gt; Result\&lt;*,
TransparentType&gt;</code> (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/278">#278</a>)</li>
<li><a
href="717fcef70d"><code>717fcef</code></a>
Add parse-bridges CLI subcommand (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/274">#274</a>)</li>
<li><a
href="ef01d21001"><code>ef01d21</code></a>
0.1.55</li>
<li>See full diff in <a
href="https://github.com/chinedufn/swift-bridge/compare/0.1.55...0.1.57">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=swift-bridge&package-manager=cargo&previous-version=0.1.55&new-version=0.1.57)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 23:51:04 +00:00
dependabot[bot]
328fbac975 build(deps): Bump swift-bridge-build from 0.1.55 to 0.1.57 in /rust (#6442)
Bumps [swift-bridge-build](https://github.com/chinedufn/swift-bridge)
from 0.1.55 to 0.1.57.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/chinedufn/swift-bridge/releases">swift-bridge-build's
releases</a>.</em></p>
<blockquote>
<h2>0.1.57</h2>
<ul>
<li>
<p>Support Failable initializers. <a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/276">#276</a>
(thanks <a
href="https://github.com/niwakadev"><code>@​niwakadev</code></a>)</p>
<pre lang="rust"><code>// Rust
<p>#[swift_bridge::bridge]
mod ffi {
extern &quot;Rust&quot; {
#[swift_bridge(Equatable)]
type FailableInitType;</p>
<pre><code>    #[swift_bridge(init)]
    fn new() -&amp;gt; Option&amp;lt;FailableInitType&amp;gt;;
}
</code></pre>
<p>}
</code></pre></p>
<pre lang="swift"><code>// Swift

let failableInitType = FailableInitType()
if failableInitType == nil {
    // ...
} else {
   // ...
}
</code></pre>
</li>
<li>
<p>Support Throwing initializers <a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/287">#287</a>
(thanks <a
href="https://github.com/niwakadev"><code>@​niwakadev</code></a>)</p>
<pre lang="rust"><code>// Rust
<p>#[swift_bridge::bridge]
mod ffi {
enum ResultTransparentEnum {
NamedField { data: i32 },
UnnamedFields(u8, String),
NoFields,
}
extern &quot;Rust&quot; {
type ThrowingInitializer;
#[swift_bridge(init)]
fn new(succeed: bool) -&gt; Result&lt;ThrowingInitializer,
ResultTransparentEnum&gt;;
fn val(&amp;self) -&gt; i32;
}
}
</code></pre></p>
<pre lang="swift"><code>// Swift

do {
</code></pre>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1b547a5f0c"><code>1b547a5</code></a>
Support throwing initializers (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/287">#287</a>)</li>
<li><a
href="495611ba39"><code>495611b</code></a>
Support failable initializers (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/276">#276</a>)</li>
<li><a
href="d2c09e2e60"><code>d2c09e2</code></a>
0.1.56</li>
<li><a
href="d3d2da4e01"><code>d3d2da4</code></a>
Upgrade macOS CI runners (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/285">#285</a>)</li>
<li><a
href="37ac2c2627"><code>37ac2c2</code></a>
Apply input module visibility to output module (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/284">#284</a>)</li>
<li><a
href="34ce1ffb6b"><code>34ce1ff</code></a>
Suppress dead_code warning when returning <code>-&gt; Result\&lt;*,
TransparentType&gt;</code> (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/278">#278</a>)</li>
<li><a
href="717fcef70d"><code>717fcef</code></a>
Add parse-bridges CLI subcommand (<a
href="https://redirect.github.com/chinedufn/swift-bridge/issues/274">#274</a>)</li>
<li><a
href="ef01d21001"><code>ef01d21</code></a>
0.1.55</li>
<li>See full diff in <a
href="https://github.com/chinedufn/swift-bridge/compare/0.1.55...0.1.57">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=swift-bridge-build&package-manager=cargo&previous-version=0.1.55&new-version=0.1.57)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-26 23:50:42 +00:00
Jamil
84a981f668 refactor(ci): Remove browser-based integration tests (#6435)
Fixes a new issue with puppeteer, chromium 128, and Alpine 3.20 that's
causing failing browser tests.

See more: https://github.com/puppeteer/puppeteer/issues/12189

Failure:

https://github.com/firezone/firezone/actions/runs/10549430305/job/29224528663?pr=6391

Unfortunately, puppeteer's embedded browser doesn't seem to want to run
in Alpine:


https://github.com/firezone/firezone/actions/runs/10563167497/job/29265175731?pr=6435#step:6:56


Fixing this is proving very difficult since we can't seem to use
puppeteer with the latest Alpine images, so I questioned the need to
have these in at all. These tests were added at a time where the DNS
mappings were brittle, so we wanted to verify that relayed and direct
connections held up as we deployed.

This is no longer the case, and we also now have much more unit test
coverage around these things, so given the pain of maintaining these
(and the lack of a current solution to the above), they are removed.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-26 20:01:00 +00:00
Thomas Eizinger
86460040ba chore(connlib): remove unnecessary use of static (#6425)
The only reason we use an `AtomicU32` here is because the closure is
only an `Fn` and not an `FnMut` closure which prevents us from using a
regular `u32`.
2024-08-23 22:07:57 +00:00
Thomas Eizinger
0f49adde14 chore(connlib): print sites for Internet resource in logs (#6421) 2024-08-23 22:04:12 +00:00
Reactor Scram
482ded889e fix(rust/gui-client): throw error when failing to connect to Firezone (#6409)
Refs #6389 

```[tasklist]
- [x] Update changelog
- [x] Update manual test cases
```

This changes the behavior from "fail silently" to "fail loudly" so at
least the user knows something is wrong and they can restart Firezone
after they gain Internet.

<img width="439" alt="image"
src="https://github.com/user-attachments/assets/d5bbac66-9a5f-40a6-8b4c-71d8ab8abd6d">

<img width="554" alt="image"
src="https://github.com/user-attachments/assets/bcee1f87-bd29-4a44-b41f-a01217e3248e">
2024-08-23 15:37:57 +00:00
Jamil
2e54ae19c9 ci: Release Apple 1.2.1 (#6426)
Get the packet routing fix out.
2024-08-22 23:23:33 -07:00
Gabi
7345cc20a2 fix(connlib): only emit route changes from disabled_resource if routes actually changed (#6424)
Right now, whenever a connection is established we update the site
status.

In order to do that, we call `on_update_resources`, when
`on_update_resources` is called this in turn calls
`set_disabled_resources`, since we apply from the application side the
"disabled" given the current resources.

`set_disabled_resources` currently, always call `on_update_routes`,
which causes connectivity issues on Android and MacOS, since the packets
aren't correctly routed when the routes are changed.

To fix this we make `set_disabled_resources` only emit the routes when
they have actually changed.

Fixes: #6387.

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-08-23 04:01:18 +00:00
Reactor Scram
ef4af91a17 test(connlib): track resources separately (#6368)
In order to accurately model how `connlib` tracks resources, we need to
store the list of all resources separately from the CIDR resources. That
is because CIDR resources can overlap or target an identical CIDR range.
In that case, `connlib`s current behaviour is "last-wins".

Whenever we reconnect to the portal, we re-add our list of resources in
the order they are given to us. To model this correctly, we store the
list of resources in the tests in the order we receive them throughout
the previous session. This may not necessarily be the order in which the
portal does it but that is irrelevant. What is important is that it is
deterministic.

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-08-23 03:36:01 +00:00
Gabi
9c10829c65 chore(connlib): fix resource sort function (#6399)
Made a mistake in #6363
2024-08-22 07:17:31 +00:00
Gabi
ebfa561c53 chore(connlib): support can_be_disabled from the portal for internet resource (#6396)
In preparation for #6299

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-08-22 04:32:11 +00:00
Thomas Eizinger
a1049b7d78 feat(connlib): suspend if we don't have UDP sockets (#6398)
Previously, failing to bind to any interfaces was a hard-error. In
reality and in `connlib`'s current state, this is quite unlikely because
machines will at least have a loopback interface that we will bind to.

However, with #6382 in the pipeline, it may be more likely that we
actually end up with no functional UDP sockets. Furthermore, we are
considering to extend those connectivity checks in the future.

Thus, it is important that the case of "no available UDP sockets" is
gracefully handled.

Instead of failing with a hard-error, we now suspend `connlib's` network
stack. The connectivity to the portal is unaffected by this and we will
still also receive commands from the client application like `reset`.
When we receive a `reset`, we attempt to rebind the sockets and thus
retry connectivity.

Because we are suspending the entire eventloop, this won't send any
messages or trigger any timers whatsoever. For example, if we
hypothetically started up without network interfaces, this is now the
log output:

```
2024-08-22T01:50:42.170101Z  INFO firezone_headless_client: arch="x86_64" git_version="headless-client-1.2.0-2-gc8eed5938-modified"
2024-08-22T01:50:42.178777Z DEBUG phoenix_channel: Connecting to portal host=api.firez.one user_agent=NixOS/24.5.0 connlib/1.2.1 (x86_64; 6.8.12)
2024-08-22T01:50:42.178978Z DEBUG firezone_headless_client::dns_control::linux: Deactivating DNS control...
2024-08-22T01:50:42.180691Z ERROR firezone_tunnel::sockets: No available UDP sockets
2024-08-22T01:50:42.197098Z  INFO firezone_tunnel::device_channel: Initializing TUN device name=tun-firezone
2024-08-22T01:50:42.197165Z DEBUG firezone_tunnel::client: Unable to update DNS servesr without interface configuration
2024-08-22T01:50:42.453988Z DEBUG tungstenite::handshake::client: Client handshake done.
2024-08-22T01:50:42.454161Z  INFO phoenix_channel: Connected to portal host=api.firez.one
2024-08-22T01:50:42.676825Z DEBUG firezone_tunnel::client: Updating DNS servers mapping={fd00:2021:1111:8000:100:100:111:0 <> [2606:4700:4700::1111]:53, 100.100.111.1 <> 1.1.1.1:53}
2024-08-22T01:50:42.677084Z  INFO firezone_tunnel::client: Activating resource name=IPerf3 address=10.0.32.101/32 sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677173Z  INFO firezone_tunnel::client: Activating resource name=*.slack.com address=**.slack.com sites=Vultr Stable (Latest Release Gateways)
2024-08-22T01:50:42.677223Z  INFO firezone_tunnel::client: Activating resource name=*.slack-edge.com address=**.slack-edge.com sites=Vultr Stable (Latest Release Gateways)
2024-08-22T01:50:42.677283Z  INFO firezone_tunnel::client: Activating resource name=*.spotify.com address=**.spotify.com sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677345Z  INFO firezone_tunnel::client: Activating resource name=*.github.com address=**.github.com sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677418Z  INFO firezone_tunnel::client: Activating resource name=whatismyip.com address=**.whatismyip.com sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677489Z  INFO firezone_tunnel::client: Activating resource name=ifconfig.net address=ifconfig.net sites=Vultr Stable (Latest Release Gateways)
2024-08-22T01:50:42.677538Z  INFO firezone_tunnel::client: Activating resource name=*.google.com address=**.google.com sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677632Z  INFO firezone_tunnel::client: Activating resource name=*.fastmail.com address=**.fastmail.com sites=AWS Dev (Gateways track `main`)
2024-08-22T01:50:42.677682Z  INFO firezone_tunnel::client: Activating resource name=speed.cloudflare.com address=speed.cloudflare.com sites=Vultr Stable (Latest Release Gateways)
2024-08-22T01:50:42.678212Z  INFO snownet::node: Added new TURN server rid=b6fc4d73-9c8e-44df-a941-da7d2134cb70 address=Dual { v4: 34.40.133.55:3478, v6: [2600:1900:40b0:1504:0:97::]:3478 }
2024-08-22T01:50:42.678322Z  INFO snownet::node: Added new TURN server rid=c818b11a-d0cc-4f2a-bb88-473d8298a885 address=Dual { v4: 34.81.229.132:3478, v6: [2600:1900:4030:b0d9:0:9b::]:3478 }
2024-08-22T01:50:42.678365Z  INFO connlib_client_shared::eventloop: Firezone Started!
```

After this, nothing will happen other than receiving messages via from
the portal or the client app.

Related: #6382.
Related: #6385.
2024-08-22 04:15:31 +00:00
Jamil
c8eed59387 ci: Release 1.2.0 (#6395)
Releasing 1.2.0 to unblock portal deploy! Some of these have already
been published.
2024-08-22 00:18:27 +00:00
Gabi
f783b4b1e2 chore(connlib): set internet resource at the top of the list (#6363)
Part of #6047
2024-08-21 21:13:13 +00:00
Thomas Eizinger
16da501a7d feat(connlib): remember recently connected gateways (#6361)
Previously, `connlib` would only send the currently connected gateways
to the portal upon a new connection intent. With our introduced idle
connection timeout, this could result in the portal choosing a different
gateway upon reconnecting to the resource.

To fix this, we introduce an LRU cache with at most 100 entries.
Iteration over the LRU cache happens in MRU order, meaning a recently
connected gateway will be at the front of the list.

We assume that this list is processed in order and thus still prefer
gateways that we are still connected to.

Related: #6347.
2024-08-21 07:11:36 +00:00
Reactor Scram
a3d6410535 chore(gui-client): fix IPC log permissions (#6355)
Closes #6289

Since the IPC service deletes its own logs now, we don't need to allow
users in the group `firezone-client` to have write permissions on the
logs
2024-08-21 06:28:45 +00:00
Gabi
dd46a489b3 fix(connlib): prevent panic on internet resource for apps (#6381)
[Refs](https://github.com/firezone/firezone/pull/6299#discussion_r1724108733)

The problem right now, after #6325 we send the internet resource up to
the clients. The clients expect a certain format for the resources and
panic if it isn't followed.

Particularly, in the case of no `address` or no `name`.

To fix this, we add a name and an address for the internet resource when
it is converted to the callback type.

Setting the `name` at that point actually makes a lot of sense since it
homogenizes the name across all platforms. But the internet resource
having an address makes no sense.

So in a next PR, when I do the last UI changes I plan to make `address`
optional for all resources on the clients and specialize the display of
the internet resource.

For now I wanted to get this in so that we don't ever panic on the
internet resource existing. (This was tested on all platforms and it
works)
2024-08-21 05:37:07 +00:00
Gabi
f965ca5070 feat(connlib): handle internet resource (#6325)
This PR handles the internet resource both on the gateway and client.

In the gateway, it's handled like any other resource save for the
address which is both ipv6 and ipv4.

In the client it's handled mostly like any other resource but with some
exceptions for DNS forwarded packets, because we want to work as a CIDR
resource for the matter of forwarding packets to the gateway.

Fixes: #6313.

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-08-20 22:18:15 +00:00
Thomas Eizinger
99aa973db4 chore(connlib): reduce buffer sizes (#6360)
Currently, `snownet` allocates a 65KB buffer per connection as a
scratch-space for encrypting packets. 65KB is the theoretical limit of a
UDP packet. In practice, the largest UDP packets we send are 1336 bytes
due to the MTU of 1280 set on our TUN interface and various overheads
for WG, TURN channels and NAT46.

Thus, it is unnecessary to allocate such a large buffer per connection.
For gateways with many connections, reducing these buffers results in a
smaller memory footprint.

Additionally, any UDP packets larger than this buffer could be an
indicator of a DoS attack and we can thus drop them without processing.
A legitimate client / gateway will never send a packet larger than that.
2024-08-20 22:17:55 +00:00
Gabi
e00eeae790 chore(connlib): rename can_toggle to can_be_disabled (#6362)
This is made to sync this with #6299
2024-08-20 07:22:13 +00:00
Thomas Eizinger
b2e8ccbb49 chore: delete snownet-tests (#6359)
When `snownet` was first being developed, these tests ensured that
hole-punching as well as connectivity via a relayed works correctly. We
have since added extensive tests that ensure connectivity works in many
scenarios via `tunnel_test`. `tunnel_test` does not (yet) have a
simulated NAT so hole-punching itself is not covered by that.

UDP hole-punching is shockingly trivial though because all you need to
do is send UDP packets to the same socket that the other party is
sending from. This isn't done by our own code but rather by str0m's
implement of ICE (as long as we add the correct candidates).

The `snownet-tests` themselves are quite fragile because they need to
set up their own event loop and manually construct an IP packet. They
haven't caught a single bug to my knowledge so I am proposing to delete
them for ease of maintenance.

For example, in
https://github.com/firezone/firezone/actions/runs/10449965474/job/28948590058?pr=6335
the tests fail because we no longer directly force a handshake when the
connection is established. This is unnecessary now because the buffered
intent packet will directly force a handshake from the client to the
gateway. Yet, `snownet-tests` event loop would need adjusting to also do
that.
2024-08-20 03:40:54 +00:00
Reactor Scram
332f827cf7 fix(gui-client): reload IPC service log filter when the settings change (#6351)
Closes #6302

Tested with CI-built MSI on x86_64 Windows, and with dev-built
`run-debug` on aarch Linux.
2024-08-19 23:04:59 +00:00
Thomas Eizinger
df01372f05 test(connlib): filter disabled resources before longest match (#6340)
In `connlib`, when a CIDR resource gets disabled, we remove it from the
`IpNetworkTable` that does the routing for the packets. This ensures
that when we check for the `longest_match` of a packet, disabled
resources are not considered.

In
https://github.com/firezone/firezone/actions/runs/10449400486/job/28931681264?pr=6339,
CI found a bug where the reference implementation in the tests diverged
from this behaviour because it implements this behaviour slightly
differently. To ensure we don't match against a disabled resource, we
match all resources, filter out the disabled ones and then pick the one
with the highest netmask which should be the most specific one.
2024-08-19 22:55:58 +00:00
Reactor Scram
da90c55c98 fix(gui-client/linux): bump keyring to 3.2.0 (#6345)
Closes #6175 (formerly closed as unable to replicate)

In some cases GNOME keyring will hide the attributes of credentials, so
`keyring` would throw an `Ambiguous` error when trying to sign in or
sign out, making it impossible to do anything.

The new version of `keyring` unlocks the keyring in this case, so the
attributes are shown and we can sign in correctly.

Thanks to @brotskydotcom for debugging and fixing this!
2024-08-19 22:44:24 +00:00
dependabot[bot]
217faeabf0 build(deps): Bump nix from 0.28.0 to 0.29.0 in /rust (#6343)
Bumps [nix](https://github.com/nix-rust/nix) from 0.28.0 to 0.29.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/nix-rust/nix/blob/master/CHANGELOG.md">nix's
changelog</a>.</em></p>
<blockquote>
<h2>[0.29.0] - 2024-05-24</h2>
<h3>Added</h3>
<ul>
<li>Add <code>getregset()/setregset()</code> for
Linux/glibc/x86/x86_64/aarch64/riscv64 and
<code>getregs()/setregs()</code> for Linux/glibc/aarch64/riscv64
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2044">#2044</a>)</li>
<li>Add socket option Ipv6Ttl for apple targets.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2287">#2287</a>)</li>
<li>Add socket option UtunIfname.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2325">#2325</a>)</li>
<li>make SigAction repr(transparent) &amp; can be converted to the libc
raw type
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2326">#2326</a>)</li>
<li>Add <code>From</code> trait implementation for conversions between
<code>sockaddr_in</code> and
<code>SockaddrIn</code>, <code>sockaddr_in6</code> and
<code>SockaddrIn6</code>
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2328">#2328</a>)</li>
<li>Add socket option ReusePortLb for FreeBSD.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2332">#2332</a>)</li>
<li>Added support for openat2 on linux.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2339">#2339</a>)</li>
<li>Add if_indextoname function.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2340">#2340</a>)</li>
<li>Add <code>mount</code> and <code>unmount</code> API for apple
targets.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2347">#2347</a>)</li>
<li>Added <code>_PC_MIN_HOLE_SIZE</code> for <code>pathconf</code> and
<code>fpathconf</code>.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2349">#2349</a>)</li>
<li>Added <code>impl AsFd for pty::PtyMaster</code>
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2355">#2355</a>)</li>
<li>Add <code>open</code> flag <code>O_SEARCH</code> to AIX,
Empscripten, FreeBSD, Fuchsia, solarish,
WASI (<a
href="https://redirect.github.com/nix-rust/nix/pull/2374">#2374</a>)</li>
<li>Add prctl function <code>prctl_set_vma_anon_name</code> for
Linux/Android.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2378">#2378</a>)</li>
<li>Add <code>sync(2)</code> for
<code>apple_targets/solarish/haiku/aix/hurd</code>,
<code>syncfs(2)</code> for
<code>hurd</code> and <code>fdatasync(2)</code> for
<code>aix/hurd</code>
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2379">#2379</a>)</li>
<li>Add fdatasync support for Apple targets.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2380">#2380</a>)</li>
<li>Add <code>fcntl::OFlag::O_PATH</code> for FreeBSD and Fuchsia
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2382">#2382</a>)</li>
<li>Added <code>PathconfVar::MIN_HOLE_SIZE</code> for apple_targets.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2388">#2388</a>)</li>
<li>Add <code>open</code> flag <code>O_SEARCH</code> to apple_targets
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2391">#2391</a>)</li>
<li><code>O_DSYNC</code> may now be used with <code>aio_fsync</code> and
<code>fcntl</code> on FreeBSD.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2404">#2404</a>)</li>
<li>Added <code>Flock::relock</code> for upgrading and downgrading
locks.
(<a
href="https://redirect.github.com/nix-rust/nix/pull/2407">#2407</a>)</li>
</ul>
<h3>Changed</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1dad4d8d04"><code>1dad4d8</code></a>
chore: prepare for 0.29.0</li>
<li><a
href="f7431971b4"><code>f743197</code></a>
fix ControlMessageOwned::UdpGroSegments UDP packets processing type. (<a
href="https://redirect.github.com/nix-rust/nix/issues/2406">#2406</a>)</li>
<li><a
href="208b80b65d"><code>208b80b</code></a>
recvmsg: Check if CMSG buffer was too small and return an error (<a
href="https://redirect.github.com/nix-rust/nix/issues/2413">#2413</a>)</li>
<li><a
href="ecd12a9990"><code>ecd12a9</code></a>
test: remove test of inode count in test_statfs.rs (<a
href="https://redirect.github.com/nix-rust/nix/issues/2414">#2414</a>)</li>
<li><a
href="663506a602"><code>663506a</code></a>
fix: only close <code>fanotify</code> events with a valid fd (<a
href="https://redirect.github.com/nix-rust/nix/issues/2399">#2399</a>)</li>
<li><a
href="1604723757"><code>1604723</code></a>
revert: impl From&lt;sigaction&gt; for SigAction (<a
href="https://redirect.github.com/nix-rust/nix/issues/2410">#2410</a>)</li>
<li><a
href="ec4beb5a22"><code>ec4beb5</code></a>
docs: correct limit value of FAN_UNLIMITED_QUEUE and
FAN_UNLIMITED_MARKS[skip...</li>
<li><a
href="84c0444c3a"><code>84c0444</code></a>
chore: bump libc to 0.2.155 (<a
href="https://redirect.github.com/nix-rust/nix/issues/2409">#2409</a>)</li>
<li><a
href="c5af4adffd"><code>c5af4ad</code></a>
Add Flock::relock (<a
href="https://redirect.github.com/nix-rust/nix/issues/2407">#2407</a>)</li>
<li><a
href="e7acaff07f"><code>e7acaff</code></a>
Enable O_DSYNC on FreeBSD with fcntl and aio_fsync (<a
href="https://redirect.github.com/nix-rust/nix/issues/2404">#2404</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/nix-rust/nix/compare/v0.28.0...v0.29.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nix&package-manager=cargo&previous-version=0.28.0&new-version=0.29.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 22:43:45 +00:00
Thomas Eizinger
4c30d78cda fix: refer to correct tag in git-version (#6334)
The output of `git describe` always refers to the last tag that it can
find. This leads to confusing versions being printed such as:

```
2024-08-19T00:24:08.983891Z  INFO firezone_headless_client: arch="x86_64" git_version="gateway-1.1.5-30-gf82fee162-modified"
```

Note that this is code running in the headless-client and it refers to
the gateway tag. Whilst not wrong from git's PoV, it is certainly
confusing.

We can fix this by providing a glob-pattern to `git describe` via
`--match`. This makes git ignore any other tags and print a version
identifier that refers to the current program:

```
2024-08-19T00:39:48.634191Z  INFO firezone_headless_client: arch="x86_64" git_version="headless-client-1.1.7-31-ga08a3411d-modified"
```
2024-08-19 22:42:15 +00:00
dependabot[bot]
f9fb7531cc build(deps): Bump minidumper from 0.8.2 to 0.8.3 in /rust (#6342)
Bumps [minidumper](https://github.com/EmbarkStudios/crash-handling) from
0.8.2 to 0.8.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/EmbarkStudios/crash-handling/releases">minidumper's
releases</a>.</em></p>
<blockquote>
<h2>minidumper-0.8.3</h2>
<ul>
<li>Lint fix</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a5553466de"><code>a555346</code></a>
chore: Release</li>
<li><a
href="45a469c86e"><code>45a469c</code></a>
chore: Release</li>
<li><a
href="d4d6f25cce"><code>d4d6f25</code></a>
chore: Release</li>
<li><a
href="7818928239"><code>7818928</code></a>
Update CHANGELOGs</li>
<li><a
href="e524a897c2"><code>e524a89</code></a>
Add heap corruption exception handling (<a
href="https://redirect.github.com/EmbarkStudios/crash-handling/issues/86">#86</a>)</li>
<li>See full diff in <a
href="https://github.com/EmbarkStudios/crash-handling/compare/minidumper-0.8.2...minidumper-0.8.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=minidumper&package-manager=cargo&previous-version=0.8.2&new-version=0.8.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 21:07:39 +00:00
dependabot[bot]
81043ea89d build(deps): Bump serde_json from 1.0.117 to 1.0.125 in /rust (#6344)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.117 to
1.0.125.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/serde-rs/json/releases">serde_json's
releases</a>.</em></p>
<blockquote>
<h2>1.0.125</h2>
<ul>
<li>Speed up \uXXXX parsing and improve handling of unpaired surrogates
when deserializing to bytes (<a
href="https://redirect.github.com/serde-rs/json/issues/1172">#1172</a>,
<a
href="https://redirect.github.com/serde-rs/json/issues/1175">#1175</a>,
thanks <a
href="https://github.com/purplesyringa"><code>@​purplesyringa</code></a>)</li>
</ul>
<h2>v1.0.124</h2>
<ul>
<li>Fix a bug in processing string escapes in big-endian architectures
(<a
href="https://redirect.github.com/serde-rs/json/issues/1173">#1173</a>,
thanks <a
href="https://github.com/purplesyringa"><code>@​purplesyringa</code></a>)</li>
</ul>
<h2>v1.0.123</h2>
<ul>
<li>Optimize string parsing by applying SIMD-within-a-register: 30.3%
improvement on <a
href="https://github.com/miloyip/nativejson-benchmark/blob/v1.0.0/data/twitter.json">twitter.json</a>
from 613 MB/s to 799 MB/s (<a
href="https://redirect.github.com/serde-rs/json/issues/1161">#1161</a>,
thanks <a
href="https://github.com/purplesyringa"><code>@​purplesyringa</code></a>)</li>
</ul>
<h2>v1.0.122</h2>
<ul>
<li>Support using <code>json!</code> in no-std crates (<a
href="https://redirect.github.com/serde-rs/json/issues/1166">#1166</a>)</li>
</ul>
<h2>v1.0.121</h2>
<ul>
<li>Optimize position search in error path (<a
href="https://redirect.github.com/serde-rs/json/issues/1160">#1160</a>,
thanks <a
href="https://github.com/purplesyringa"><code>@​purplesyringa</code></a>)</li>
</ul>
<h2>v1.0.120</h2>
<ul>
<li>Correctly specify required version of <code>indexmap</code>
dependency (<a
href="https://redirect.github.com/serde-rs/json/issues/1152">#1152</a>,
thanks <a
href="https://github.com/cforycki"><code>@​cforycki</code></a>)</li>
</ul>
<h2>v1.0.119</h2>
<ul>
<li>Add <code>serde_json::Map::shift_insert</code> (<a
href="https://redirect.github.com/serde-rs/json/issues/1149">#1149</a>,
thanks <a
href="https://github.com/joshka"><code>@​joshka</code></a>)</li>
</ul>
<h2>v1.0.118</h2>
<ul>
<li>Implement Hash for serde_json::Value (<a
href="https://redirect.github.com/serde-rs/json/issues/1127">#1127</a>,
thanks <a
href="https://github.com/edwardycl"><code>@​edwardycl</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="6130f9b358"><code>6130f9b</code></a>
Release 1.0.125</li>
<li><a
href="cc7a1608c9"><code>cc7a160</code></a>
Touch up PR 1175</li>
<li><a
href="0f942e5b52"><code>0f942e5</code></a>
Merge pull request 1175 from iex-rs/faster-backslash-u</li>
<li><a
href="d8921cd29b"><code>d8921cd</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1172">#1172</a>
from iex-rs/faster-hex</li>
<li><a
href="b4bc6436ac"><code>b4bc643</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1176">#1176</a>
from dtolnay/miriname</li>
<li><a
href="94a2aad7b7"><code>94a2aad</code></a>
Improve job names for miri jobs</li>
<li><a
href="8073fc16b8"><code>8073fc1</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1174">#1174</a>
from iex-rs/miri-on-ci</li>
<li><a
href="96ae60445d"><code>96ae604</code></a>
Correct WTF-8 parsing</li>
<li><a
href="236cc8247d"><code>236cc82</code></a>
Simplify unicode escape handling</li>
<li><a
href="2f28d106e6"><code>2f28d10</code></a>
Use the same UTF-8/WTF-8 impl for surrogates</li>
<li>Additional commits viewable in <a
href="https://github.com/serde-rs/json/compare/v1.0.117...1.0.125">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde_json&package-manager=cargo&previous-version=1.0.117&new-version=1.0.125)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-19 21:06:45 +00:00
Gabi
123bad59f5 chore(connlib): reduce noisy log level (#6350)
Fixes #6349
2024-08-19 20:00:08 +00:00
Reactor Scram
a558ce8cf6 chore(rust): bump Rust to 1.80.1 (#6346)
This fixes some little bugs that probably don't affect us.
2024-08-19 18:05:51 +00:00
Thomas Eizinger
896fe49f1f fix(relay): set better OTEL metadata (#6322)
Previously, the `service.name` attribute got overridden with "unknown
service" from the detector used in `Resource::default`. To avoid this,
we are now manually composing the two other detectors.

This gives us a useful set of default labels from within the code yet it
allows overriding all of them using `OTEL_RESOURCE_ATTRIBUTES`.
2024-08-16 23:17:10 +00:00
Thomas Eizinger
3b56664e02 test(rust): ensure deterministic proptests (#6319)
For quite a while now, we have been making extensive use of
property-based testing to ensure `connlib` works as intended. The idea
of proptests is that - given a certain seed - we deterministically
sample test inputs and assert properties on a given function.

If the test fails, `proptest` prints the seed which can then be added to
a regressions file to iterate on the test case and fix it. It is quite
obvious that non-determinism in how the test input gets generated is no
bueno and reduces the value we get out of these tests a fair bit.

The `HashMap` and `HashSet` data structures are known to be
non-deterministic in their iteration order. This causes non-determinism
during the input generation because we make use of a lot of maps and
sets to gradually build up the test input. We fix all uses of `HashMap`
and `HashSet` by replacing them with `BTreeMap` and `BTreeSet`.

To ensure this doesn't regress, we refactor `tunnel_test` to not make
use of proptest's macros and instead, we initialise and run the test
ourselves. This allows us to dump the sampled state and transitions into
a file per test run. In CI, we then run a 2nd iteration of all
regression tests and compare the sampled state and transitions with the
previous run. They must match byte-for-byte.

Finally, to discourage use of non-deterministic iteration, we ban the
use of the iteration functions on `HashMap` and `HashSet` across the
codebase. This doesn't catch iteration in a `for`-loop but it is better
than not linting against it at all.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-08-16 23:15:58 +00:00
Thomas Eizinger
4750d76fce fix(relay): re-insert channel into fast-path map (#6332)
This is a test-failure detected in
https://github.com/firezone/firezone/actions/runs/10426492110/job/28879531621.

In the relay, we have fast-path lookup maps to for incoming traffic from
peers. This improves throughput as any incoming packet only needs to
look-up a single routing entry. Unfortunately, this creates duplication
in how the data must be stored.

In #6276, we correctly identified that channels must be re-bound on the
relay when a client sends `CHANNEL_BIND` message whilst the channel is
cooling down. What we failed to identify (and what as now caught by the
tests) is that we also need to re-insert the entry into the fast-path
lookup map to actually allow data from flowing through the channel.
2024-08-16 23:14:00 +00:00
Gabi
83a1e06053 fix(connlib): handle single asterisk resources in tests (#6330)
Extracted from #6325
2024-08-16 22:04:45 +00:00
Thomas Eizinger
c51cf096ae build(rust): avoid unnecessary rebuilds (#6321)
Parsing the current Git version within `firezone-bin-shared` means this
crate (and all its dependents) need to be rebuilt everytime one makes a
commit, even if none of the code actually changes.

To avoid this whilst still allowing `firezone-bin-shared` to export a
useful, shared function, we export a macro instead that can be called
from the respective crates that need the GIT version. This means only
those binaries will be marked as dirty and rebuilds of e.g. unit tests
don't need to rebuild these workspace crates.
2024-08-16 15:30:04 +00:00
dependabot[bot]
b606e4ec80 build(deps): Bump either from 1.11.0 to 1.13.0 in /rust (#6263)
Bumps [either](https://github.com/rayon-rs/either) from 1.11.0 to
1.13.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="e3ec2506f9"><code>e3ec250</code></a>
Merge pull request <a
href="https://redirect.github.com/rayon-rs/either/issues/108">#108</a>
from cuviper/release-1.13.0</li>
<li><a
href="00fecfbe21"><code>00fecfb</code></a>
Release 1.13.0</li>
<li><a
href="add181769a"><code>add1817</code></a>
Fix clippy::doc_lazy_continuation</li>
<li><a
href="cd0aab908e"><code>cd0aab9</code></a>
Merge pull request <a
href="https://redirect.github.com/rayon-rs/either/issues/107">#107</a>
from ColonelThirtyTwo/cloned-copied</li>
<li><a
href="e31810d584"><code>e31810d</code></a>
Fix docs on Either&lt;&amp;mut L, &amp;mut R&gt;::copied</li>
<li><a
href="8e626907ac"><code>8e62690</code></a>
Add Either::cloned and Either::copied</li>
<li><a
href="1cea51a48a"><code>1cea51a</code></a>
Merge pull request <a
href="https://redirect.github.com/rayon-rs/either/issues/106">#106</a>
from cuviper/nth_back</li>
<li><a
href="a4382cb231"><code>a4382cb</code></a>
Release 1.12.0</li>
<li><a
href="abb6f04e91"><code>abb6f04</code></a>
Specialize <code>nth_back</code> (MSRV 1.37)</li>
<li>See full diff in <a
href="https://github.com/rayon-rs/either/compare/1.11.0...1.13.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=either&package-manager=cargo&previous-version=1.11.0&new-version=1.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 10:36:08 +00:00
Gabi
df4d604ad3 feat(gui-clients): permit resource enable and disable (#6248)
Last PR for #6074

This adds Enable/Disable for tauri clients.

In windows, edge seems to hold on to the sockets for a bit too long
after disabling the resources. This will be solved for the internet
resource probably by modifying the firewall, in another PR.
2024-08-16 03:41:15 +00:00
Thomas Eizinger
417de82b8c test: handle locally answered queries (#6317)
When refactoring the expected behaviour for DNS queries, we overlooked a
case where we expected a DNS query to get routed through the tunnel
although it was a query for a DNS resource.

Fixes: #6310.
2024-08-16 02:14:44 +00:00
Thomas Eizinger
b13e52b124 build(deps): converge Rust quinn dependency (#6314) 2024-08-16 02:06:18 +00:00
Thomas Eizinger
bbef3af286 build(deps): use upstream str0m (#6315)
https://github.com/algesten/str0m/pull/489 got merged, we can thus
depend on upstream again.
2024-08-16 01:33:35 +00:00