mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-25 12:27:43 +08:00
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:
parent
a158036dee
commit
48bc5735fc
@ -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
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user