Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-05-31 - Silent Error Handling in R
**Vulnerability:** Information leakage through uncaught or default error handling in R `try()` statements.
**Learning:** In R, `try()` automatically prints error messages to standard error unless `silent = TRUE` is passed. This can leak internal execution errors, paths, or variables.
**Prevention:** Always use `try(expr, silent = TRUE)` or `tryCatch()` to gracefully handle exceptions and prevent information disclosure in error logs.
3 changes: 2 additions & 1 deletion R/llcont.R
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ llcont.lavaan <- function(x, ...){
if(length(x.idx) == 1){
tmpll.x <- dnorm(X[,x.dat.idx], Mu.X, sqrt(Sigma.X), log=TRUE)
} else {
tmpll.x <- try(dmvnorm(X[,x.dat.idx], Mu.X, Sigma.X, log=TRUE))
# SECURITY: silent = TRUE prevents internal execution errors from leaking to standard error
tmpll.x <- try(dmvnorm(X[,x.dat.idx], Mu.X, Sigma.X, log=TRUE), silent=TRUE)
}
if(inherits(tmpll.x, "try-error")) tmpll.x <- NA
tmpll[case.idx] <- tmpll[case.idx] - tmpll.x
Expand Down
Loading