Skip to content

Commit 771fa1c

Browse files
Richardson Gundeclaude
authored andcommitted
Gate auth file copying behind copy_auth flag with WARNING log [#20]
_resolve_user_data_dir() now only calls _copy_auth_files() when self.config.copy_auth is True. A WARNING is logged in all 3 copy paths explaining the security implications (CWE-522). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent d3a3819 commit 771fa1c

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

operator_use/web/browser/service.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,12 @@ def _resolve_user_data_dir(self) -> str:
341341
if self.config.use_system_profile:
342342
# Always copy to a fresh temp dir — never touch the real profile
343343
tmp = tempfile.mkdtemp(prefix='web-use-profile-')
344-
if system_profile:
344+
if system_profile and self.config.copy_auth:
345+
logger.warning(
346+
"Browser auth data copy enabled (copy_auth=True) — "
347+
"the agent has access to all browser cookies and login sessions. "
348+
"Set browser.copy_auth=false to use a clean isolated profile."
349+
)
345350
self._copy_auth_files(system_profile, tmp)
346351
return tmp
347352

@@ -354,11 +359,20 @@ def _resolve_user_data_dir(self) -> str:
354359
if is_real_profile:
355360
# Treat the same as use_system_profile — avoid lock conflict
356361
tmp = tempfile.mkdtemp(prefix='web-use-profile-')
357-
self._copy_auth_files(str(custom), tmp)
362+
if self.config.copy_auth:
363+
logger.warning(
364+
"Browser auth data copy enabled (copy_auth=True) — "
365+
"the agent has access to all browser cookies and login sessions."
366+
)
367+
self._copy_auth_files(str(custom), tmp)
358368
return tmp
359369

360-
# Custom path: seed on first run only
361-
if not (custom / 'Default').exists() and system_profile:
370+
# Custom path: seed on first run only — requires copy_auth opt-in
371+
if not (custom / 'Default').exists() and system_profile and self.config.copy_auth:
372+
logger.warning(
373+
"Browser auth data copy enabled (copy_auth=True) — "
374+
"seeding custom profile from real Chrome profile."
375+
)
362376
self._copy_auth_files(system_profile, str(custom))
363377

364378
custom.mkdir(parents=True, exist_ok=True)

0 commit comments

Comments
 (0)