Skip to content

Commit

Permalink
Restrict ipfs object patch in ro api
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: rht <[email protected]>
  • Loading branch information
rht committed Jan 27, 2016
1 parent 081c6d9 commit 795b80b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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

0 comments on commit 795b80b

Please sign in to comment.