mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 04:47:45 +08:00
test/sharness: add more tests against exposing PrivKey on network
and replacing config. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
011a546b9c
commit
ea9327dd3c
@ -77,10 +77,12 @@ test_config_cmd() {
|
||||
'
|
||||
|
||||
test_expect_success "output looks good" '
|
||||
echo "Error: cannot show private key through API" > ident_exp &&
|
||||
echo "Error: cannot show or change private key through API" > ident_exp &&
|
||||
test_cmp ident_exp ident_out
|
||||
'
|
||||
|
||||
# SECURITY
|
||||
# Those tests are here to prevent exposing the PrivKey on the network
|
||||
test_expect_success "'ipfs config Identity.PrivKey' fails" '
|
||||
test_expect_code 1 ipfs config Identity.PrivKey 2> ident_out
|
||||
'
|
||||
@ -88,6 +90,16 @@ test_config_cmd() {
|
||||
test_expect_success "output looks good" '
|
||||
test_cmp ident_exp ident_out
|
||||
'
|
||||
|
||||
test_expect_success "'ipfs config show' doesn't include privkey" '
|
||||
ipfs config show > show_config &&
|
||||
grep PrivKey show_config | grep "\"PrivKey\": null"
|
||||
'
|
||||
|
||||
test_expect_success "'ipfs config replace' injects privkey back" '
|
||||
ipfs config replace show_config &&
|
||||
grep PrivKey "$IPFS_PATH/config" | grep -v ": null" >/dev/null
|
||||
'
|
||||
}
|
||||
|
||||
test_init_ipfs
|
||||
|
||||
Loading…
Reference in New Issue
Block a user