rpc: add user field to getrpcinfo’s json #18830

pull brakmic wants to merge 1 commits into bitcoin:master from brakmic:getrpcinfo changing 2 files +12 −1
  1. brakmic commented at 2:59 pm on April 30, 2020: contributor

    This PR adds a new field, user, to getrpcinfo’s json. Check the discussion #18827 (comment) for more info regarding this change.

    The functional test interface_rpc has been updated accordingly.

  2. laanwj added the label RPC/REST/ZMQ on Apr 30, 2020
  3. kristapsk approved
  4. kristapsk commented at 4:30 pm on April 30, 2020: contributor
    ACK 868233f061dc1409d219f3dc35d1c0d3bad59604
  5. in src/rpc/server.cpp:236 in 868233f061 outdated
    231@@ -231,6 +232,8 @@ static UniValue getrpcinfo(const JSONRPCRequest& request)
    232     const std::string path = LogInstance().m_file_path.string();
    233     UniValue log_path(UniValue::VSTR, path);
    234     result.pushKV("logpath", log_path);
    235+    UniValue user(UniValue::VSTR, request.authUser);
    236+    result.pushKV("user", user);
    


    promag commented at 4:37 pm on April 30, 2020:
    Just result.pushKV("user", request.authUser)?

    brakmic commented at 6:27 pm on April 30, 2020:

    Yes, this could be made like this. However, I saw in some other (older code) that people were putting string values into UniValue::VSTRs, so I thought, I should follow “best practices”. Not that I know, what Bitcoin Core best practices were, but I try to follow already existing code.

    Long story short: yes, I’d prefer putting string directly into result. :)

    –EDIT: one example is the line 233, just above my code. There you have such an example.

  6. promag commented at 6:25 pm on April 30, 2020: member
    I don’t understand what is the use case. The client should know who he is?
  7. kristapsk commented at 7:43 pm on April 30, 2020: contributor

    I don’t understand what is the use case. The client should know who he is?

    I think this could help in some cases when supporting users. For example, asking to provide getrpcinfo output is simpler than asking to provide whole config file, there will be other settings user might not share or he could just by mistake give wrong config file from his computer.

  8. luke-jr commented at 6:15 pm on May 4, 2020: member
    To make an RPC call, you need to specify the user… I agree with @promag that this makes no sense.
  9. DrahtBot commented at 3:37 am on May 6, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18871 (rpc: prevent circular deps by extracting into separate include by brakmic)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  10. rpc: add user field to getrpcinfo's json 22126370cf
  11. brakmic closed this on May 10, 2020

  12. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-06 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me