Skip to content

Commit

Permalink
Security upgrades (#124)
Browse files Browse the repository at this point in the history
* Change logger

* Upgrade oban version to fix retryables consumers

* Upgrade elixir version

* Improve logging
  • Loading branch information
jjponz authored Mar 9, 2021
1 parent 9de53d8 commit d4b33a1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BUILD
FROM elixir:1.9.4-alpine as build
FROM elixir:1.11.2-alpine as build

RUN apk add --no-cache --update make g++ nodejs npm

Expand Down
9 changes: 6 additions & 3 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ config :postoffice, PostofficeWeb.Endpoint,
server: true,
check_origin: false

config :logger_json, :backend, metadata: :all
config :logger, backends: [LoggerJSON]
config :logger, level: :info
config :logger,
backends: [Ink]

config :logger, Ink,
name: "postoffice",
level: :info

# Do not print debug messages in production
# ## SSL Support
Expand Down
4 changes: 2 additions & 2 deletions lib/postoffice/workers/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ defmodule Postoffice.Workers.Http do
response.status_code
}"

Logger.info(error_reason)
Logger.info(error_reason, message_id: id)

{:ok, _data} =
HistoricalData.create_failed_messages(%{
Expand All @@ -75,7 +75,7 @@ defmodule Postoffice.Workers.Http do

{:error, %HTTPoison.Error{reason: reason}} ->
error_reason = "Error trying to process message from HttpConsumer: #{reason}"
Logger.info(error_reason)
Logger.info(error_reason, message_id: id)

{:ok, _data} =
HistoricalData.create_failed_messages(%{
Expand Down
2 changes: 1 addition & 1 deletion lib/postoffice/workers/pubsub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ defmodule Postoffice.Workers.Pubsub do

{:error, error} ->
error_reason = "Error trying to process message from PubsubConsumer: #{error}"
Logger.info(error_reason)
Logger.info(error_reason, message_id: id)

{:ok, _data} =
HistoricalData.create_failed_messages(%{
Expand Down
7 changes: 3 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Postoffice.MixProject do
def project do
[
app: :postoffice,
version: "0.12.0",
version: "0.18.4",
elixir: "~> 1.11",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
Expand Down Expand Up @@ -37,7 +37,6 @@ defmodule Postoffice.MixProject do
:logger,
:runtime_tools,
:httpoison,
:logger_json,
:os_mon,
:cachex
]
Expand Down Expand Up @@ -69,7 +68,7 @@ defmodule Postoffice.MixProject do
{:httpoison, "~> 1.8"},
{:mox, "~> 0.5", only: :test},
{:gen_stage, "~> 0.14"},
{:logger_json, "~> 3.0"},
{:ink, "~> 1.0"},
{:config_tuples, "~> 0.4"},
{:libcluster, "~> 3.2"},
{:swarm, "~> 3.0"},
Expand All @@ -80,7 +79,7 @@ defmodule Postoffice.MixProject do
{:hackney, "~> 1.16"},
{:cachex, "~> 3.3"},
{:number, "~> 1.0.1"},
{:oban, "2.4.0"},
{:oban, "2.5.0"},
{:prom_ex, "~> 1.0.0"}
]
end
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"httpoison": {:hex, :httpoison, "1.8.0", "6b85dea15820b7804ef607ff78406ab449dd78bed923a49c7160e1886e987a3d", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "28089eaa98cf90c66265b6b5ad87c59a3729bea2e74e9d08f9b51eb9729b3c3a"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"ink": {:hex, :ink, "1.2.0", "8dc46993a5cae17e392be5a2b5a0cb79b12c72ad7b31ca43f5fc586a20d5c429", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "26570ca0a5698e93567e5c522463c0ad8e271bcf0a61a54d7303f4621a873472"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"joken": {:hex, :joken, "2.2.0", "2daa1b12be05184aff7b5ace1d43ca1f81345962285fff3f88db74927c954d3a", [:mix], [{:jose, "~> 1.9", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "b4f92e30388206f869dd25d1af628a1d99d7586e5cf0672f64d4df84c4d2f5e9"},
"jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"},
Expand Down

0 comments on commit d4b33a1

Please sign in to comment.