-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2956 from ipfs/feature/unrestricted-api
Resurrect --unrestricted-api
- Loading branch information
Showing
4 changed files
with
51 additions
and
12 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,32 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2016 Lars Gierth | ||
# MIT Licensed; see the LICENSE file in this repository. | ||
# | ||
|
||
test_description="Test API security" | ||
|
||
. lib/test-lib.sh | ||
|
||
test_init_ipfs | ||
|
||
# by default, we don't let you load arbitrary ipfs objects through the api, | ||
# because this would open up the api to scripting vulnerabilities. | ||
# only the webui objects are allowed. | ||
# if you know what you're doing, go ahead and pass --unrestricted-api. | ||
|
||
test_launch_ipfs_daemon | ||
test_expect_success "Gateway on API unavailable" ' | ||
HASH=$(echo "testing" | ipfs add -q) | ||
test_curl_resp_http_code "http://127.0.0.1:$API_PORT/ipfs/$HASH" "HTTP/1.1 404 Not Found" | ||
' | ||
test_kill_ipfs_daemon | ||
|
||
test_launch_ipfs_daemon --unrestricted-api | ||
test_expect_success "Gateway on --unrestricted-api API available" ' | ||
HASH=$(echo "testing" | ipfs add -q) | ||
test_curl_resp_http_code "http://127.0.0.1:$API_PORT/ipfs/$HASH" "HTTP/1.1 200 OK" | ||
' | ||
test_kill_ipfs_daemon | ||
|
||
test_done |