Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix: auto-tighten .env permissions to 0o600 instead of warning only

23241a6749d39d25f8d64b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0604999e..44575c84 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The X FROM lane (the subject's own timeline) now pulls up to 8 posts per handle (was 3); the about/related lanes stay modest.
+### Fixed
+
+- Secrets `.env` and its parent config directory are now auto-tightened to `0o600`/`0o700` after creation, and `check-config.sh`'s `check_perms` now auto-fixes loose permissions with `chmod 600` instead of warning only ([#573](https://github.com/mvanhorn/last30days-skill/issues/573))
+
## [3.5.0] - 2026-06-18
### Added
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 727608e0..757c25ea 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -54,7 +54,7 @@ v3 has durable watchlist with multi-source storage and extended time windows.
## Past Contributors
-- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 fixes ([#549](https://github.com/mvanhorn/last30days-skill/pull/549)); Windows killpg guard ([#552](https://github.com/mvanhorn/last30days-skill/pull/552)); browser promo clarity ([#387](https://github.com/mvanhorn/last30days-skill/pull/561)); setup wizard fix ([#574](https://github.com/mvanhorn/last30days-skill/pull/578)); check-config xargs fix ([#506](https://github.com/mvanhorn/last30days-skill/issues/506)); check-config clean-exit on missing last-run ([#463](https://github.com/mvanhorn/last30days-skill/issues/463)); Firefox multi-profile cookies ([#498](https://github.com/mvanhorn/last30days-skill/issues/498)); X/Twitter CT0 template ([#396](https://github.com/mvanhorn/last30days-skill/issues/396))
+- [@23241a6749](https://github.com/23241a6749) - Windows cp1252 fixes ([#549](https://github.com/mvanhorn/last30days-skill/pull/549)); Windows killpg guard ([#552](https://github.com/mvanhorn/last30days-skill/pull/552)); browser promo clarity ([#387](https://github.com/mvanhorn/last30days-skill/pull/561)); setup wizard fix ([#574](https://github.com/mvanhorn/last30days-skill/pull/578)); check-config xargs fix ([#506](https://github.com/mvanhorn/last30days-skill/issues/506)); check-config clean-exit on missing last-run ([#463](https://github.com/mvanhorn/last30days-skill/issues/463)); Firefox multi-profile cookies ([#498](https://github.com/mvanhorn/last30days-skill/issues/498)); X/Twitter CT0 template ([#396](https://github.com/mvanhorn/last30days-skill/issues/396)); .env permission auto-fix ([#573](https://github.com/mvanhorn/last30days-skill/pull/599))
- [@JosephOIbrahim](https://github.com/JosephOIbrahim) - Windows Unicode fix ([#17](https://github.com/mvanhorn/last30days-skill/pull/17))
- [@levineam](https://github.com/levineam) - Model fallback for unverified orgs ([#16](https://github.com/mvanhorn/last30days-skill/pull/16))
- [@jonthebeef](https://github.com/jonthebeef) - Early testing and feedback
diff --git a/hooks/scripts/check-config.sh b/hooks/scripts/check-config.sh
index 8a07d7a8..7452bc9f 100755
--- a/hooks/scripts/check-config.sh
+++ b/hooks/scripts/check-config.sh
@@ -28,8 +28,9 @@ check_perms() {
# every Linux session start and printed a false WARNING.
perms=$(stat -c '%a' "$file" 2>/dev/null || stat -f '%Lp' "$file" 2>/dev/null || echo "")
if [[ -n "$perms" && "$perms" != "600" && "$perms" != "400" ]]; then
+ chmod 600 "$file" 2>/dev/null || true
echo "/last30days: WARNING — $file has permissions $perms (should be 600)."
- echo " Fix: chmod 600 $file"
+ echo " Auto-fixed with: chmod 600 $file"
fi
}
diff --git a/tests/test_last_run_state.py b/tests/test_last_run_state.py
index 986bb8c8..505dbd9b 100644
--- a/tests/test_last_run_state.py
+++ b/tests/test_last_run_state.py
@@ -2,6 +2,8 @@ import io
import json
import os
import re
+import shutil
+import stat
import subprocess
import sys
import shutil
@@ -267,5 +269,34 @@ class TestSkillMdFirstRunReference(unittest.TestCase):
mock_write.assert_called_once()
+class TestCheckPermsAutoFix(unittest.TestCase):
+ """check_perms should auto-fix loose .env permissions instead of warning only."""
+
+ def test_loose_env_is_tightened_by_check_perms(self):
+ with tempfile.TemporaryDirectory() as tmp:
+ config_dir = Path(tmp) / ".config" / "last30days"
+ config_dir.mkdir(parents=True)
+ env_file = config_dir / ".env"
+ env_file.write_text("SETUP_COMPLETE=true\n")
+ os.chmod(env_file, 0o644)
+
+ env = os.environ.copy()
+ env["HOME"] = str(Path(tmp))
+ env["LAST30DAYS_CONFIG_DIR"] = str(config_dir)
+
+ result = subprocess.run(
+ ["bash", "hooks/scripts/check-config.sh"],
+ cwd=REPO_ROOT,
+ env=env,
+ capture_output=True,
+ text=True,
+ check=False,
+ )
+
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("Auto-fixed", result.stdout)
+ self.assertEqual(stat.S_IMODE(os.stat(env_file).st_mode), 0o600)
+
+
if __name__ == "__main__":
unittest.main()