aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-06-28 08:56:35 +0200
committerBjørn Erik Pedersen <[email protected]>2023-06-28 08:57:28 +0200
commit7f698c89346acb5e5116736d25325a046652ba81 (patch)
tree31f82eff1f17b7bf53581583f6d856bf551036dd /hugolib
parentfa0e16f4c79a703d122f1e3a3a99f4b779aea9b2 (diff)
downloadhugo-7f698c89346acb5e5116736d25325a046652ba81.tar.gz
hugo-7f698c89346acb5e5116736d25325a046652ba81.zip
Don't panic on invalid security whitelist regexp
Fixes #11176
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/integrationtest_builder.go3
-rw-r--r--hugolib/testhelpers_test.go4
2 files changed, 5 insertions, 2 deletions
diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go
index cb34cb28b..9c40fa7d0 100644
--- a/hugolib/integrationtest_builder.go
+++ b/hugolib/integrationtest_builder.go
@@ -381,7 +381,8 @@ func (s *IntegrationTestBuilder) initBuilder() error {
s.Assert(os.Chdir(s.Cfg.WorkingDir), qt.IsNil)
s.C.Cleanup(func() { os.Chdir(wd) })
sc := security.DefaultConfig
- sc.Exec.Allow = security.NewWhitelist("npm")
+ sc.Exec.Allow, err = security.NewWhitelist("npm")
+ s.Assert(err, qt.IsNil)
ex := hexec.New(sc)
command, err := ex.New("npm", "install")
s.Assert(err, qt.IsNil)
diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go
index e1fd537a8..73920bd49 100644
--- a/hugolib/testhelpers_test.go
+++ b/hugolib/testhelpers_test.go
@@ -834,7 +834,9 @@ func (s *sitesBuilder) GetPageRel(p page.Page, ref string) page.Page {
func (s *sitesBuilder) NpmInstall() hexec.Runner {
sc := security.DefaultConfig
- sc.Exec.Allow = security.NewWhitelist("npm")
+ var err error
+ sc.Exec.Allow, err = security.NewWhitelist("npm")
+ s.Assert(err, qt.IsNil)
ex := hexec.New(sc)
command, err := ex.New("npm", "install")
s.Assert(err, qt.IsNil)