Commit Graph

5393 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
Thomas Eizinger
027c136cb5 build(nix): add elixir dependencies to nix-shell (#6464)
In order to run an Elixir language server, Erlang and Elixir need to be
installed.
2024-08-28 04:56:32 +00:00
Andrew Dryga
2d083379c6 feat(portal): Internet resources (#6299)
They will be sent in the API for connlib 1.3 and above.

I think in future we can make a whole menu section called "Internet
Security" which will be a specialized UI for the new resource type (and
now show it in Resources list) to improve the user experience around it.

Closes #5852

---------

Signed-off-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-27 23:11:17 +00:00
Reactor Scram
8fef1d0f38 fix(changelog): write about #6455 and #6458 (#6460)
Closes #6459
2024-08-27 21:05:16 +00: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
Jamil
2b030d801d feat(android): Bundle GITHUB_SHA into Android client (#6405)
Closes #6400 


<img width="659" alt="Screenshot 2024-08-21 at 11 24 16 PM"
src="https://github.com/user-attachments/assets/c1240406-4dda-41df-a36e-1ed9e9b0895a">
2024-08-27 05:17:22 +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
1a2e10c45e revert(website): Re-add deployment feature section (#6447)
Reverts part of #6337 to add back the Deploy anywhere section.
2024-08-26 15:27:05 -07:00
Brian Manifold
5d3fc7d0c4 feat(portal): Update Client index page to search all columns (#6377)
Why:

* Currently, when searching on the Client index page in the portal, the
only field being searched is the Client name. This commit adds the
ability to search either the Client name or the Actor name.

Closes: #5738
2024-08-26 21:57:41 +00:00
Andrew Dryga
43dc6c2053 fix(portal): Preload provider on pubsub events for the policy (#6444) 2024-08-26 15:32:13 -06:00
Andrew Dryga
9a3c2d714b fix(portal): Do not crash clustering process when Compute API is not available (#6443) 2024-08-26 15:32:01 -06:00
Andrew Dryga
8e4a4a7b05 feat(portal): Pre-check constraint conformation on client connect (#6431)
Closes #6216
2024-08-26 15:30:46 -06:00
Andrew Dryga
5b93860ddb fix(portal): Prevent wildcard abuse in DNS resources (#6430)
Now most common TLDs can't have `*` or `?` on the 2nd level, and TLD
can't have matching in itself either.

Closes #6357
Closes #6415
2024-08-26 15:30:09 -06:00
Patti
cd6eabe71c fix(website): Fix graphics and adjust elevator image size (#6391)
Fix conditions graphic and adjust elevator image size

---------

Signed-off-by: Patti <139997703+Patticatti@users.noreply.github.com>
Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-26 21:04:59 +00:00
Jamil
944e2ba9a0 fix(devops): Trigger relays alert for below threshold (#6413)
Fixes #6412

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Andrew Dryga <a@firezone.dev>
2024-08-26 19:59:21 +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
Jamil
c3d5a2a2d7 fix(ux/portal): conditions ux tweaks (#6417)
fixes #6367 

<img width="720" alt="Screenshot 2024-08-22 at 1 58 20 PM"
src="https://github.com/user-attachments/assets/806e4393-17a4-4bdf-9c6c-c1cfad641d78">

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-23 05:15:02 +00:00
Thomas Eizinger
095358dd4a ci: set GITHUB_TOKEN For cargo-binstall (#6420)
`install-action` uses `cargo-binstall` as a fallback. That binary
contacts GitHub which may run into rate-limit without being
authenticated. In that case, we will install manually which takes very
long.

Resolves: #6374.
2024-08-23 04:01:40 +00: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
Jamil
0994bd145a feat(apple): Build GITHUB_SHA into Apple clients (#6406)
Closes #6401 

<img width="1012" alt="Screenshot 2024-08-21 at 11 52 31 PM"
src="https://github.com/user-attachments/assets/3012d088-97cb-4a82-8a8f-b2a398865755">

![Screenshot 2024-08-22 at 12 05
44 AM](https://github.com/user-attachments/assets/5e1209f9-e8fa-4453-9bdd-9f40339649b4)
2024-08-22 20:49:57 +00:00
Jamil
4ec78f70c2 docs: Uncomment new wildcard spec for DNS Resources (#6408)
This is being deployed now.
2024-08-22 10:38:13 -07:00
Jamil
43ff8fdc4b docs: Gateway 1.2.0 changelog (#6411)
Forgot to uncomment this yesterday when deploying.
2024-08-22 09:49:21 -07:00
Jamil
17c48c8b05 fix(ux/portal): Clarify note about IPv4/6 upstreams (#6407)
Closes #5115 

<img width="1155" alt="Screenshot 2024-08-22 at 1 10 56 AM"
src="https://github.com/user-attachments/assets/3138e055-28c5-47cc-a9db-9f78d36e0d40">
2024-08-22 16:18:28 +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
Andrew Dryga
25a22b4780 chore(portal): Test that we only render resources once in WS API (#6394) 2024-08-21 17:16:19 -06:00
Reactor Scram
0c0cd7b514 fix(macos): menu bar (#6376)
Closes #6370 

Tested with Jamil's patch. The bug is fixed on #6370 and no apparent
regressions on iOS

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-21 22:22:37 +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
Reactor Scram
2aa667f9ea fix(android): correct field name from can_disable to can_be_disabled (#6380)
Closes #6379

This fixes the crash on my system
2024-08-21 00:11:25 +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