{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12763","repository_url":"https://api.github.com/repos/bitcoin/bitcoin","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12763/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12763/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12763/events","html_url":"https://github.com/bitcoin/bitcoin/pull/12763","id":307900921,"number":12763,"title":"Add RPC Whitelist Feature from #12248","user":{"login":"JeremyRubin","id":886523,"avatar_url":"https://avatars0.githubusercontent.com/u/886523?v=4","gravatar_id":"","url":"https://api.github.com/users/JeremyRubin","html_url":"https://github.com/JeremyRubin","followers_url":"https://api.github.com/users/JeremyRubin/followers","following_url":"https://api.github.com/users/JeremyRubin/following{/other_user}","gists_url":"https://api.github.com/users/JeremyRubin/gists{/gist_id}","starred_url":"https://api.github.com/users/JeremyRubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeremyRubin/subscriptions","organizations_url":"https://api.github.com/users/JeremyRubin/orgs","repos_url":"https://api.github.com/users/JeremyRubin/repos","events_url":"https://api.github.com/users/JeremyRubin/events{/privacy}","received_events_url":"https://api.github.com/users/JeremyRubin/received_events","type":"User","site_admin":false},"labels":[{"id":98279177,"url":"https://api.github.com/repos/bitcoin/bitcoin/labels/RPC/REST/ZMQ","name":"RPC/REST/ZMQ","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-03-23T04:42:40Z","updated_at":"2018-04-13T06:14:24Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/12763","html_url":"https://github.com/bitcoin/bitcoin/pull/12763","diff_url":"https://github.com/bitcoin/bitcoin/pull/12763.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/12763.patch"},"body":"Summary\r\n====\r\n\r\nThis patch adds the RPC whitelisting feature requested in #12248. RPC Whitelists help enforce application policies for services being built on top of Bitcoin Core (e.g., your Lightning Node maybe shouldn't be adding new peers). The aim of this PR is not to make it advisable to connect your Bitcoin node to arbitrary services, but to reduce risk and prevent unintended access.\r\n\r\nUsing RPC Whitelists\r\n====\r\nThe way it works is you specify (in your bitcoin.conf) configurations such as\r\n\r\n```\r\nrpcauth=user1:4cc74397d6e9972e5ee7671fd241$11849357f26a5be7809c68a032bc2b16ab5dcf6348ef3ed1cf30dae47b8bcc71\r\nrpcauth=user2:181b4a25317bff60f3749adee7d6bca0$d9c331474f1322975fa170a2ffbcb176ba11644211746b27c1d317f265dd4ada\r\nrpcauth=user3:a6c8a511b53b1edcf69c36984985e$13cfba0e626db19061c9d61fa58e712d0319c11db97ad845fa84517f454f6675\r\nrpcwhitelist=user1:getnetworkinfo\r\nrpcwhitelist=user2:getnetworkinfo,getwalletinfo\r\n```\r\n\r\nNow user1 can only call getnetworkinfo, user2 can only call getnetworkinfo or getwalletinfo, while user3 can still call all RPCs. \r\n\r\nReview Request\r\n=====\r\nIn addition to normal review, would love specific review from someone working on LN (e.g., @roasbeef) and someone working on an infrastructure team at an exchange (e.g., @jimpo) to check that this works well with their system.\r\n\r\nNotes\r\n=====\r\n\r\nThe rpc list is whitespace & spelling sensitive -- I can add whitespace stripping/spellchecking if anyone feels strongly that this might reduce misconfiguration errors. Fortunately, both of these errors fail towards the RPC call being blocked.\r\n\r\nIt was unclear to me if HTTPReq_JSONRPC is the best function to patch this functionality into, or if it would be better to place it in exec or somewhere else.\r\n\r\nIt was also unclear to me if it would be preferred to cache the whitelists on startup or parse them on every RPC as is done with multiUserAuthorized. I opted for the cached approach as I thought it was a bit cleaner.\r\n\r\n\r\nFuture Work\r\n=====\r\n\r\nIn a future PR, I would like to add an inheritance scheme. This seemed more controversial so I didn't want to include that here. Inheritance semantics are tricky, but it would also make these whitelists easier to read.\r\n\r\nIt also might be good to add a `getrpcwhitelist` command to facilitate permission discovery.\r\n\r\nBefore Merge\r\n=====\r\nI'm opening the PR now for general feedback, but I should add a couple tests before merge. I'd prefer to do documentation as a separate PR, but it can be added in this PR if preferred.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/381034728","html_url":"https://github.com/bitcoin/bitcoin/pull/12763#issuecomment-381034728","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/12763","id":381034728,"user":{"login":"kallewoof","id":250224,"avatar_url":"https://avatars3.githubusercontent.com/u/250224?v=4","gravatar_id":"","url":"https://api.github.com/users/kallewoof","html_url":"https://github.com/kallewoof","followers_url":"https://api.github.com/users/kallewoof/followers","following_url":"https://api.github.com/users/kallewoof/following{/other_user}","gists_url":"https://api.github.com/users/kallewoof/gists{/gist_id}","starred_url":"https://api.github.com/users/kallewoof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kallewoof/subscriptions","organizations_url":"https://api.github.com/users/kallewoof/orgs","repos_url":"https://api.github.com/users/kallewoof/repos","events_url":"https://api.github.com/users/kallewoof/events{/privacy}","received_events_url":"https://api.github.com/users/kallewoof/received_events","type":"User","site_admin":false},"created_at":"2018-04-13T06:14:24Z","updated_at":"2018-04-13T06:14:24Z","author_association":"MEMBER","body":"LGTM. Checked code, utACK."}}
{"actor":{"display_login":"kallewoof"}}