Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared secret mismatches throw errors #808

Closed
aronatkins opened this issue Jun 2, 2021 · 0 comments · Fixed by #809
Closed

shared secret mismatches throw errors #808

aronatkins opened this issue Jun 2, 2021 · 0 comments · Fixed by #809

Comments

@aronatkins
Copy link
Contributor

Given any Plumber API, for versions of plumber up to 1.1.0:

options(`plumber.sharedSecret`="abcdefg")
plumber::plumb(file='plumber.R')$run()
# On connecting to this application:
# <simpleError in (function (req, res) {    secret <- getOption("plumber.sharedSecret", NULL)    if (!is.null(secret)) {        supplied <- req$HTTP_PLUMBER_SHARED_SECRET        if (!identical(supplied, secret)) {            res$status <- 400            stop("The provided shared secret did not match expected secret.")        }    }    forward()})(req = <environment>, res = <environment>): The provided shared secret did not match expected secret.>

Interacting with that API gives:

curl http://127.0.0.1:3063/echo
# {"error":"Internal error","message":"Error in (function (req, res) : The provided shared secret did not match expected secret.\n"}

It is not necessary to use stop; returning an error response is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant