From 0f01196eb314e4b7cbb320b239b9800dc7e16078 Mon Sep 17 00:00:00 2001 From: Ryan Kotval Date: Fri, 21 Jun 2024 13:19:02 -0500 Subject: [PATCH] update(Elixir/OTP): Updating elixir/otp to version 17/27 and depndencies (#2100) * update(Elixir/OTP): Updating elixir/otp to version 17/27 and depndencies * Update more dependencies and the docker container * change docker base image in dev * upgrade html sanitizer and fix issues with tests * remove comment * remove todo * Fixed code --------- Co-authored-by: Anthony Shull --- .tool-versions | 4 +-- deploy/dotcom/dev/1/Dockerfile | 2 +- deploy/dotcom/dev/2/Dockerfile | 2 +- deploy/dotcom/prod/Dockerfile | 2 +- lib/cms/custom_html5_scrubber.ex | 14 +++++------ .../templates/event/_calendar.html.eex | 6 ++--- .../templates/event/_event_teaser.html.eex | 2 +- .../event/_expandable_month.html.eex | 2 +- .../templates/partial/_checkbox.html.eex | 2 +- .../templates/schedule/_line.html.eex | 2 +- mix.exs | 19 +++++++------- mix.lock | 25 +++++++++---------- .../controllers/event_controller_test.exs | 1 - .../schedule/vehicle_locations_test.exs | 2 +- test/dotcom_web/plugs/year_and_month_test.exs | 12 --------- test/schedules/repo_test.exs | 9 ++----- test/stops/nearby_test.exs | 7 +++--- 17 files changed, 46 insertions(+), 67 deletions(-) diff --git a/.tool-versions b/.tool-versions index b1e58245b1..eee33b3e74 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ nodejs 18.17.1 -erlang 26.2.1 -elixir 1.16.1-otp-26 +erlang 27.0 +elixir 1.17.0-otp-27 diff --git a/deploy/dotcom/dev/1/Dockerfile b/deploy/dotcom/dev/1/Dockerfile index efd68efb83..187a1652c0 100644 --- a/deploy/dotcom/dev/1/Dockerfile +++ b/deploy/dotcom/dev/1/Dockerfile @@ -1,4 +1,4 @@ -FROM hexpm/elixir:1.16.1-erlang-26.2.2-debian-buster-20240130 +FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim RUN apt-get update && apt-get install -y curl git make build-essential inotify-tools RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - diff --git a/deploy/dotcom/dev/2/Dockerfile b/deploy/dotcom/dev/2/Dockerfile index b68dfb3e9b..89fd8bd119 100644 --- a/deploy/dotcom/dev/2/Dockerfile +++ b/deploy/dotcom/dev/2/Dockerfile @@ -1,4 +1,4 @@ -FROM hexpm/elixir:1.16.1-erlang-26.2.2-debian-buster-20240130 +FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim RUN apt-get update && apt-get install -y curl git make build-essential inotify-tools RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - diff --git a/deploy/dotcom/prod/Dockerfile b/deploy/dotcom/prod/Dockerfile index 2e14f2757a..219e06deaa 100644 --- a/deploy/dotcom/prod/Dockerfile +++ b/deploy/dotcom/prod/Dockerfile @@ -3,7 +3,7 @@ ### # 1.) Get the Elixir dependencies within an Elixir container -FROM hexpm/elixir:1.16.1-erlang-26.2.1-debian-buster-20231009-slim as elixir-builder +FROM hexpm/elixir:1.17.0-erlang-27.0-debian-buster-20240513-slim as elixir-builder ENV LANG="C.UTF-8" MIX_ENV="prod" diff --git a/lib/cms/custom_html5_scrubber.ex b/lib/cms/custom_html5_scrubber.ex index 01a4132d24..8f7ec2b971 100644 --- a/lib/cms/custom_html5_scrubber.ex +++ b/lib/cms/custom_html5_scrubber.ex @@ -9,7 +9,7 @@ defmodule CMS.CustomHTML5Scrubber do """ require HtmlSanitizeEx.Scrubber.Meta - alias HtmlSanitizeEx.Scrubber.{CSS, Meta} + alias HtmlSanitizeEx.Scrubber.Meta # Removes any CDATA tags before the traverser/scrubber runs. Meta.remove_cdata_sections_before_scrub() @@ -18,8 +18,6 @@ defmodule CMS.CustomHTML5Scrubber do @valid_schemes ["http", "https", "mailto", "tel"] - Meta.allow_tag_with_uri_attributes("a", ["href"], @valid_schemes) - Meta.allow_tag_with_these_attributes("a", [ "accesskey", "class", @@ -50,6 +48,12 @@ defmodule CMS.CustomHTML5Scrubber do "type" ]) + def scrub_attribute("a", {"href", "tel:" <> _ = number}) do + {"href", number} + end + + Meta.allow_tag_with_uri_attributes("a", ["href"], @valid_schemes) + Meta.allow_tag_with_these_attributes("b", [ "accesskey", "class", @@ -2125,8 +2129,4 @@ defmodule CMS.CustomHTML5Scrubber do def html5(html) do html |> HtmlSanitizeEx.Scrubber.scrub(__MODULE__) end - - defp scrub_css(text) do - CSS.scrub(text) - end end diff --git a/lib/dotcom_web/templates/event/_calendar.html.eex b/lib/dotcom_web/templates/event/_calendar.html.eex index aabdd99c46..3fd5b4da3c 100644 --- a/lib/dotcom_web/templates/event/_calendar.html.eex +++ b/lib/dotcom_web/templates/event/_calendar.html.eex @@ -26,7 +26,7 @@ <%= for event <- todays_events do %> <% event_ended = ended?(event) %>