Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(security): replace blanket bearer suppression with inline comments (#3601)

LearningCircuit9d9d7187a95c
diff --git a/bearer.yml b/bearer.yml
index 192b850038..d13193e967 100644
--- a/bearer.yml
+++ b/bearer.yml
@@ -113,14 +113,3 @@ rule:
# validated by PathValidator. Pattern enforced by existing security tests.
# Affected: utils/__init__.py:89,97
- python_lang_os_command_injection
-
- # Permissive file permission alerts (python_lang_file_permissions)
- # ---------------------------------------------------------------
- # SAFE TO SKIP: All os.chmod() calls in journal_quality/ follow a
- # deliberate layered write-protection pattern:
- # 1. 0o644 transient — relax read-only perms before unlink/atomic os.replace
- # 2. 0o444 final — read-only permission on the built DB
- # 3. Pre-commit hook (check-journal-quality-readonly.py) is primary defense
- #
- # Affected: db.py:292,1143,1159,1172 downloader.py:510,531
- - python_lang_file_permissions
diff --git a/src/local_deep_research/journal_quality/db.py b/src/local_deep_research/journal_quality/db.py
index aab316ea0a..e169408bba 100644
--- a/src/local_deep_research/journal_quality/db.py
+++ b/src/local_deep_research/journal_quality/db.py
@@ -289,7 +289,7 @@ class JournalQualityDB:
warning to diagnose the real problem.
"""
try:
- os.chmod(path, 0o644)
+ os.chmod(path, 0o644) # bearer:disable python_lang_file_permissions
except OSError:
logger.warning(
f"Could not chmod 0644 on unusable DB {path} before "
@@ -1140,7 +1140,9 @@ def build_db(
engine.dispose()
if tmp_path.exists():
try:
- os.chmod(tmp_path, 0o644)
+ os.chmod(
+ tmp_path, 0o644
+ ) # bearer:disable python_lang_file_permissions
tmp_path.unlink()
except OSError:
logger.exception(f"Failed to clean up tmp DB at {tmp_path}")
@@ -1156,7 +1158,9 @@ def build_db(
# (e.g. read-only mount), os.replace will raise and surface
# the real problem. Log so the cause is visible.
try:
- os.chmod(output_path, 0o644)
+ os.chmod(
+ output_path, 0o644
+ ) # bearer:disable python_lang_file_permissions
except OSError:
logger.warning(
f"Could not chmod 0644 on existing {output_path} before "
@@ -1169,7 +1173,7 @@ def build_db(
# read-only file attribute via SetFileAttributesW. The pre-commit
# hook check-journal-quality-readonly.py remains the primary
# defense against accidental writable opens.
- os.chmod(output_path, 0o444)
+ os.chmod(output_path, 0o444) # bearer:disable python_lang_file_permissions
if sys.platform == "win32":
try:
import ctypes
diff --git a/src/local_deep_research/journal_quality/downloader.py b/src/local_deep_research/journal_quality/downloader.py
index e34337a1e4..e05854ea03 100644
--- a/src/local_deep_research/journal_quality/downloader.py
+++ b/src/local_deep_research/journal_quality/downloader.py
@@ -535,7 +535,9 @@ def download_journal_data(force: bool = False) -> tuple[bool, str]:
try:
import os as _os
- _os.chmod(legacy_db, 0o644)
+ _os.chmod(
+ legacy_db, 0o644
+ ) # bearer:disable python_lang_file_permissions
legacy_db.unlink()
logger.info(
"Removed legacy journal_reference.db "
@@ -556,7 +558,9 @@ def download_journal_data(force: bool = False) -> tuple[bool, str]:
if new_db_file.exists():
import os as _os
- _os.chmod(new_db_file, 0o644)
+ _os.chmod(
+ new_db_file, 0o644
+ ) # bearer:disable python_lang_file_permissions
new_db_file.unlink()
build_db(data_dir=data_dir, output_path=new_db_file)
except Exception as exc: