-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added security headers library for fastApi (#198)
* Added security headers library for fastApi * Fix TOML syntax and add to "all" list. * Add secure library installation to apiserver image. * Add test of secure middleware that checks the inserted headers. * Update test to capture more output. --------- Co-authored-by: Grigory Frantsuzov <[email protected]> Co-authored-by: James Mathews <[email protected]>
- Loading branch information
1 parent
dda3cbd
commit 93a8be3
Showing
5 changed files
with
57 additions
and
2 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
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,14 @@ | ||
< HTTP/1.1 200 OK | ||
< server: uvicorn | ||
< content-length: 97 | ||
< content-type: application/json | ||
< strict-transport-security: max-age=63072000; includeSubdomains | ||
< x-frame-options: SAMEORIGIN | ||
< x-xss-protection: 0 | ||
< x-content-type-options: nosniff | ||
< referrer-policy: no-referrer, strict-origin-when-cross-origin | ||
< cache-control: no-store | ||
< | ||
{ [97 bytes data] | ||
* Connection #0 to host spt-apiserver-testing left intact | ||
[{"handle":"Melanoma intralesional IL2","display_name_detail":"Cancer Immunology Research 2022"}] |
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,29 @@ | ||
|
||
query=http://spt-apiserver-testing:8080/study-names/ | ||
|
||
curl -s $query 1>/dev/null 2>/dev/null; | ||
if [ "$?" -gt 0 ]; | ||
then | ||
echo "Error with apiserver query." | ||
curl $query | ||
exit 1 | ||
fi | ||
|
||
curl -s --verbose $query 2>&1 | tail -n +9 | grep -v 'date: ' | tr -d '\b\r' > response.txt | ||
|
||
diff unit_tests/expected_headers_example.txt response.txt | ||
status=$? | ||
[ $status -eq 0 ] || (echo "API query for headers inspection failed."; ) | ||
|
||
if [ $status -eq 0 ]; | ||
then | ||
echo "Response headers were as expected:" | ||
echo | ||
cat response.txt | ||
rm response.txt | ||
exit 0 | ||
else | ||
cat response.txt | ||
rm response.txt | ||
exit 1 | ||
fi |