You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create rclone credential directories and files with owner-only permissions #1914
Follow-up from the reviewed CodeRabbit deep scan (K43). This ticket tracks one distinct fix; duplicate scan rows are consolidated here.
Reviewed evidence and scope
K43 (scan ID 379d479d-4b94-4a6a-b616-2604452d5ec9, review A, Low): rclone credentials written with ordinary permissions, no tightening. Owner-only directory/file creation; legacy/local CLI scope.
Source at current baseline: src/basic_memory/cli/commands/cloud/rclone_config.py:62.
Fix and validation
Create rclone credential directories and files with owner-only permissions.
Recheck current callers and supported behavior before choosing the smallest complete fix.
Add a bounded regression at the affected public or service boundary; demonstrate it fails without the fix.
Preserve legitimate inputs and tenant/project boundaries. Run focused tests plus repository static/type checks.
The scan/review establishes the code-level concern described above; it does not establish production exploitation. Conditional branches and local/tooling-only exposure must retain that scope.
Component: CLI (legacy rclone cloud sync). It's local CLI scope, so I didn't apply the cloud label.
Priority: Low, matching the scan review. This is local-only exposure and not a demonstrated exploit.
Complexity: Simple.
Duplicates: A search for related issues found none.
Findings
In src/basic_memory/cli/commands/cloud/rclone_config.py:
Line 31 creates the config directory with config_dir.mkdir(parents=True, exist_ok=True), which uses default permissions.
Lines 62-63 write the rclone config, which holds credentials, with a plain open(config_path, "w"), so the file gets umask-default permissions (often 0644).
Suggested approach (for whoever picks this up)
Create the directory with mode=0o700. Because mkdir's mode doesn't change a directory that already exists, also chmod an existing directory.
Write the file with os.open(..., O_WRONLY|O_CREAT|O_TRUNC, 0o600), then os.fchmod or chmod so an existing file is tightened too.
Add a regression test that asserts mode 0o700 on the directory and 0o600 on the file. Check it with a permissive umask and with a pre-existing loose file, and confirm it fails without the fix.
Activity
claude commentedon Oct 28, 2026
Claude finished @phernandez's task in 17s —— View job
Triage
bug; the existingsecuritylabel stays.cloudlabel.Findings
In
src/basic_memory/cli/commands/cloud/rclone_config.py:config_dir.mkdir(parents=True, exist_ok=True), which uses default permissions.open(config_path, "w"), so the file gets umask-default permissions (often 0644).Suggested approach (for whoever picks this up)
mode=0o700. Becausemkdir's mode doesn't change a directory that already exists, alsochmodan existing directory.os.open(..., O_WRONLY|O_CREAT|O_TRUNC, 0o600), thenos.fchmodorchmodso an existing file is tightened too.0o700on the directory and0o600on the file. Check it with a permissive umask and with a pre-existing loose file, and confirm it fails without the fix.I did not implement anything, per triage scope.