rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

Pins will not pin an RSConnect dataset that has the words "is not only" in the description #629

Closed dewoller closed 2 years ago

dewoller commented 2 years ago

Funny little error. If my pin description has "word is not only" in the description, it fails with an http forbidden error:

pins::pin_write(board=pins::board_register_rsconnect(),
                mtcars,
                name='abcd',
                      description=("g is not only "))
#> Connecting to RSC 2021.11.0 at <https://rstudio.XXXX>
#> Guessing `type = 'rds'`
#> Error in rsc_check_status(req): Forbidden (HTTP 403).

It works with a local board:


pins::pin_write(board=pins::board_local(),
                mtcars,
                name='abcd',
                      description=("g is not only "))
#> Guessing `type = 'rds'`
#> Replacing version '20220726T012000Z-090eb' with '20220726T012019Z-090eb'
#> Writing to pin 'abcd'

It also works if any of the words are different, e.g.

pins::pin_write(board=pins::board_register_rsconnect(),
                mtcars,
                name='abcd',
                      description=("g is only "))
#> Connecting to RSC 2021.11.0 at <https://rstudio.XXXX>
#> Guessing `type = 'rds'`
#> Writing to pin 'dennis.wollersheim@XXXX/abcd'

Maybe because the board is hosted on azure? We have had odd pin problems with Azure before.

Packages updated, but here is the sessionInfo:

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] nvimcom_0.9-115

loaded via a namespace (and not attached):
 [1] highr_0.9         pillar_1.8.0      compiler_4.1.2    R.methodsS3_1.8.1 R.utils_2.11.0    tools_4.1.2
 [7] digest_0.6.29     evaluate_0.15     jsonlite_1.8.0    lifecycle_1.0.1   tibble_3.1.7      R.cache_0.15.0
[13] pkgconfig_2.0.3   rlang_1.0.4       reprex_2.0.1      cli_3.3.0         rstudioapi_0.13   curl_4.3.2
[19] yaml_2.3.5        xfun_0.29         fastmap_1.1.0     withr_2.5.0       httr_1.4.3        styler_1.6.2
[25] knitr_1.38        fs_1.5.2          pins_1.0.1.9000   vctrs_0.4.1       askpass_1.1       rappdirs_0.3.3
[31] glue_1.6.2        R6_2.5.1          processx_3.5.2    fansi_1.0.3       rmarkdown_2.11    callr_3.7.0
[37] purrr_0.3.4       clipr_0.7.1       magrittr_2.0.3    whisker_0.4       ps_1.6.0          htmltools_0.5.2
[43] backports_1.4.1   ellipsis_0.3.2    rsconnect_0.8.26  paint_0.1.5       mime_0.12         utf8_1.2.2
[49] openssl_2.0.2     crayon_1.5.1      R.oo_1.24.0
machow commented 2 years ago

Hey, could you post the http error message? This is very perplexing!

dewoller commented 2 years ago

IKR! The funny thing is, that is it, that is the entire message.

I did find another description that triggers the error. e when (1)

pins::pin_write(board=pins::board_register_rsconnect(),
                mtcars,
                name='abcd',
                description=paste( "e when (1)"))

Like playing whack a mole, but I am getting good at rewriting my pin descriptions....

PS congratulations on the new name!

dewoller commented 2 years ago

Also description= "case 9)" causes the error. Any number can replace the 9.

dewoller commented 2 years ago

I reckon it is some attempt by Microsoft to stop code injection, because it objects to sql-ish words. E.g. ONLY, WHEN, CASE etc.

juliasilge commented 2 years ago

I don't think this is a problem with pins or RStudio Connect. All those examples you suggest work on our demo server:

library(pins)
b <- board_rsconnect()
#> Connecting to RSC 2022.07.0 at <https://colorado.rstudio.com/rsc>
b %>% pin_write(mtcars, name = "some-cars", description = "g is not only ")
#> Guessing `type = 'rds'`
#> Writing to pin 'julia.silge/some-cars'

Created on 2022-08-11 by the reprex package (v2.0.1)

Is your Connect instance installed on Azure?

dewoller commented 2 years ago

Oh Julia, I am honored, and apologise my paltry bug took you away from all the other great work you are do!

You are correct, this RSConnect instance is behind an Azure gateway, and we have had (and have) other odd problems that result from this unholy alliiance. It is not the first time a Microsoft product has broken standards, but in this case, probably just an attempt to protect something behind the gateway ¯_(ツ)_/¯ .

Thanks for looking into it.

github-actions[bot] commented 2 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.