-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore HSTS check in Runtime Config (#166)
- Loading branch information
Showing
5 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
defmodule SobelowTest.Config.HstsTest do | ||
use ExUnit.Case | ||
alias Sobelow.Config.HSTS | ||
|
||
setup do | ||
Application.put_env(:sobelow, :format, "json") | ||
Sobelow.Fingerprint.start_link() | ||
Sobelow.FindingLog.start_link() | ||
|
||
:ok | ||
end | ||
|
||
test "complains when force_ssl is missing in prod.exs" do | ||
HSTS.run("./test/fixtures/hsts/", ["missing_prod.exs"]) | ||
assert Sobelow.FindingLog.json("1") =~ "Config.HSTS: HSTS Not Enabled" | ||
end | ||
|
||
test "does not complain when force_ssl is present in prod.exs" do | ||
HSTS.run("./test/fixtures/hsts/", ["present_prod.exs"]) | ||
refute Sobelow.FindingLog.json("1") =~ "Config.HSTS: HSTS Not Enabled" | ||
end | ||
|
||
test "does not complain when force_ssl is missing in runtime.exs" do | ||
HSTS.run("./test/fixtures/hsts/", ["runtime.exs"]) | ||
refute Sobelow.FindingLog.json("1") =~ "Config.HSTS: HSTS Not Enabled" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use Config | ||
|
||
config :phoenix_app, | ||
https: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use Config | ||
|
||
config :phoenix_app, | ||
https: [], | ||
force_ssl: [hsts: true] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use Config | ||
|
||
config :phoenix_app, | ||
https: [] |