Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict ipfs object patch in ro api #2251

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/commands/object/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ result. This is the merkle-dag version of modifying an object.
Arguments: []cmds.Argument{},
Subcommands: map[string]*cmds.Command{
"append-data": patchAppendDataCmd,
"add-link": patchAddLinkCmd,
"add-link": PatchAddLinkCmd,
"rm-link": patchRmLinkCmd,
"set-data": patchSetDataCmd,
},
Expand Down Expand Up @@ -229,7 +229,7 @@ removes a link by the given name from root.
},
}

var patchAddLinkCmd = &cmds.Command{
var PatchAddLinkCmd = &cmds.Command{
Helptext: cmds.HelpText{
Tagline: "Add a link to a given object.",
ShortDescription: `
Expand Down
6 changes: 5 additions & 1 deletion core/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ var rootROSubcommands = map[string]*cmds.Command{
"links": ocmd.ObjectLinksCmd,
"get": ocmd.ObjectGetCmd,
"stat": ocmd.ObjectStatCmd,
"patch": ocmd.ObjectPatchCmd,
"patch": &cmds.Command{
Subcommands: map[string]*cmds.Command{
"add-link": ocmd.PatchAddLinkCmd,
},
},
},
},
"refs": RefsROCmd,
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/t0110-gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ test_expect_success "refs IPFS directory file through readonly API succeeds" '
'

test_expect_success "test gateway api is sanitized" '
for cmd in "add" "block/put" "bootstrap" "config" "dht" "diag" "dns" "get" "id" "mount" "name/publish" "object/put" "object/new" "object/patch" "pin" "ping" "refs/local" "repo" "resolve" "stats" "swarm" "tour" "file" "update" "version" "bitswap"; do
for cmd in "add" "block/put" "bootstrap" "config" "dht" "diag" "dns" "get" "id" "mount" "name/publish" "object/put" "object/new" "object/patch/append-data" "object/patch/rm-link" "object/patch/set-data" "pin" "ping" "refs/local" "repo" "resolve" "stats" "swarm" "tour" "file" "update" "version" "bitswap"; do
test_curl_resp_http_code "http://127.0.0.1:$port/api/v0/$cmd" "HTTP/1.1 404 Not Found"
done
'
Expand Down