Skip to content

Commit 0c8a097

Browse files
committedMay 12, 2015
Merge pull request #1221 from ipfs/unrestricted-api-access
Add option to allow unrestricted API access
2 parents 08ea56c + 30f674a commit 0c8a097

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎cmd/ipfs/daemon.go

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const (
2828
writableKwd = "writable"
2929
ipfsMountKwd = "mount-ipfs"
3030
ipnsMountKwd = "mount-ipns"
31+
unrestrictedApiAccess = "unrestricted-api"
3132
// apiAddrKwd = "address-api"
3233
// swarmAddrKwd = "address-swarm"
3334
)
@@ -71,6 +72,7 @@ the port as you would other services or database (firewall, authenticated proxy,
7172
cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
7273
cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount)"),
7374
cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount)"),
75+
cmds.BoolOption(unrestrictedApiAccess, "Allow API access to unlisted hashes"),
7476

7577
// TODO: add way to override addresses. tricky part: updating the config if also --init.
7678
// cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
@@ -281,6 +283,10 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
281283
Writable: true,
282284
BlockList: &corehttp.BlockList{
283285
Decider: func(s string) bool {
286+
unrestricted, _, _ := req.Option(unrestrictedApiAccess).Bool()
287+
if unrestricted {
288+
return true
289+
}
284290
// for now, only allow paths in the WebUI path
285291
for _, webuipath := range corehttp.WebUIPaths {
286292
if strings.HasPrefix(s, webuipath) {

0 commit comments

Comments
 (0)
Please sign in to comment.