fix(chromium): better default security and DX for allow / deny lists

This commit is contained in:
Julien Neuhart
2026-03-27 09:47:21 +01:00
parent bd6d92be9b
commit 06b2b2e10c
13 changed files with 358 additions and 56 deletions

View File

@@ -225,7 +225,12 @@ func newContext(echoCtx echo.Context, logger *zap.Logger, fs *gotenberg.FileSyst
)
}
err := gotenberg.FilterDeadline(downloadFromCfg.allowList, downloadFromCfg.denyList, dl.Url, deadline)
err := gotenberg.FilterDeadline(
gotenberg.RegexpToSlice(downloadFromCfg.allowList),
gotenberg.RegexpToSlice(downloadFromCfg.denyList),
dl.Url,
deadline,
)
if err != nil {
return fmt.Errorf("filter URL: %w", err)
}
@@ -430,6 +435,11 @@ func (ctx *Context) FormData() *FormData {
}
}
// DirPath returns the path to the request's working directory.
func (ctx *Context) DirPath() string {
return ctx.dirPath
}
// GeneratePath generates a path within the context's working directory.
// It generates a new UUID-based filename. It does not create a file.
func (ctx *Context) GeneratePath(extension string) string {