Commit Graph

659 Commits

Author SHA1 Message Date
Brian Manifold
1f457d2127 fix(portal): Fixing a few edge cases for identity email (#7532) 2024-12-16 23:11:25 +00:00
Jamil
d8dda14759 docs: Appease codespell in elixir/README.md (#7528) 2024-12-15 17:01:54 -08:00
Jamil
fe164389c1 docs: Add instructions for connecting to Cloud SQL as the firezone user (#7527)
This is needed to perform index surgery.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-12-15 16:39:29 -08:00
Jamil
9fdfbea818 chore: fix elixir formatting (#7524) 2024-12-15 10:50:48 -08:00
Jamil
938448a43b fix(portal): Update existing auth_identities migration to include provider_identifier in the index (#7523)
#7522 won't successfully complete on production because of the migration
in this PR. So, instead, we need to modify this migration, and then
manually apply the same operation to staging.
2024-12-15 10:08:25 -08:00
Jamil
d3f38a22ae fix(portal): Add provider_identifier to identities email unique index (#7522)
It's possible for two of the same emails to exist within the same
provider, so we need to add `provider_identifier` to the unique index to
enforce uniqueness properly.

Refs https://firezonehq.slack.com/archives/C04HRQTFY0Z/p1734131256450379
2024-12-15 09:37:22 -08:00
Brian Manifold
f114bc95cd refactor(portal): Add email as separate column on auth_identities table (#7472)
Why:

* Currently, when using the API, a user has no way of easily identifying
what identities they are pulling back as the response only includes the
`provider_identifier` which for most of our AuthProviders is an ID for
the IdP and not an email address. Along with that, when adding users to
an OIDC provider within Firezone, there is no check for whether or not
an identity has already been added with a given email address. By
creating a separate email column on the `auth_identities` table, it will
be very straight forward to know whether an email address exists for a
given identity, return it in an API response and allow the admin of a
Firezone account to track users (Identities) by email rather than IdP
identifier.

Fixes #7392
2024-12-13 17:26:47 +00:00
Brian Manifold
9711cf56c1 fix(portal): Fix update API endpoint for resources (#7493)
Why:

* The API endpoint for updating Resources was using
`Resources.fetch_resource_by_id_or_persistent_id`, however that function
was fetching all Resources, which included deleted Resources. In order
to prevent an API user from attempting to update a Resource that is
deleted, a new function was added to fetch active Resources only.

Fixes: #7492
2024-12-12 22:51:28 +00:00
Brian Manifold
b66a156831 fix(portal): Set Floki dependency back to hex (#7387)
Found a small `TODO` while working on other things and figured I'd
quickly fix it.

Following these 2 github issues indicate the problem has been fixed:
https://github.com/philss/floki/issues/556
https://github.com/hexpm/hex/issues/1019
2024-11-21 02:06:37 +00:00
Brian Manifold
328e973502 feat(portal): add membership to google parent OUs (#6811) (#7382)
Hi @firezone/engineering , this is the following of
https://github.com/firezone/firezone/pull/6649

I forgot that people can be member of multiple OUs, this PR aims to add
support for this.

Imagine I have this OU architecture in my google workspace:

```mermaid
flowchart TD
    A[Employees] --> B[Engineering]
    A --> C[HR]
    B --> D[Devs]
    B --> E[Ops]
    D --> F{me}
```

Currently in Firezone, I will only be a member of the Firezone Group
`OU: Devs`.

With this PR: I will be a member of `OU: Devs`, `OU: Engineering` and
`OU: Employees`

Co-authored-by: Antoine <antoinelabarussias@gmail.com>
2024-11-19 21:38:22 +00:00
Brian Manifold
1ef286ac55 fix(portal): API clients 'show' page should always be in settings (#7371)
Why:

* The portal currently shows API clients in the Actors index list. Each
Actor in the list has a link to their own 'show' page. Prior to this
commit, selecting an API client from the list would result an error.
While API clients are technically an Actor, they aren't quite the same
as all other Actors because they are only used to configure the portal
for a given account. Because of this, they don't have the same
information to show as all other Actors. This commit sets the 'show' URL
for API clients to the 'settings' page to show the proper info for the
API client.

Fixes: #7370
2024-11-18 18:52:23 +00:00
Brian Manifold
2d93100c41 fix(portal): Update Stripe event handler to only listen for certain update events (#7357)
Why:

* Recently we had an issue where a customer's payment info was
incorrectly entered, which caused the payment to not go through. When
something like this happens Stripe will send an update event with a
pending_update section (which we do not use currently). When the
customer fixes the payment info, and payment goes through we get another
update event with the correct subscription info, however, the previous
update (with the pending section) then gets expired and a
`pending_update_expired` event is sent to us. We had been inadvertantly
catching the event and updating the specified account with the info in
the event (which happened to be the previous state of the subscription)

Fixes: #7352
2024-11-15 20:52:50 +00:00
Jamil
6f7f6a4f34 style: Enforce code style across all supported languages using Prettier (#7322)
This ensure that we run prettier across all supported filetypes to check
for any formatting / style inconsistencies. Previously, it was only run
for files in the website/ directory using a deprecated pre-commit
plugin.

The benefit to keeping this in our pre-commit config is that devs can
optionally run these checks locally with `pre-commit run --config
.github/pre-commit-config.yaml`.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-11-13 00:19:15 +00:00
Brian Manifold
1a6e70a3d2 fix(portal): Fix sign_up/sign_in email templates (#7295)
Why:

* Two of the email templates using an `<a>` tag were not properly
interpolating a view variable. This happened when the templates were
moved from the `web` app using `.heex` files to the `domain` app using
`.eex` files.

Fixes #7294
2024-11-10 04:24:04 +00:00
Brian Manifold
40ca7fccf0 fix(portal): Update log level for failed component version fetch (#7286)
Why:

* The Firezone website is hosting the component versions at the moment
      and due to how Vercel works, occassionally a request will
timeout when being made to the /api/versions endpoint. This had been
      throwing an error in the elixir logs and triggering an alert, but
because there is always a default set of component version values in
      the elixir app there isn't really a need for an error/alert.  With
      that in mind the log level will be set to `warning` rather than
      `error`.
      
Closes #7233
2024-11-08 17:37:27 +00:00
Andrew Dryga
ab7619c68c chore(docs): Add more docs on troubleshooting (#7076)
Signed-off-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Brian Manifold <bmanifold@users.noreply.github.com>
2024-11-07 21:02:21 +00:00
Brian Manifold
06791d2d05 refactor(portal): API persistent IDs (#7182)
In order for the firezone terraform provider to work properly, the
Resources and Policies need to be able to be referenced by their
`persistent_id`, specifically in the portal API.
2024-11-07 20:45:56 +00:00
Andrew Dryga
a67c12de7e fix(portal): Polish link in peeks (#7180) 2024-10-29 19:22:20 -06:00
Andrew Dryga
f296dc5ad2 feat(portal): Show clients peek on actors index (#7100)
We will show up to 5 recently started client icons and a status for them
as a green dot badge (no dot when it's offline to keep things simple).
Additional details are available on hover.

<img width="1415" alt="1"
src="https://github.com/user-attachments/assets/1d48d08b-f024-4016-837a-3a2ac9a34718">
<img width="1413" alt="2"
src="https://github.com/user-attachments/assets/101ff122-26e2-4282-ae1d-073b4eba9c56">

I also extended the `Clients` table on "Actor" view page to match the
"Clients" index view.

Also closes #7096
2024-10-28 16:06:22 -06:00
Andrew Dryga
0452273a16 fix(portal): Change groups table column widths (#7089) 2024-10-18 13:29:08 -06:00
Thomas Eizinger
ce1e59c9fe feat(connlib): implement idempotent control protocol for gateway (#6941)
This PR implements the new idempotent control protocol for the gateway.
We retain backwards-compatibility with old clients to allow admins to
perform a disruption-free update to the latest version.

With this new control protocol, we are moving the responsibility of
exchanging the proxy IPs we assigned to DNS resources to a p2p protocol
between client and gateway. As a result, wildcard DNS resources only get
authorized on the first access. Accessing a new domain within the same
resource will thus no longer require a roundtrip to the portal.

Overall, users will see a greatly decreased connection setup latency. On
top of that, the new protocol will allow us to more easily implement
packet buffering which will be another UX boost for Firezone.
2024-10-18 15:59:47 +00:00
Andrew Dryga
5888aa0f49 fix(portal): Only show one icon next to client name and make it match the style of heroicons (#7085)
<img width="1376" alt="Screenshot 2024-10-17 at 2 05 35 PM"
src="https://github.com/user-attachments/assets/4d294e60-35c5-4ebf-b3cc-6bfdbf5230e3">
2024-10-17 16:00:36 -06:00
Andrew Dryga
268825d45b fix(portal): Fix table titles (#7080) 2024-10-16 16:27:09 -06:00
Andrew Dryga
37ef2cb591 feat(portal): Allow filtering clients by presence and deleting them (#7078)
Closes #7073

<img width="1434" alt="Screenshot 2024-10-16 at 12 40 50 PM"
src="https://github.com/user-attachments/assets/2c03f38c-c67e-49db-9453-e23651c8d61c">

<img width="1154" alt="Screenshot 2024-10-16 at 12 47 37 PM"
src="https://github.com/user-attachments/assets/da519458-1447-4dfe-9cef-536bf7760ce2">
2024-10-16 13:29:24 -06:00
Andrew Dryga
b3c2e54460 feat(portal): New version of the WS control protocol (#6761)
TODOs:
- [x] Switch to sending messages instead of replies
- [ ] Do not hide pre-filtered resources and render them with an error
instead (in case we will want to expose that on a client later)
- [x] Figure out how to generate PSK so that it stays across WS
connections
2024-10-16 10:57:54 -06:00
Andrew Dryga
3c4db73946 feat(portal): Show client OS and version (#7039)
Closes #6157

<img width="1728" alt="Screenshot 2024-10-14 at 4 37 46 PM"
src="https://github.com/user-attachments/assets/5775f2cd-bf0b-43a3-b994-ad0fcfd24ccc">
<img width="1366" alt="Screenshot 2024-10-14 at 4 38 24 PM"
src="https://github.com/user-attachments/assets/3dc958a7-62d6-45d8-8258-2790c88c97d4">
2024-10-15 14:53:50 -06:00
Andrew Dryga
3567399efe fix(portal): Remove extra space before a link (#7040)
<img width="394" alt="Screenshot 2024-10-14 at 4 49 09 PM"
src="https://github.com/user-attachments/assets/1f1f3eba-96a5-49c6-b05b-d28439041a56">
2024-10-15 12:53:35 -06:00
Andrew Dryga
2ab70c2f27 feat(portal): Add flash asking people to deploy more than 1 gateway to a site (#7034)
This should help with showcasing core features of our product and to
increase their adoption.

Closes #5009
2024-10-14 15:50:19 -06:00
Andrew Dryga
7245652671 fix(portal): Make sure modals start with Confirm.. (#7032)
Closes #6713
2024-10-14 14:05:33 -06:00
Andrew Dryga
f89cc67fda fix(portal): Fix copy-paste buttons (#7033)
- Added semi-transparent shadow to the button so that it's more visible
when text is overlapping it. Padding did not look well because it
required scrollbar to be moved inside the parent container and it looked
very ugly
- Replaced custom phx hook with a new native Tailwind component

Closes #5973
2024-10-14 14:05:14 -06:00
Thomas Eizinger
05e895525b chore: set simpler default log filters (#7028)
Follow-up from #6985 to simplify our log filters everywhere. If any of
this doesn't fit, we should adjust the things here:


17ea827c03/rust/logging/src/lib.rs (L32-L40)
2024-10-14 18:54:36 +00:00
Andrew Dryga
1abfa10fb7 fix(portal): UX improvements (#7013)
This PR accumulates lots of small UX fixes from #6645.

---------

Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2024-10-14 11:32:44 -06:00
Brian Manifold
41d1916cc7 fix(portal): Fix outdated gateway notification to respect enable/disable status (#7016)
Realized the enable/disable setting wasn't being respected for the
outdated gateway notification. This PR should fix that issue.
2024-10-13 06:38:28 +00:00
Brian Manifold
7838da9739 fix(portal): Prevent upstream DNS config from using sentinel CIDR ranges (#7010)
Closes #6962
2024-10-11 21:15:29 +00:00
Brian Manifold
7fda4c52c4 feat(portal): Add outdated gateway notifications (#6841)
Why:

* Without some type of notification, users do not realize that new
Gateway versions have been released and thus do not seem to be upgrading
their deployed Gateways.
2024-10-11 12:46:00 +00:00
Brian Manifold
4dde7293d5 fix(portal): Fix show page errors when entity was created by API (#7002)
Why:

* A handful of 'show' pages were throwing errors for entities created
using the API. The reason was due to the fact that the
`created_by_actor` was not being preloaded and when the details on the
show page were being rendered. This commit updates the various pages to
preload the `created_by_actor` to allow for both API created entities
and UI created entities.
2024-10-10 15:44:53 +00:00
Andrew Dryga
945b5813a0 fix(portal): Make DNS address validations more strict (#6991)
Closes ##6981
2024-10-10 09:10:00 -06:00
Brian Manifold
928fab3878 fix(portal): Fix minor UI issues on API Clients show page (#6955)
- Updated revoke button colors and icons.
- Updated the 'Created By' to use a helper function to get an email
address rather than using the provider_identifier which may be a random
string depending on the type of provider the identity was created under.
- Added a link to the actor that created the API token

### Screenshot of updated view
<img width="1168" alt="Screenshot 2024-10-07 at 1 11 43 PM"
src="https://github.com/user-attachments/assets/80444815-f045-49db-b570-dc9dc58c33d2">

Closes #6269
2024-10-08 14:40:40 +00:00
Andrew Dryga
34f42cb761 feat(portal): Accept hardware identifier fields and reset verification when they are changed (#6914)
If previous value is **null then** a new value is persisted and
verification is **not removed**.
If previous value is **not null** then a new value is persisted and
verification is **removed**.

<img width="957" alt="Screenshot 2024-10-02 at 4 59 58 PM"
src="https://github.com/user-attachments/assets/302208ca-3693-40f7-a08a-4521b7c0df05">

---------

Signed-off-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-10-04 01:02:55 -06:00
Andrew Dryga
99866a81cc feat(portal): Refresh browser session token expirations using OIDC (#6786)
Closes [#2042](https://github.com/firezone/firezone/issues/2042)
2024-10-02 12:32:20 -06:00
dependabot[bot]
27469d17d7 build(deps): Bump flowbite from 2.5.1 to 2.5.2 in /elixir/apps/web/assets (#6885)
Bumps [flowbite](https://github.com/themesberg/flowbite) from 2.5.1 to
2.5.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/themesberg/flowbite/releases">flowbite's
releases</a>.</em></p>
<blockquote>
<h2>v2.5.2</h2>
<ul>
<li>release new <a
href="https://flowbite.com/docs/plugins/wysiwyg/">WYSIWYG text
editor</a> component</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="5c8df35e2b"><code>5c8df35</code></a>
docs(readme): add wysiwyg to readme</li>
<li><a
href="26cb313102"><code>26cb313</code></a>
Merge pull request <a
href="https://redirect.github.com/themesberg/flowbite/issues/971">#971</a>
from themesberg/wysiwyg</li>
<li><a
href="933b112fef"><code>933b112</code></a>
chore(wysiwyg) update to <code>v2.5.2</code></li>
<li><a
href="7aa2a6b366"><code>7aa2a6b</code></a>
feat(wysiwyg): finish the component</li>
<li><a
href="e799dc286e"><code>e799dc2</code></a>
feat(wysiwyg): add toggle buttons</li>
<li><a
href="30f5133ec3"><code>30f5133</code></a>
feat(wysiwyg): add next and prev cell navigation butoons</li>
<li><a
href="6e4cb24cf8"><code>6e4cb24</code></a>
feat(wysiwyg): set styles for currently selected cells</li>
<li><a
href="3d3261d3af"><code>3d3261d</code></a>
feat(wysiwyg): delete table feature and organise buttons</li>
<li><a
href="8270c05898"><code>8270c05</code></a>
feat(wysiwyg): add column and row behaviour actions</li>
<li><a
href="145f5617fb"><code>145f561</code></a>
docs(wysiwyg): write js behaviour docs</li>
<li>Additional commits viewable in <a
href="https://github.com/themesberg/flowbite/compare/v2.5.1...v2.5.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=flowbite&package-manager=npm_and_yarn&previous-version=2.5.1&new-version=2.5.2)](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-10-02 18:08:53 +00:00
Andrew Dryga
14544b27cc feat(portal): Allow connection-time conditions for internet resources (#6899)
Closes #6848
2024-10-01 16:10:17 -06:00
Andrew Dryga
759e944729 fix(portal): Change provider_identifier type to citext (#6901)
Closes #6872
2024-10-01 16:08:42 -06:00
Jamil
b298e79d06 fix(portal): Minor UI consistency fixes for resource/group select (#6860)
- [x] Spacing consistency
- [x] Border radius consistency
- [x] Minor grammar
- [x] Dismiss select when item is selected
- [x] Add shadow to stand out from rest of form
- [x] Prevent from opening when disabled
- [x] Use `cursor-not-allowed` when disabled for consistency with other
form elements


Before


<img width="670" alt="Screenshot 2024-09-27 at 5 01 38 PM"
src="https://github.com/user-attachments/assets/79e3a4c6-4d23-4edd-93b2-149acc58c37b">



After


<img width="677" alt="Screenshot 2024-09-27 at 5 11 48 PM"
src="https://github.com/user-attachments/assets/e1453c05-fed7-4d87-a176-6f6ce1267488">

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Andrew Dryga <a@firezone.dev>
2024-10-01 16:14:45 +00:00
Andrew Dryga
c2b8633914 feat(portal): Allow searching for resources and groups while creating and editing policies (#6840)
Closes #4186

Video: 

![demo](https://github.com/user-attachments/assets/c11870f5-b512-4ee1-8c48-ab292f1ff8ea)
2024-09-27 13:54:42 -06:00
Brian Manifold
f4554d2795 fix(portal): Update IDP sync error notification threshold (#6797)
Why:

* Instead of sending a notification to users when an identity provider
in their account fails to sync 1 time, we've now decided to wait until
the sync failures have reached 10 times to account for various anomalies
that might occur with any given identity providers API.
2024-09-23 19:30:48 +00:00
Jamil
4c6a64defe fix(portal): Fix order of desc and name (#6796)
Updated to match the precedent set by `new`
2024-09-20 13:50:54 -07:00
Brian Manifold
d69788fde6 fix(portal): Throttle reqs/sec and scheduled frequency on Okta sync jobs (#6794)
Why:

* Our current Okta sync job has no throttle, which has caused an issue
with customers that have other applications hitting their Okta API by
going over their API rate limits. By throttling the requests per second
and by lowering the frequency of how often the job runs we should
hopefully aleviate any Okta API rate limiting issues. This will come at
the expense of syncs taking longer and not happening as often, however,
this tradeoff seems worthwhile to ensure Firezone isn't hindering a
customers use of their Okta API.

Closes: #6748

---------

Signed-off-by: Brian Manifold <bmanifold@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-09-20 20:22:44 +00:00
Andrew Dryga
0d6c15c787 fix(portal): Do not break Flowbite popovers on DOM patching (#6787)
Closes [#6682](https://github.com/firezone/firezone/issues/6682)
2024-09-19 16:09:38 -06:00
Andrew Dryga
7f11772b05 fix(portal): Fallback to the user token if service account token is not available (#6764) 2024-09-19 11:35:42 -06:00