Skip to content

Commit

Permalink
Indicate shared secret mismatch only when debugging.
Browse files Browse the repository at this point in the history
Co-authored-by: Barret Schloerke <barret@rstudio.com>
  • Loading branch information
aronatkins and schloerke committed Jun 4, 2021
1 parent bacf6ea commit 572a738
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/shared-secret-filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ sharedSecretFilter <- function(req, res){
res$status <- 400
# Force the route to return as unboxed json
res$serializer <- serializer_unboxed_json()
return(list(error = "Shared secret mismatch."))
# Using output similar to `defaultErrorHandler()`
li <- list(error = "400 - Bad request")

# Don't overly leak data unless they opt-in
if (is.function(req$pr$getDebug) && isTRUE(req$pr$getDebug())) {
li$message <- "Shared secret mismatch"
}
return(li)
}
}

Expand Down

0 comments on commit 572a738

Please sign in to comment.