-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update secret integration test with HTML report.
- Loading branch information
Showing
7 changed files
with
100 additions
and
33 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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
GET http://localhost:8000/secret | ||
x-secret: barbar | ||
x-secret: BarBar | ||
GET http://localhost:8000/secret?q={{c}} | ||
x-secret: secret2 | ||
x-secret: {{b}} | ||
x-secret: Secret2 | ||
[Cookies] | ||
X-SECRET: {{b}} | ||
{ | ||
"query": "{{a}}" | ||
} | ||
HTTP 200 | ||
[Captures] | ||
value: jsonpath "$.value" | ||
[Asserts] | ||
jsonpath "$.value" == "baz" | ||
jsonpath "$.value" == "secret3" |
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
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
Set-StrictMode -Version latest | ||
$ErrorActionPreference = 'Stop' | ||
|
||
hurl --test --very-verbose --secret a=foofoofoo --secret b=barbar --secret c=baz tests_ok/secret.hurl 2>build/secret_test.err | ||
hurl --test \ | ||
--very-verbose \ | ||
--secret a=secret1 \ | ||
--secret b=secret2 \ | ||
--secret c=secret3 \ | ||
tests_ok/secret.hurl 2>build/secret_test.err | ||
|
||
$words=@("foofoofoo", "barbar", "baz") | ||
$secrets = @("secret1", "secret2", "secret3") | ||
|
||
foreach ($word in $words) { | ||
if (Get-Content build/secret_test.err | Select-String -CaseSensitive $word) { | ||
# Secrets have leaked! | ||
$file = "build/secret_test.err" | ||
|
||
foreach ($secret in $secrets) { | ||
if (Get-Content $file | Select-String -CaseSensitive $secret) { | ||
echo "Secret <$secret> have leaked in $file" | ||
exit 1 | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -1,13 +1,20 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
hurl --test --very-verbose --secret a=foofoofoo --secret b=barbar --secret c=baz tests_ok/secret.hurl 2>build/secret_test.err | ||
hurl --test \ | ||
--very-verbose \ | ||
--secret a=secret1 \ | ||
--secret b=secret2 \ | ||
--secret c=secret3 \ | ||
tests_ok/secret.hurl 2>build/secret_test.err | ||
|
||
words=("foofoofoo" "barbar" "baz") | ||
secrets=("secret1" "secret2" "secret3") | ||
|
||
for word in "${words[@]}"; do | ||
if grep -q "$word" build/secret_test.err; then | ||
# Secrets have leaked! | ||
file="build/secret_test.err" | ||
|
||
for secret in "${secrets[@]}"; do | ||
if grep -q "$secret" "$file"; then | ||
echo "Secret <$secret> have leaked in $file" | ||
exit 1 | ||
fi | ||
done |