Skip to content

Commit 9a2d984

Browse files
committed
add sobelow and review the vulnerabilities
1 parent 41e8adf commit 9a2d984

File tree

7 files changed

+29
-1
lines changed

7 files changed

+29
-1
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
erl_crash.dump
44
*.ez
55
.tmux.rb
6+
7+
# OSX's favorite useless file
8+
.DS_Store
9+
10+
# VS Code plugin
11+
/.elixir_ls/
12+
13+
# Generated sobelow file
14+
.sobelow

.sobelow-conf

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
verbose: false,
3+
private: false,
4+
skip: true,
5+
router: "",
6+
exit: "false",
7+
format: "txt",
8+
out: "",
9+
threshold: "low",
10+
ignore: ["Config.CSRF", "Config.HTTPS"],
11+
ignore_files: [""]
12+
]

lib/linguist/compiler.ex

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ defmodule Linguist.Compiler do
103103
end
104104
end
105105

106+
# sobelow_skip ["DOS.StringToAtom"]
106107
defp interpolate(string, var) do
107108
@interpol_rgx
108109
|> Regex.split(string, on: [:head, :tail])

lib/linguist/memorized_vocabulary.ex

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ defmodule Linguist.MemorizedVocabulary do
6262
end
6363
end
6464

65+
# sobelow_skip ["DOS.StringToAtom"]
6566
defp do_t(locale, translation_key, bindings) do
6667
case :ets.lookup(:translations_registry, "#{locale}.#{translation_key}") do
6768
[] -> {:error, :no_translation}

lib/linguist/vocabulary.ex

+3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ defmodule Linguist.Vocabulary do
9696
Recursive function used internally for loading yaml files.
9797
Not intended for external use
9898
"""
99+
# sobelow_skip ["DOS.StringToAtom"]
99100
def _yaml_reducer({key, value}, acc) when is_binary(value) do
100101
[{String.to_atom(key), value} | acc]
101102
end
103+
104+
# sobelow_skip ["DOS.StringToAtom"]
102105
def _yaml_reducer({key, value}, acc) do
103106
[{String.to_atom(key), Enum.reduce(value, [], &Linguist.Vocabulary._yaml_reducer/2)} | acc]
104107
end

mix.exs

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ defmodule Linguist.Mixfile do
3030
{:ex_cldr, "~> 1.6.0"},
3131
{:jason, "~> 1.0"},
3232
{:yaml_elixir, "~> 2.0"},
33-
{:credo, "~> 0.9.0", only: [:dev, :test], runtime: false}
33+
{:credo, "~> 0.9.0", only: [:dev, :test], runtime: false},
34+
{:sobelow, "~> 0.10", only: :dev, runtime: false}
3435
]
3536
end
3637
end

mix.lock

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"ex_cldr": {:hex, :ex_cldr, "1.6.4", "28b0aebdc38bb04414fce24679365a9355d1fce3ca731c7273d34927c6bdb8ce", [:mix], [{:abnf2, "~> 0.1", [hex: :abnf2, repo: "hexpm", optional: false]}, {:decimal, "~> 1.4", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.13", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.3", [hex: :phoenix, repo: "hexpm", optional: true]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 2.1 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm"},
77
"jason": {:hex, :jason, "1.0.0", "0f7cfa9bdb23fed721ec05419bcee2b2c21a77e926bce0deda029b5adc716fe2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"},
88
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
9+
"sobelow": {:hex, :sobelow, "0.10.0", "2beea5387dd47ce5ead9df0562eb93b33e4b574d006ea31b8dce9e0cc775a4d6", [:mix], [], "hexpm"},
910
"yamerl": {:hex, :yamerl, "0.7.0", "e51dba652dce74c20a88294130b48051ebbbb0be7d76f22de064f0f3ccf0aaf5", [:rebar3], [], "hexpm"},
1011
"yaml_elixir": {:hex, :yaml_elixir, "2.0.0", "5d7c40e039b076c0da1921b2754d4a91bc435ac4434bef633f5506dbafd6b8f2", [:mix], [{:yamerl, "~> 0.5", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm"},
1112
"yomel": {:hex, :yomel, "0.5.0", "c5a42d1818deda3f85ae14b1f01f6ece22b9ed8e8087012359fc04b59d85f621", [:make, :mix], [], "hexpm"},

0 commit comments

Comments
 (0)