glue_safe | R Documentation |
glue_safe()
and glue_data_safe()
differ from glue()
and glue_data()
in that the safe versions only look up symbols from an environment using
get()
. They do not execute any R code. This makes them suitable for use
with untrusted input, such as inputs in a Shiny application, where using the
normal functions would allow an attacker to execute arbitrary code.
glue_safe(..., .envir = parent.frame())
glue_data_safe(.x, ..., .envir = parent.frame())
... |
[ For |
.envir |
[ |
.x |
[ |
A glue object, as created by as_glue()
.
"1 + 1" <- 5
# glue actually executes the code
glue("{1 + 1}")
# glue_safe just looks up the value
glue_safe("{1 + 1}")
rm("1 + 1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.