Skip to content
Prev 62175 / 63421 Next

[Feature Request] Hide API Key in download.file() / R's libcurl

For cases like these, I think it would be more useful to have some
mechanism for associating URLs / hosts with credentials, and have R use
those credentials by default whenever accessing those URLs. Since
download.file() now supports custom headers, this could be a mechanism for
setting headers to be used by default when downloading files from
particular URLs. Then, users could do something like:

    options(download.file.headers = list(
        example.org = c(Authorization = "<...>")
    ))

And those headers would be used automatically by download.file() whenever
talking to that server.

All of that to say -- I think the better way forward would be to make it
easier to safely use authentication credentials in download.file(), rather
than just tooling in support for suppressing specific types of output.

Best,
Kevin


On Sat, Feb 3, 2024 at 1:33?PM Simon Urbanek <simon.urbanek at r-project.org>
wrote:
R has no way of knowing which part of the URL are credentials as it is not
under R's purview - it could be part of the path or anything, so there is
no way R can reliably mask it. Hence it makes more sense for the user to
suppress the output if they think it may contain sensitive information -
and R supports that.
defines exactly what kind processing you'd like to see under what
conditions - and how you think that will solve the problem.
will
to
https://github.com/wch/r-source/blob/trunk/src/modules/internet/libcurl.c>:
calls
https://github.com/wch/r-source/blob/trunk/src/modules/internet/libcurl.c#L772
url
case
'
there
unable to
pip
behaviour in
get