rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
134 stars 82 forks source link

Provide way to supply cookies to be used during deployment #283

Closed jmcphers closed 6 years ago

jmcphers commented 6 years ago

Some proxies use authentication cookies to validate requests. If a user already has such a cookie, they have no way to use it when deploying content from RStudio; it's not even possible to hack it together using e.g. .Rprofile since the R process that does the deployment uses --vanilla.

At a minimum, we'd need to expose and document rsconnect::storeCookies or a suitable front-end thereof to make this work, and update RStudio so that it can inject cookies into the R process doing the deployment. Alternately (or additionally) we could add some hooks to make it easier for arbitrary code to run prior to deployment inside the R session, to make it possible for organizations to resolve these kinds of edge cases on their own.

trestletech commented 6 years ago

For Connect, I think our long-term strategy on these fronts was to move non-interactive use-cases to API keys. Is there compelling reason to value cookies over API keys?

jmcphers commented 6 years ago

Well, aside from the security considerations (cookies expire; API keys don't), my understanding is that auth cookies are a non-negotiable part of some customers' infrastructure due to proxying through servers unrelated to RStudio and Connect. This ticket has some more context: https://rstudioide.zendesk.com/agent/tickets/28560

colearendt commented 6 years ago

FWIW I like the idea of an arbitrary hook prior to deployment. I also like the idea of it not being .Rprofile, though, because there is no telling the types of weirdness you may run into there.

Perhaps unrelated, but I could also see potential value in a post-deployment hook, too. This would mostly be for UX stuff, I would think... committing the rsconnect folder or other workflow-y things.

colearendt commented 6 years ago

Another use case popped up for a pro customer today. They are running into issues having to unset / reset HTTP_PROXY in order to reach their Connect server. We are pointing them to fix the proxy itself, but having a pre/post hook in rsconnect would be another way to solve the issue from our end.