diff --git a/elixir/apps/domain/lib/domain/auth.ex b/elixir/apps/domain/lib/domain/auth.ex index 800607041..c042ae682 100644 --- a/elixir/apps/domain/lib/domain/auth.ex +++ b/elixir/apps/domain/lib/domain/auth.ex @@ -30,7 +30,7 @@ defmodule Domain.Auth do has access to given object. It can be done by one of `ensure_has_access_to?/2` functions added to domain contexts responsible for the given schema, eg. `Domain.Accounts.ensure_has_access_to/2`. - Only exception is the authentication flow where user can not contain the subject yet, + Only exception is the authentication flow where user cannot contain the subject yet, but such queries MUST be filtered by the `account_id` and use indexes to prevent simple DDoS attacks. @@ -39,7 +39,7 @@ defmodule Domain.Auth do ### Color Coding The tokens are color coded using a `type` field, which means that a token issued for a browser session - can not be used for client calls and vice versa. Type of the token also limits permissions that will + cannot be used for client calls and vice versa. Type of the token also limits permissions that will be later added to the subject. You can find all the token types in enum value of `type` field in `Domain.Tokens.Token` schema. diff --git a/elixir/apps/domain/lib/domain/billing.ex b/elixir/apps/domain/lib/domain/billing.ex index bc3c7ec80..057ef87c0 100644 --- a/elixir/apps/domain/lib/domain/billing.ex +++ b/elixir/apps/domain/lib/domain/billing.ex @@ -312,11 +312,11 @@ defmodule Domain.Billing do {:error, :retry_later} {:ok, {status, body}} -> - :ok = Logger.error("Can not fetch Stripe customer", status: status, body: inspect(body)) + :ok = Logger.error("Cannot fetch Stripe customer", status: status, body: inspect(body)) {:error, :retry_later} {:error, reason} -> - :ok = Logger.error("Can not fetch Stripe customer", reason: inspect(reason)) + :ok = Logger.error("Cannot fetch Stripe customer", reason: inspect(reason)) {:error, :retry_later} end end diff --git a/elixir/apps/domain/lib/domain/cluster/google_compute_labels_strategy.ex b/elixir/apps/domain/lib/domain/cluster/google_compute_labels_strategy.ex index 73025b81c..d315fa906 100644 --- a/elixir/apps/domain/lib/domain/cluster/google_compute_labels_strategy.ex +++ b/elixir/apps/domain/lib/domain/cluster/google_compute_labels_strategy.ex @@ -124,13 +124,13 @@ defmodule Domain.Cluster.GoogleComputeLabelsStrategy do {:error, reason} -> if remaining_retry_count == 0 do - Logger.error("Can not fetch list of nodes or access token: #{inspect(reason)}", + Logger.error("Can't fetch list of nodes or access token: #{inspect(reason)}", module: __MODULE__ ) {:error, reason} else - Logger.warning("Can not fetch list of nodes or access token: #{inspect(reason)}", + Logger.warning("Can't fetch list of nodes or access token: #{inspect(reason)}", module: __MODULE__ ) diff --git a/elixir/apps/domain/lib/domain/google_cloud_platform.ex b/elixir/apps/domain/lib/domain/google_cloud_platform.ex index b143a0eb5..375ef0844 100644 --- a/elixir/apps/domain/lib/domain/google_cloud_platform.ex +++ b/elixir/apps/domain/lib/domain/google_cloud_platform.ex @@ -50,7 +50,7 @@ defmodule Domain.GoogleCloudPlatform do {:error, {response.status, response.body}} {:error, reason} -> - Logger.error("Can not fetch instance token", reason: inspect(reason)) + Logger.error("Can't fetch instance token", reason: inspect(reason)) {:error, reason} end end diff --git a/elixir/apps/domain/lib/domain/repo/changeset.ex b/elixir/apps/domain/lib/domain/repo/changeset.ex index 2a33dbd47..2b3cb2e78 100644 --- a/elixir/apps/domain/lib/domain/repo/changeset.ex +++ b/elixir/apps/domain/lib/domain/repo/changeset.ex @@ -122,7 +122,7 @@ defmodule Domain.Repo.Changeset do def validate_does_not_end_with(%Ecto.Changeset{} = changeset, field, suffix, opts \\ []) do validate_change(changeset, field, fn _current_field, value -> if String.ends_with?(value, suffix) do - message = Keyword.get(opts, :message, "can not end with #{inspect(suffix)}") + message = Keyword.get(opts, :message, "cannot end with #{inspect(suffix)}") [{field, message}] else [] @@ -209,7 +209,7 @@ defmodule Domain.Repo.Changeset do {:ok, ip_or_cidr} -> if Domain.Types.CIDR.contains?(cidr, ip_or_cidr) or Domain.Types.CIDR.contains?(ip_or_cidr, cidr) do - message = Keyword.get(opts, :message, "can not be in the CIDR #{cidr}") + message = Keyword.get(opts, :message, "cannot be in the CIDR #{cidr}") [{ip_or_cidr_field, message}] else [] diff --git a/elixir/apps/domain/lib/domain/resources/resource/changeset.ex b/elixir/apps/domain/lib/domain/resources/resource/changeset.ex index b34344415..a0f151937 100644 --- a/elixir/apps/domain/lib/domain/resources/resource/changeset.ex +++ b/elixir/apps/domain/lib/domain/resources/resource/changeset.ex @@ -57,7 +57,7 @@ defmodule Domain.Resources.Resource.Changeset do changeset |> validate_length(:address, min: 1, max: 253) |> validate_does_not_end_with(:address, "localhost", - message: "localhost can not be used, please add a DNS alias to /etc/hosts instead" + message: "localhost cannot be used, please add a DNS alias to /etc/hosts instead" ) |> validate_format(:address, ~r/^([*?]\.)?[\p{L}0-9-]{1,63}(\.[\p{L}0-9-]{1,63})*$/iu) end @@ -66,10 +66,10 @@ defmodule Domain.Resources.Resource.Changeset do changeset |> validate_and_normalize_cidr(:address) |> validate_not_in_cidr(:address, %Postgrex.INET{address: {0, 0, 0, 0}, netmask: 32}, - message: "can not contain all IPv4 addresses" + message: "cannot contain all IPv4 addresses" ) |> validate_not_in_cidr(:address, %Postgrex.INET{address: {127, 0, 0, 0}, netmask: 8}, - message: "can not contain loopback addresses" + message: "cannot contain loopback addresses" ) |> validate_not_in_cidr( :address, @@ -77,7 +77,7 @@ defmodule Domain.Resources.Resource.Changeset do address: {0, 0, 0, 0, 0, 0, 0, 0}, netmask: 128 }, - message: "can not contain all IPv6 addresses" + message: "cannot contain all IPv6 addresses" ) |> validate_not_in_cidr( :address, @@ -85,7 +85,7 @@ defmodule Domain.Resources.Resource.Changeset do address: {0, 0, 0, 0, 0, 0, 0, 1}, netmask: 128 }, - message: "can not contain loopback addresses" + message: "cannot contain loopback addresses" ) |> validate_address_is_not_in_private_range() end @@ -94,10 +94,10 @@ defmodule Domain.Resources.Resource.Changeset do changeset |> validate_and_normalize_ip(:address) |> validate_not_in_cidr(:address, %Postgrex.INET{address: {0, 0, 0, 0}, netmask: 32}, - message: "can not contain all IPv4 addresses" + message: "cannot contain all IPv4 addresses" ) |> validate_not_in_cidr(:address, %Postgrex.INET{address: {127, 0, 0, 0}, netmask: 8}, - message: "can not contain loopback addresses" + message: "cannot contain loopback addresses" ) |> validate_not_in_cidr( :address, @@ -105,7 +105,7 @@ defmodule Domain.Resources.Resource.Changeset do address: {0, 0, 0, 0, 0, 0, 0, 0}, netmask: 128 }, - message: "can not contain all IPv6 addresses" + message: "cannot contain all IPv6 addresses" ) |> validate_not_in_cidr( :address, @@ -113,7 +113,7 @@ defmodule Domain.Resources.Resource.Changeset do address: {0, 0, 0, 0, 0, 0, 0, 1}, netmask: 128 }, - message: "can not contain loopback addresses" + message: "cannot contain loopback addresses" ) |> validate_address_is_not_in_private_range() end diff --git a/elixir/apps/domain/lib/domain/types/cidr.ex b/elixir/apps/domain/lib/domain/types/cidr.ex index adc2e4bb4..229fd7008 100644 --- a/elixir/apps/domain/lib/domain/types/cidr.ex +++ b/elixir/apps/domain/lib/domain/types/cidr.ex @@ -96,7 +96,7 @@ defmodule Domain.Types.CIDR do end def contains?(%Postgrex.INET{}, %Postgrex.INET{netmask: nil}) do - # IPv6 and IPv4 can not contain each other + # IPv6 and IPv4 can't contain each other false end diff --git a/elixir/apps/domain/test/domain/accounts_test.exs b/elixir/apps/domain/test/domain/accounts_test.exs index 545fd33f7..8f49ddff1 100644 --- a/elixir/apps/domain/test/domain/accounts_test.exs +++ b/elixir/apps/domain/test/domain/accounts_test.exs @@ -269,7 +269,7 @@ defmodule Domain.AccountsTest do assert update_account(other_account, %{}, subject) == {:error, :not_found} end - test "returns error when subject can not manage account", %{ + test "returns error when subject cannot manage account", %{ account: account, subject: subject } do diff --git a/elixir/apps/domain/test/domain/actors_test.exs b/elixir/apps/domain/test/domain/actors_test.exs index 2fe8dace4..ca27d4092 100644 --- a/elixir/apps/domain/test/domain/actors_test.exs +++ b/elixir/apps/domain/test/domain/actors_test.exs @@ -1999,7 +1999,7 @@ defmodule Domain.ActorsTest do assert fetch_actor_by_id(actor.id, subject) == {:error, :not_found} end - test "returns error when subject can not view actors" do + test "returns error when subject cannot view actors" do subject = Fixtures.Auth.create_subject() subject = Fixtures.Auth.remove_permissions(subject) @@ -2103,7 +2103,7 @@ defmodule Domain.ActorsTest do assert Enum.sort(Enum.map(actors, & &1.id)) == Enum.sort([actor1.id, actor2.id]) end - test "returns error when subject can not view actors" do + test "returns error when subject cannot view actors" do subject = Fixtures.Auth.create_subject() subject = Fixtures.Auth.remove_permissions(subject) @@ -2288,7 +2288,7 @@ defmodule Domain.ActorsTest do assert create_actor(account, attrs, subject) == {:error, :service_accounts_limit_reached} end - test "returns error when subject can not create actors", %{ + test "returns error when subject cannot create actors", %{ account: account, subject: subject } do @@ -2390,7 +2390,7 @@ defmodule Domain.ActorsTest do update_actor(actor, %{type: :account_admin_user}, subject) end - test "returns error when subject can not manage types", %{account: account} do + test "returns error when subject cannot manage types", %{account: account} do actor = Fixtures.Actors.create_actor(type: :account_admin_user, account: account) subject = @@ -2641,7 +2641,7 @@ defmodule Domain.ActorsTest do assert disable_actor(other_actor, subject) == {:error, :not_found} end - test "returns error when subject can not disable actors" do + test "returns error when subject cannot disable actors" do account = Fixtures.Accounts.create_account() actor = Fixtures.Actors.create_actor(type: :account_admin_user, account: account) @@ -2701,7 +2701,7 @@ defmodule Domain.ActorsTest do assert enable_actor(other_actor, subject) == {:error, :not_found} end - test "returns error when subject can not enable actors" do + test "returns error when subject cannot enable actors" do account = Fixtures.Accounts.create_account() actor = Fixtures.Actors.create_actor(type: :account_admin_user, account: account) @@ -2963,7 +2963,7 @@ defmodule Domain.ActorsTest do assert delete_actor(other_actor, subject) == {:error, :not_found} end - test "returns error when subject can not delete actors" do + test "returns error when subject cannot delete actors" do account = Fixtures.Accounts.create_account() actor = Fixtures.Actors.create_actor(type: :account_admin_user, account: account) diff --git a/elixir/apps/domain/test/domain/auth_test.exs b/elixir/apps/domain/test/domain/auth_test.exs index f73aa7582..eaf49b055 100644 --- a/elixir/apps/domain/test/domain/auth_test.exs +++ b/elixir/apps/domain/test/domain/auth_test.exs @@ -71,7 +71,7 @@ defmodule Domain.AuthTest do assert fetched_provider.id == provider.id end - test "returns error when subject can not view providers", %{ + test "returns error when subject cannot view providers", %{ subject: subject } do subject = Fixtures.Auth.remove_permissions(subject) @@ -200,7 +200,7 @@ defmodule Domain.AuthTest do assert fetch_active_provider_by_adapter(:userpass, subject) == {:error, :not_found} end - test "returns error when subject can not view providers", %{ + test "returns error when subject cannot view providers", %{ subject: subject } do subject = Fixtures.Auth.remove_permissions(subject) @@ -250,7 +250,7 @@ defmodule Domain.AuthTest do assert provider.account_id == subject.account.id end - test "returns error when subject can not manage providers" do + test "returns error when subject cannot manage providers" do account = Fixtures.Accounts.create_account() identity = @@ -681,7 +681,7 @@ defmodule Domain.AuthTest do } end - test "returns error when subject can not create providers", %{ + test "returns error when subject cannot create providers", %{ account: account } do subject = @@ -825,7 +825,7 @@ defmodule Domain.AuthTest do assert is_nil(provider.deleted_at) end - test "returns error when subject can not manage providers", %{ + test "returns error when subject cannot manage providers", %{ provider: provider, subject: subject } do @@ -978,7 +978,7 @@ defmodule Domain.AuthTest do assert disable_provider(provider, subject) == {:error, :not_found} end - test "returns error when subject can not disable providers", %{ + test "returns error when subject cannot disable providers", %{ subject: subject, provider: provider } do @@ -1040,7 +1040,7 @@ defmodule Domain.AuthTest do assert enable_provider(provider, subject) == {:error, :not_found} end - test "returns error when subject can not enable providers", %{ + test "returns error when subject cannot enable providers", %{ subject: subject, provider: provider } do @@ -1242,7 +1242,7 @@ defmodule Domain.AuthTest do assert delete_provider(provider, subject) == {:error, :not_found} end - test "returns error when subject can not delete providers", %{ + test "returns error when subject cannot delete providers", %{ subject: subject, provider: provider } do @@ -1461,7 +1461,7 @@ defmodule Domain.AuthTest do assert fetch_identity_by_id(identity.id, subject) == {:error, :not_found} end - test "returns error when subject can not view identities", %{ + test "returns error when subject cannot view identities", %{ subject: subject } do subject = Fixtures.Auth.remove_permissions(subject) @@ -2588,7 +2588,7 @@ defmodule Domain.AuthTest do assert_receive %Phoenix.Socket.Broadcast{event: "disconnect"} end - test "returns error when subject can not delete identities", %{ + test "returns error when subject cannot delete identities", %{ identity: identity, subject: subject } do @@ -2761,7 +2761,7 @@ defmodule Domain.AuthTest do assert delete_identity(identity, subject) == {:error, :not_found} end - test "returns error when subject can not delete identities", %{subject: subject} do + test "returns error when subject cannot delete identities", %{subject: subject} do identity = Fixtures.Auth.create_identity() subject = Fixtures.Auth.remove_permissions(subject) diff --git a/elixir/apps/domain/test/domain/clients_test.exs b/elixir/apps/domain/test/domain/clients_test.exs index 3f1040bd4..be3e85815 100644 --- a/elixir/apps/domain/test/domain/clients_test.exs +++ b/elixir/apps/domain/test/domain/clients_test.exs @@ -769,7 +769,7 @@ defmodule Domain.ClientsTest do assert deleted.deleted_at end - test "admin can not delete clients in other accounts", %{ + test "admin cannot delete clients in other accounts", %{ admin_subject: subject } do client = Fixtures.Clients.create_client() @@ -788,7 +788,7 @@ defmodule Domain.ClientsTest do assert deleted.deleted_at end - test "unprivileged can not delete other people clients", %{ + test "unprivileged cannot delete other people clients", %{ account: account, unprivileged_subject: subject } do diff --git a/elixir/apps/domain/test/domain/policies_test.exs b/elixir/apps/domain/test/domain/policies_test.exs index 14f239f2c..933ee76ec 100644 --- a/elixir/apps/domain/test/domain/policies_test.exs +++ b/elixir/apps/domain/test/domain/policies_test.exs @@ -503,7 +503,7 @@ defmodule Domain.PoliciesTest do assert disable_policy(policy, subject) == {:error, :not_found} end - test "returns error when subject can not disable policies", %{ + test "returns error when subject cannot disable policies", %{ subject: subject, policy: policy } do @@ -596,7 +596,7 @@ defmodule Domain.PoliciesTest do assert enable_policy(policy, subject) == {:error, :not_found} end - test "returns error when subject can not enable policies", %{ + test "returns error when subject cannot enable policies", %{ subject: subject, policy: policy } do diff --git a/elixir/apps/domain/test/domain/repo_test.exs b/elixir/apps/domain/test/domain/repo_test.exs index 86f7a3ec6..280a53116 100644 --- a/elixir/apps/domain/test/domain/repo_test.exs +++ b/elixir/apps/domain/test/domain/repo_test.exs @@ -399,7 +399,7 @@ defmodule Domain.RepoTest do refute metadata.previous_page_cursor end - test "page size can not be bigger than 100", %{ + test "page size cannot be bigger than 100", %{ query_module: query_module, queryable: queryable } do @@ -408,7 +408,7 @@ defmodule Domain.RepoTest do assert metadata.limit == 100 end - test "page size can not be less than 1", %{ + test "page size cannot be less than 1", %{ query_module: query_module, queryable: queryable } do diff --git a/elixir/apps/domain/test/domain/resources_test.exs b/elixir/apps/domain/test/domain/resources_test.exs index b03137e58..87f189ba9 100644 --- a/elixir/apps/domain/test/domain/resources_test.exs +++ b/elixir/apps/domain/test/domain/resources_test.exs @@ -937,21 +937,21 @@ defmodule Domain.ResourcesTest do attrs = %{"address" => "100.64.0.0/8", "type" => "cidr"} assert {:error, changeset} = create_resource(attrs, subject) - assert "can not be in the CIDR 100.64.0.0/11" in errors_on(changeset).address + assert "cannot be in the CIDR 100.64.0.0/11" in errors_on(changeset).address attrs = %{"address" => "fd00:2021:1111::/102", "type" => "cidr"} assert {:error, changeset} = create_resource(attrs, subject) - assert "can not be in the CIDR fd00:2021:1111::/107" in errors_on(changeset).address + assert "cannot be in the CIDR fd00:2021:1111::/107" in errors_on(changeset).address attrs = %{"address" => "::/0", "type" => "cidr"} assert {:error, changeset} = create_resource(attrs, subject) - assert "can not contain loopback addresses" in errors_on(changeset).address - assert "can not contain all IPv6 addresses" in errors_on(changeset).address + assert "cannot contain loopback addresses" in errors_on(changeset).address + assert "cannot contain all IPv6 addresses" in errors_on(changeset).address attrs = %{"address" => "0.0.0.0/0", "type" => "cidr"} assert {:error, changeset} = create_resource(attrs, subject) - assert "can not contain loopback addresses" in errors_on(changeset).address - assert "can not contain all IPv4 addresses" in errors_on(changeset).address + assert "cannot contain loopback addresses" in errors_on(changeset).address + assert "cannot contain all IPv4 addresses" in errors_on(changeset).address end # We allow names to be duplicate because Resources are split into Sites diff --git a/elixir/apps/domain/test/domain/tokens_test.exs b/elixir/apps/domain/test/domain/tokens_test.exs index 3a653fc1b..be36be4aa 100644 --- a/elixir/apps/domain/test/domain/tokens_test.exs +++ b/elixir/apps/domain/test/domain/tokens_test.exs @@ -444,7 +444,7 @@ defmodule Domain.TokensTest do assert_receive %Phoenix.Socket.Broadcast{event: "disconnect"} end - test "user can not delete other users token", %{ + test "user cannot delete other users token", %{ account: account } do actor = Fixtures.Actors.create_actor(type: :account_user, account: account) diff --git a/elixir/apps/web/lib/web/live/relay_groups/new_token.ex b/elixir/apps/web/lib/web/live/relay_groups/new_token.ex index 8f0fc625a..484e309ab 100644 --- a/elixir/apps/web/lib/web/live/relay_groups/new_token.ex +++ b/elixir/apps/web/lib/web/live/relay_groups/new_token.ex @@ -303,7 +303,7 @@ defmodule Web.RelayGroups.NewToken do "https://api.github.com/repos/firezone/firezone/releases/latest" | \\ grep "\\\\"tag_name\\\\":" | sed "s/.*\\\\"tag_name\\\\": \\\\"\\([^\\\\"\\\\]*\\).*/\\1/" \\ ); \\ - [ "$FIREZONE_VERSION" = "" ] && echo "[Error] Can not fetch latest version, rate limited by GitHub?" && exit 1; \\ + [ "$FIREZONE_VERSION" = "" ] && echo "[Error] Cannot fetch latest version, rate limited by GitHub?" && exit 1; \\ echo "Downloading Firezone Relay version $FIREZONE_VERSION"; \\ arch=$(uname -m); \\ case $arch in \\ diff --git a/elixir/config/config.exs b/elixir/config/config.exs index a0e862394..86f372996 100644 --- a/elixir/config/config.exs +++ b/elixir/config/config.exs @@ -103,7 +103,7 @@ config :web, Web.Endpoint, url: [ scheme: "http", host: "localhost", - port: 13000, + port: 13_000, path: nil ], render_errors: [ @@ -151,7 +151,7 @@ config :api, API.Endpoint, url: [ scheme: "http", host: "localhost", - port: 13001, + port: 13_001, path: nil ], render_errors: [