-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
176 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
HTTP/1.1 200 | ||
Server: Werkzeug/<<<.*?>>> Python/<<<.*?>>> | ||
Date: <<<.*?>>> | ||
Content-Type: text/html; charset=utf-8 | ||
Content-Length: 9 | ||
Server: Flask Server | ||
Connection: close | ||
|
||
Hello *** | ||
|
||
error: Assert body value | ||
--> tests_failed/assert_secret.hurl:3:1 | ||
| | ||
| GET http://localhost:8000/secret-failed | ||
| ... | ||
3 | "Hello ***" | ||
| ^ actual value is <Hello ***> | ||
| | ||
|
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,4 +1,35 @@ | ||
Set-StrictMode -Version latest | ||
$ErrorActionPreference = 'Stop' | ||
|
||
hurl --secret name=Alice tests_failed/assert_secret.hurl | ||
if (Test-Path -Path build/assert_secret) { | ||
Remove-Item -Recurse build/assert_secret | ||
} | ||
|
||
# We want to check leaks and do not stop at the first error | ||
$ErrorActionPreference = 'Continue' | ||
|
||
hurl --secret name1=Alice ` | ||
--secret name2=Bob ` | ||
--error-format long ` | ||
--report-html build/assert_secret/report-html ` | ||
--report-json build/assert_secret/report-json ` | ||
tests_failed/assert_secret.hurl | ||
|
||
$secrets = @("Alice", "Bob") | ||
|
||
$files = @(Get-ChildItem -Filter *.html -Recurse build/assert_secret/report-html) | ||
$files += @(Get-ChildItem -Filter *.json build/assert_secret/) | ||
$files += @(Get-ChildItem tests_failed/assert_secret.err.pattern) | ||
|
||
foreach ($secret in $secrets) { | ||
foreach ($file in $files) { | ||
# Don't search leaks in sources | ||
if ($file.name.EndsWith("source.html")) { | ||
continue | ||
} | ||
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,4 +1,39 @@ | ||
#!/bin/bash | ||
set -Eeuo pipefail | ||
|
||
hurl --secret name=Alice tests_failed/assert_secret.hurl | ||
rm -rf build/assert_secret | ||
|
||
# We want to check leaks and do not stop at the first error | ||
set +euo pipefail | ||
|
||
hurl --secret name1=Alice \ | ||
--secret name2=Bob \ | ||
--error-format long \ | ||
--report-html build/assert_secret/report-html \ | ||
--report-json build/assert_secret/report-json \ | ||
tests_failed/assert_secret.hurl | ||
|
||
ret=$? | ||
|
||
secrets=("Alice" "Bob") | ||
|
||
files=$(find build/assert_secret/report-html/*.html \ | ||
build/assert_secret/report-html/**/*.html \ | ||
build/assert_secret/report-json/*.json \ | ||
tests_failed/assert_secret.err.pattern) | ||
|
||
for secret in "${secrets[@]}"; do | ||
for file in $files; do | ||
# Don't search leaks in sources | ||
if [[ "$file" == *source.html ]]; then | ||
continue | ||
fi | ||
if grep -q "$secret" "$file"; then | ||
echo "Secret <$secret> have leaked in $file" | ||
exit 1 | ||
fi | ||
done | ||
done | ||
|
||
# We use the exit code of the Hurl command | ||
exit $ret |
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
Oops, something went wrong.