test: confirm /api/v0/key/export is HTTP 404

This ensures key export endpoint is never exposed over HTTP API
This commit is contained in:
Marcin Rataj 2021-05-11 18:07:32 +02:00
parent a158036dee
commit 48bc5735fc
No known key found for this signature in database
GPG Key ID: 222B6784D5A79E42

View File

@ -175,6 +175,7 @@ ipfs key rm key_ed25519
test_cmp rsa_key_id roundtrip_rsa_key_id
'
# export works directly on the keystore present in IPFS_PATH
test_expect_success "export and import ed25519 key while daemon is running" '
edhash=$(ipfs key gen exported_ed25519_key --type=ed25519)
echo $edhash > ed25519_key_id
@ -184,10 +185,15 @@ ipfs key rm key_ed25519
test_cmp ed25519_key_id roundtrip_ed25519_key_id
'
test_expect_success "key export over HTTP /api/v0/key/export is not possible" '
ipfs key gen nohttpexporttest_key --type=ed25519 &&
test_curl_resp_http_code "http://127.0.0.1:$API_PORT/api/v0/key/export&arg=nohttpexporttest_key" "HTTP/1.1 404 Not Found"
'
test_expect_success "online rotate rsa key" '
test_must_fail ipfs key rotate
'
test_kill_ipfs_daemon
}