Backtestshugorun-20260917-015623#15171

Issue #15171 Merged fix PR # Run 17 Sep 2026 · run-20260917-015623 gohugoio/hugo

Remove -embedded from the default exec.allow

Better

Our patch was judged better than the merged fix.

In this judgment, Patch B = our agent, Patch A = the merged fix.

The issue asks only to remove `-embedded` from the default exec.allow. Both patches correctly change `^(dart-)?sass(-embedded)?$` to `^(dart-)?sass$` and update the TestToTOML golden string, so both resolve the root cause. The decisive differences are scope and correctness of behavior. Patch A additionally drops `^tailwindcss$` from the default Allow list — an unrequested behavior change that removes tailwindcss from the default exec whitelist. Nothing in the issue justifies this; it is scope creep that changes default security behavior. The 'extra' test work in Patch A (adding `security.exec.allow = [...'^tailwindcss$']` to three tailwindcss integration tests) is not a genuine test improvement — it exists solely to compensate for the regression its own out-of-scope removal introduces, which is itself evidence the change breaks default behavior. Patch B makes exactly the minimal change the issue calls for, keeps tailwindcss intact, and even preserves the original comment style (trailing period: `// sass, dart-sass.`) whereas A's comment drops it. Patch B wins on scope (minimal, targeted) and correctness (no unintended default-behavior regression), with tests that fail-before/pass-after just as A's core test does.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

11m 6s7 turns

Wall-clock time in the container

Full test suite

No new failures

3,690 passed · 99 skipped · 3,802 total

Contamination audit

Unknown

See the audit notes for this run

Patch size

10vs 15 merged

Changed lines, ours vs merged

Not relevant anymore.

The two patches

Our patch+5 −5
config/security/securityConfig.goindex 510abe6bb..06d7287a5 100644@@ -39,10 +39,10 @@ const securityConfigKey = "security" var DefaultConfig = Config{ 	Exec: Exec{ 		Allow: MustNewWhitelist(-			"^(dart-)?sass(-embedded)?$", // sass, dart-sass, dart-sass-embedded.-			"^go$",                       // for Go Modules-			"^git$",                      // For Git info-			"^node$",                     // Used as the runtime for Node tools.+			"^(dart-)?sass$", // sass, dart-sass.+			"^go$",           // for Go Modules+			"^git$",          // For Git info+			"^node$",         // Used as the runtime for Node tools. 			"^postcss$", 			"^tailwindcss$", 		),config/security/securityConfig_test.goindex 69feae858..5a2ecde9b 100644@@ -135,7 +135,7 @@ func TestToTOML(t *testing.T) { 	got := DefaultConfig.ToTOML()  	c.Assert(got, qt.Equals,-		"[security]\n  allowContent = ['! ^text/html$']\n  enableInlineShortcodes = false\n\n  [security.exec]\n    allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^git$', '^node$', '^postcss$', '^tailwindcss$']\n    osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE|PROGRAMDATA)$']\n\n  [security.funcs]\n    getenv = ['^HUGO_', '^CI$']\n\n  [security.http]\n    methods = ['(?i)GET|POST']\n    urls = ['(?i)^https?://[a-z0-9]', '! ^https?://\\d+\\.', '! (?i)localhost', '! (?i)^https?://[^/?#]*@']\n\n  [security.node]\n    [security.node.permissions]\n      allowAddons = ['tailwindcss']\n      allowChildProcess = ['tailwindcss']\n      allowRead = ['.']\n      allowWorker = ['tailwindcss']\n      allowWrite = []\n      disable = false",+		"[security]\n  allowContent = ['! ^text/html$']\n  enableInlineShortcodes = false\n\n  [security.exec]\n    allow = ['^(dart-)?sass$', '^go$', '^git$', '^node$', '^postcss$', '^tailwindcss$']\n    osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE|PROGRAMDATA)$']\n\n  [security.funcs]\n    getenv = ['^HUGO_', '^CI$']\n\n  [security.http]\n    methods = ['(?i)GET|POST']\n    urls = ['(?i)^https?://[a-z0-9]', '! ^https?://\\d+\\.', '! (?i)localhost', '! (?i)^https?://[^/?#]*@']\n\n  [security.node]\n    [security.node.permissions]\n      allowAddons = ['tailwindcss']\n      allowChildProcess = ['tailwindcss']\n      allowRead = ['.']\n      allowWorker = ['tailwindcss']\n      allowWrite = []\n      disable = false", 	) }  
Merged fix · PR #+9 −6
config/security/securityConfig.goindex 510abe6bb..daf642129 100644@@ -39,12 +39,11 @@ const securityConfigKey = "security" var DefaultConfig = Config{ 	Exec: Exec{ 		Allow: MustNewWhitelist(-			"^(dart-)?sass(-embedded)?$", // sass, dart-sass, dart-sass-embedded.-			"^go$",                       // for Go Modules-			"^git$",                      // For Git info-			"^node$",                     // Used as the runtime for Node tools.+			"^(dart-)?sass$", // sass, dart-sass+			"^go$",           // for Go Modules+			"^git$",          // For Git info+			"^node$",         // Used as the runtime for Node tools. 			"^postcss$",-			"^tailwindcss$", 		), 		// These have been tested to work with Hugo's external programs 		// on Windows, Linux and MacOS.config/security/securityConfig_test.goindex 69feae858..8318d5d6f 100644@@ -135,7 +135,7 @@ func TestToTOML(t *testing.T) { 	got := DefaultConfig.ToTOML()  	c.Assert(got, qt.Equals,-		"[security]\n  allowContent = ['! ^text/html$']\n  enableInlineShortcodes = false\n\n  [security.exec]\n    allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^git$', '^node$', '^postcss$', '^tailwindcss$']\n    osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE|PROGRAMDATA)$']\n\n  [security.funcs]\n    getenv = ['^HUGO_', '^CI$']\n\n  [security.http]\n    methods = ['(?i)GET|POST']\n    urls = ['(?i)^https?://[a-z0-9]', '! ^https?://\\d+\\.', '! (?i)localhost', '! (?i)^https?://[^/?#]*@']\n\n  [security.node]\n    [security.node.permissions]\n      allowAddons = ['tailwindcss']\n      allowChildProcess = ['tailwindcss']\n      allowRead = ['.']\n      allowWorker = ['tailwindcss']\n      allowWrite = []\n      disable = false",+		"[security]\n  allowContent = ['! ^text/html$']\n  enableInlineShortcodes = false\n\n  [security.exec]\n    allow = ['^(dart-)?sass$', '^go$', '^git$', '^node$', '^postcss$']\n    osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE|PROGRAMDATA)$']\n\n  [security.funcs]\n    getenv = ['^HUGO_', '^CI$']\n\n  [security.http]\n    methods = ['(?i)GET|POST']\n    urls = ['(?i)^https?://[a-z0-9]', '! ^https?://\\d+\\.', '! (?i)localhost', '! (?i)^https?://[^/?#]*@']\n\n  [security.node]\n    [security.node.permissions]\n      allowAddons = ['tailwindcss']\n      allowChildProcess = ['tailwindcss']\n      allowRead = ['.']\n      allowWorker = ['tailwindcss']\n      allowWrite = []\n      disable = false", 	) } resources/resource_transformers/cssjs/tailwindcss_integration_test.goindex 03cd1e07e..21702c303 100644@@ -28,6 +28,7 @@ func TestTailwindV4Basic(t *testing.T) {  	files := ` -- hugo.toml --+security.exec.allow = ['^go$', '^git$', '^node$', '^tailwindcss$'] -- package.json -- {   "license": "MIT",@@ -72,6 +73,7 @@ func TestTailwindCSSImportContext(t *testing.T) { 	files := ` -- hugo.toml -- disableKinds = ['page','rss','section','sitemap','taxonomy','term']+security.exec.allow = ['^go$', '^git$', '^node$', '^tailwindcss$'] -- assets/css/main.css -- @import "tailwindcss"; @@ -112,6 +114,8 @@ func TestTailwindCSSNoInlineImportsIssue13719(t *testing.T) { disableKinds = ['page','rss','section','sitemap','taxonomy','term'] theme = 'my-theme' +security.exec.allow = ['^go$', '^git$', '^node$', '^tailwindcss$']+ [[module.mounts]] source = 'assets' target = 'assets' 

What the agent reported

All security-config tests pass (TestToTOML, TestDecodeConfigDefault, and the rest), zero failures. The fix is complete.

Summary

What was wrong
The default exec.allow whitelist in the security config still allowed the dart-sass-embedded binary via the pattern ^(dart-)?sass(-embedded)?$. That embedded variant is no longer relevant, so it needed to be removed from the default.

What I changed (uncommitted, working tree only)

  1. config/security/securityConfig.go:42 — changed the default allow pattern from "^(dart-)?sass(-embedded)?$" to "^(dart-)?sass$" and updated the trailing comment from // sass, dart-sass, dart-sass-embedded. to // sass, dart-sass.. Ran gofmt so the comment-alignment block (lines 42–45) is canonical.
  2. config/security/securityConfig_test.go:138 — updated the TestToTOML golden string so the first exec.allow element matches the new default ('^(dart-)?sass$'). This is a required update to a golden expected value, not a weakening of the test.

What I deliberately left alone

  • hugolib/securitypolicies_test.go:210 uses an optional sass(-embedded)? matcher and explicitly sets allow="none", so it's independent of the default — verified unaffected.
  • References in common/hugo/hugo.go (binary-name/version detection) and resources/.../dartsass/* (comments) are unrelated to the allow-list default.
  • Docs (docs/data/docs.yaml, docs/content/.../Babel.md) still show the old pattern. They're documentation reflections outside the code test-gate and outside the narrow scope of this fix — flagging them in case you want a follow-up doc update.

Test evidence
./bt-test ./config/security/ -run 'TestToTOML|TestDecodeConfig' → all config/security tests pass, including TestToTOML and TestDecodeConfigDefault; 0 failures across the report. The reviewer confirmed the diff correctly and minimally addresses the report (its gofmt concern has been resolved).