detached 9904d0f

fix(cef): allow no-third-party cookie policy

commit
9904d0fd33572092b6d9a5dfb4bfd0af31689f78
author
brice · · 2026-04-11 16:37 UTC
parent
a363a97
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +24 -1
M internal/bootstrap/engine_test.go +9 -0
@@ -33,3 +33,12 @@ func TestBuildEngine_CEF_ReturnsErrorForUnsupportedCookiePolicy(t *testing.T) {
3333 _, err := BuildEngine(EngineInput{Config: cfg, Ctx: context.Background()})
3434 require.ErrorIs(t, err, cef.ErrCookiePolicyUnsupported)
3535 }
36+
37+func TestBuildEngine_CEF_AllowsNoThirdPartyCookiePolicy(t *testing.T) {
38+ cfg := config.DefaultConfig()
39+ cfg.Engine.Type = "cef"
40+ cfg.Engine.CookiePolicy = config.CookiePolicyNoThirdParty
41+ cfg.Engine.CEF.CEFDir = t.TempDir()
42+ _, err := BuildEngine(EngineInput{Config: cfg, Ctx: context.Background()})
43+ require.NotErrorIs(t, err, cef.ErrCookiePolicyUnsupported)
44+}
@@ -33,3 +33,12 @@ func TestBuildEngine_CEF_ReturnsErrorForUnsupportedCookiePolicy(t *testing.T) {
33 _, err := BuildEngine(EngineInput{Config: cfg, Ctx: context.Background()})33 _, err := BuildEngine(EngineInput{Config: cfg, Ctx: context.Background()})
34 require.ErrorIs(t, err, cef.ErrCookiePolicyUnsupported)34 require.ErrorIs(t, err, cef.ErrCookiePolicyUnsupported)
35 }35 }
36+
37+func TestBuildEngine_CEF_AllowsNoThirdPartyCookiePolicy(t *testing.T) {
38+ cfg := config.DefaultConfig()
39+ cfg.Engine.Type = "cef"
40+ cfg.Engine.CookiePolicy = config.CookiePolicyNoThirdParty
41+ cfg.Engine.CEF.CEFDir = t.TempDir()
42+ _, err := BuildEngine(EngineInput{Config: cfg, Ctx: context.Background()})
43+ require.NotErrorIs(t, err, cef.ErrCookiePolicyUnsupported)
44+}
M internal/infrastructure/cef/engine_init.go +9 -1
@@ -98,7 +98,15 @@ func resolvedStateRoot(opts port.EngineOptions) string {
9898
9999 // prepareCEFSettings builds purecef.Settings from the engine config.
100100 func prepareCEFSettings(opts port.EngineOptions, cfg RuntimeConfig, logger *zerolog.Logger) (purecef.Settings, error) {
101- if opts.CookiePolicy != "" && opts.CookiePolicy != port.CookiePolicyAlways {
101+ switch opts.CookiePolicy {
102+ case "", port.CookiePolicyAlways:
103+ case port.CookiePolicyNoThirdParty:
104+ logger.Warn().
105+ Str("cookie_policy", string(opts.CookiePolicy)).
106+ Msg("cef: no_third_party cookie policy is currently treated as always")
107+ case port.CookiePolicyNever:
108+ return purecef.Settings{}, fmt.Errorf("%w: %s", ErrCookiePolicyUnsupported, opts.CookiePolicy)
109+ default:
102110 return purecef.Settings{}, fmt.Errorf("%w: %s", ErrCookiePolicyUnsupported, opts.CookiePolicy)
103111 }
104112
@@ -98,7 +98,15 @@ func resolvedStateRoot(opts port.EngineOptions) string {
98 98
99 // prepareCEFSettings builds purecef.Settings from the engine config.99 // prepareCEFSettings builds purecef.Settings from the engine config.
100 func prepareCEFSettings(opts port.EngineOptions, cfg RuntimeConfig, logger *zerolog.Logger) (purecef.Settings, error) {100 func prepareCEFSettings(opts port.EngineOptions, cfg RuntimeConfig, logger *zerolog.Logger) (purecef.Settings, error) {
101- if opts.CookiePolicy != "" && opts.CookiePolicy != port.CookiePolicyAlways {101+ switch opts.CookiePolicy {
102+ case "", port.CookiePolicyAlways:
103+ case port.CookiePolicyNoThirdParty:
104+ logger.Warn().
105+ Str("cookie_policy", string(opts.CookiePolicy)).
106+ Msg("cef: no_third_party cookie policy is currently treated as always")
107+ case port.CookiePolicyNever:
108+ return purecef.Settings{}, fmt.Errorf("%w: %s", ErrCookiePolicyUnsupported, opts.CookiePolicy)
109+ default:
102 return purecef.Settings{}, fmt.Errorf("%w: %s", ErrCookiePolicyUnsupported, opts.CookiePolicy)110 return purecef.Settings{}, fmt.Errorf("%w: %s", ErrCookiePolicyUnsupported, opts.CookiePolicy)
103 }111 }
104 112
M internal/infrastructure/cef/engine_init_test.go +6 -0
@@ -35,6 +35,12 @@ func TestPrepareCEFSettings_RejectsNonDefaultCookiePolicy(t *testing.T) {
3535 require.ErrorIs(t, err, ErrCookiePolicyUnsupported)
3636 }
3737
38+func TestPrepareCEFSettings_AllowsNoThirdPartyCookiePolicy(t *testing.T) {
39+ logger := zerolog.Nop()
40+ _, err := prepareCEFSettings(port.EngineOptions{CookiePolicy: port.CookiePolicyNoThirdParty}, RuntimeConfig{}, &logger)
41+ require.NoError(t, err)
42+}
43+
3844 func TestPrepareCEFInitTraceFile_DisabledByDefault(t *testing.T) {
3945 t.Setenv(puregoCEFInitTraceEnvVar, "")
4046
@@ -35,6 +35,12 @@ func TestPrepareCEFSettings_RejectsNonDefaultCookiePolicy(t *testing.T) {
35 require.ErrorIs(t, err, ErrCookiePolicyUnsupported)35 require.ErrorIs(t, err, ErrCookiePolicyUnsupported)
36 }36 }
37 37
38+func TestPrepareCEFSettings_AllowsNoThirdPartyCookiePolicy(t *testing.T) {
39+ logger := zerolog.Nop()
40+ _, err := prepareCEFSettings(port.EngineOptions{CookiePolicy: port.CookiePolicyNoThirdParty}, RuntimeConfig{}, &logger)
41+ require.NoError(t, err)
42+}
43+
38 func TestPrepareCEFInitTraceFile_DisabledByDefault(t *testing.T) {44 func TestPrepareCEFInitTraceFile_DisabledByDefault(t *testing.T) {
39 t.Setenv(puregoCEFInitTraceEnvVar, "")45 t.Setenv(puregoCEFInitTraceEnvVar, "")
40 46

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close