Skip to content

Free, open source blog writer for Claude Code. Researches current sources, writes answer-first posts for Google and AI answers, has an independent reviewer score each one out of 100 and ships only after five delivery gates. 32 skills, 30 /blog commands, 5 agents. Active development at AI-Marketing-Hub/claude-blog; public releases ship here.

fix(security): code quality cleanup (LOW + INFO from audit)

Daniel59f27beb50b0
diff --git a/agents/blog-writer.md b/agents/blog-writer.md
index e10bb3d..78a6cac 100644
--- a/agents/blog-writer.md
+++ b/agents/blog-writer.md
@@ -152,8 +152,11 @@ After completing the full draft, before returning content:
- Verify no paragraph exceeds 150 words (hard limit)
- Check for passive voice clusters -- rewrite to active
- Replace jargon with plain alternatives where possible
-2. If `analyze_blog.py` is accessible, run a quick check:
+2. Recommend the orchestrator run a quick check (this agent does NOT have
+ the Bash tool, so the check is delegated): the orchestrator can invoke
`python3 ~/.claude/skills/blog/scripts/analyze_blog.py <draft_file> --category content`
+ and feed the score back to refine the draft. Closes audit VULN-033:
+ prior text instructed shell execution that the agent cannot perform.
3. If readability sub-score is below 5/7, revise before returning:
- Split sentences over 25 words
- Break paragraphs over 100 words
diff --git a/skills/blog-image/scripts/setup_image_mcp.py b/skills/blog-image/scripts/setup_image_mcp.py
index b438f99..9f0fd6f 100644
--- a/skills/blog-image/scripts/setup_image_mcp.py
+++ b/skills/blog-image/scripts/setup_image_mcp.py
@@ -112,7 +112,8 @@ def check_setup(use_global: bool) -> bool:
if MCP_NAME in servers:
env = servers[MCP_NAME].get("env", {})
key = env.get("GOOGLE_AI_API_KEY", "")
- masked = key[:8] + "..." + key[-4:] if len(key) > 12 else "(not set)"
+ # Closes audit VULN-032: don't leak last-4 of API key. Length-only.
+ masked = f"<{len(key)} chars, set>" if key else "(not set)"
print(f"MCP server '{MCP_NAME}' found in {label}.")
print(f" Path: {path}")
print(f" Package: {MCP_PACKAGE}")
diff --git a/skills/blog-image/scripts/validate_image_setup.py b/skills/blog-image/scripts/validate_image_setup.py
index c8ff66e..c1f9f50 100644
--- a/skills/blog-image/scripts/validate_image_setup.py
+++ b/skills/blog-image/scripts/validate_image_setup.py
@@ -148,10 +148,12 @@ def main() -> int:
f"{key} (env var placeholder - ensure this variable is exported in your shell)",
))
else:
+ # Closes audit VULN-032: length-only display, no prefix/suffix leak.
+ display = f"<{len(key)} chars, set>" if key_set else "(empty)"
results.append(check(
"GOOGLE_AI_API_KEY is set",
key_set,
- f"{key[:8]}...{key[-4:]}" if len(key) > 12 else key or "(empty)",
+ display,
))
# 7. Model configured (optional - package has a default)
diff --git a/skills/blog-notebooklm/scripts/__init__.py b/skills/blog-notebooklm/scripts/__init__.py
index e77fffc..dc631d5 100644
--- a/skills/blog-notebooklm/scripts/__init__.py
+++ b/skills/blog-notebooklm/scripts/__init__.py
@@ -1,7 +1,16 @@
#!/usr/bin/env python3
"""
NotebookLM Skill Scripts Package
-Provides automatic environment management for all scripts
+
+Provides venv management helpers. NOTE: closes audit VULN-031: this module
+no longer triggers `ensure_venv_and_run()` at import time. Callers must
+invoke it explicitly (typically via `setup_environment.py --bootstrap` or
+the `run.py` wrapper).
+
+Reason: import-time side effects ran venv.create + pip install + 150 MB
+Chrome download whenever any script in this package was imported (incl.
+test discovery, IDE auto-import). Triggering install on import violates
+the principle of least surprise and slows every cold start.
"""
import os
@@ -12,8 +21,10 @@ from pathlib import Path
def ensure_venv_and_run():
"""
- Ensure virtual environment exists and run the requested script.
- This is called when any script is imported or run directly.
+ Ensure virtual environment exists.
+
+ Call explicitly from a wrapper (e.g. `python -m setup_environment` or
+ `run.py`). Do NOT rely on this firing at import time.
"""
# Only do this if we're not already in the skill's venv
skill_dir = Path(__file__).parent.parent
@@ -77,5 +88,7 @@ def ensure_venv_and_run():
print(" Or activate: source .venv/bin/activate")
-# Check environment when module is imported
-ensure_venv_and_run()
\ No newline at end of file
+# Audit VULN-031: removed import-time `ensure_venv_and_run()` call. Callers
+# must invoke `ensure_venv_and_run()` explicitly. The `setup_environment.py`
+# script and `run.py` wrapper both do this at top-level, so the user-facing
+# behavior of running `python run.py ...` is unchanged.
\ No newline at end of file
diff --git a/skills/blog-notebooklm/scripts/ask_question.py b/skills/blog-notebooklm/scripts/ask_question.py
index 2ba9bfb..4991381 100644
--- a/skills/blog-notebooklm/scripts/ask_question.py
+++ b/skills/blog-notebooklm/scripts/ask_question.py
@@ -95,7 +95,7 @@ def ask_notebooklm(question: str, notebook_url: str, headless: bool = True) -> s
if query_element:
print(f" ✓ Found input: {selector}")
break
- except:
+ except Exception:
continue
if not query_element:
@@ -131,7 +131,7 @@ def ask_notebooklm(question: str, notebook_url: str, headless: bool = True) -> s
if thinking_element and thinking_element.is_visible():
time.sleep(1)
continue
- except:
+ except Exception:
pass
# Try to find response with MCP selectors
@@ -152,7 +152,7 @@ def ask_notebooklm(question: str, notebook_url: str, headless: bool = True) -> s
else:
stable_count = 0
last_text = text
- except:
+ except Exception:
continue
if answer:
@@ -169,9 +169,12 @@ def ask_notebooklm(question: str, notebook_url: str, headless: bool = True) -> s
return answer + FOLLOW_UP_REMINDER
except Exception as e:
- print(f" ❌ Error: {e}")
- import traceback
- traceback.print_exc()
+ # Closes audit VULN-021: don't dump full traceback (leaks local paths
+ # to caller / log). Gate verbose trace behind BLOG_DEBUG env.
+ print(f" ❌ Error: {type(e).__name__}: {e}", file=sys.stderr)
+ if os.environ.get("BLOG_DEBUG"):
+ import traceback
+ traceback.print_exc()
return None
finally:
@@ -179,20 +182,33 @@ def ask_notebooklm(question: str, notebook_url: str, headless: bool = True) -> s
if context:
try:
context.close()
- except:
+ except Exception:
pass
if playwright:
try:
playwright.stop()
- except:
+ except Exception:
pass
def main():
parser = argparse.ArgumentParser(description='Ask NotebookLM a question')
- parser.add_argument('--question', required=True, help='Question to ask')
+ def _bounded(max_len: int):
+ # Closes audit VULN-037: cap CLI string args. Multi-MB --question
+ # would be typed character-by-character into the NotebookLM textarea,
+ # blowing up browser memory and orchestrator log volume.
+ def _check(s: str) -> str:
+ if len(s) > max_len:
+ raise argparse.ArgumentTypeError(
+ f"value too long ({len(s)} chars, max {max_len})"
+ )
+ return s
+ return _check
+
+ parser.add_argument('--question', required=True, type=_bounded(8000),
+ help='Question to ask (max 8000 chars)')
parser.add_argument('--notebook-url', help='NotebookLM notebook URL')
parser.add_argument('--notebook-id', help='Notebook ID from library')
parser.add_argument('--show-browser', action='store_true', help='Show browser')
diff --git a/skills/blog-notebooklm/scripts/browser_utils.py b/skills/blog-notebooklm/scripts/browser_utils.py
index a249277..29d589e 100644
--- a/skills/blog-notebooklm/scripts/browser_utils.py
+++ b/skills/blog-notebooklm/scripts/browser_utils.py
@@ -103,7 +103,7 @@ class StealthUtils:
# Try waiting if not immediately found
try:
element = page.wait_for_selector(selector, timeout=2000)
- except:
+ except Exception:
pass
if not element:
diff --git a/skills/blog-notebooklm/scripts/notebook_manager.py b/skills/blog-notebooklm/scripts/notebook_manager.py
index e10e156..65567b0 100644
--- a/skills/blog-notebooklm/scripts/notebook_manager.py
+++ b/skills/blog-notebooklm/scripts/notebook_manager.py
@@ -311,14 +311,33 @@ def main():
subparsers = parser.add_subparsers(dest='command', help='Commands')
+ # Closes audit VULN-037: input length caps on CLI string args.
+ # `add_notebook` derives notebook_id = name.lower().replace(' ', '-')
+ # with no length limit, so an unbounded --name becomes a giant filesystem
+ # key in library.json.
+ def _bounded(max_len: int):
+ def _check(s: str) -> str:
+ if len(s) > max_len:
+ raise argparse.ArgumentTypeError(
+ f"value too long ({len(s)} chars, max {max_len})"
+ )
+ return s
+ return _check
+
# Add command
add_parser = subparsers.add_parser('add', help='Add a notebook')
- add_parser.add_argument('--url', required=True, help='NotebookLM URL')
- add_parser.add_argument('--name', required=True, help='Display name')
- add_parser.add_argument('--description', required=True, help='Description')
- add_parser.add_argument('--topics', required=True, help='Comma-separated topics')
- add_parser.add_argument('--use-cases', help='Comma-separated use cases')
- add_parser.add_argument('--tags', help='Comma-separated tags')
+ add_parser.add_argument('--url', required=True, type=_bounded(2000),
+ help='NotebookLM URL (max 2000 chars)')
+ add_parser.add_argument('--name', required=True, type=_bounded(200),
+ help='Display name (max 200 chars)')
+ add_parser.add_argument('--description', required=True, type=_bounded(2000),
+ help='Description (max 2000 chars)')
+ add_parser.add_argument('--topics', required=True, type=_bounded(1000),
+ help='Comma-separated topics (max 1000 chars)')
+ add_parser.add_argument('--use-cases', type=_bounded(1000),
+ help='Comma-separated use cases (max 1000 chars)')
+ add_parser.add_argument('--tags', type=_bounded(500),
+ help='Comma-separated tags (max 500 chars)')
# List command
subparsers.add_parser('list', help='List all notebooks')
diff --git a/uninstall.ps1 b/uninstall.ps1
index f1932e8..c255e11 100644
--- a/uninstall.ps1
+++ b/uninstall.ps1
@@ -22,27 +22,38 @@ function Main {
Write-Color Green " Removed: $blogDir"
}
- # Remove sub-skills
- $subSkills = @(
- "blog-write", "blog-rewrite", "blog-analyze", "blog-brief",
- "blog-calendar", "blog-strategy", "blog-outline", "blog-seo-check",
- "blog-schema", "blog-repurpose", "blog-geo", "blog-audit", "blog-chart", "blog-image"
- )
- foreach ($skill in $subSkills) {
- $skillPath = Join-Path $SkillDir $skill
- if (Test-Path $skillPath) {
- Remove-Item -Recurse -Force $skillPath
- Write-Color Green " Removed: $skillPath"
+ # Remove sub-skills via glob (closes audit VULN-035: prior static array
+ # was stale and missed v1.7.0 sub-skills like blog-cluster, blog-flow,
+ # blog-multilingual, blog-translate, blog-localize, blog-locale-audit,
+ # blog-notebooklm, blog-audio, blog-google. The glob pattern is the
+ # same approach uninstall.sh already uses.)
+ if (Test-Path $SkillDir) {
+ Get-ChildItem -Path $SkillDir -Directory -Filter "blog-*" | ForEach-Object {
+ Remove-Item -Recurse -Force $_.FullName
+ Write-Color Green " Removed: $($_.FullName)"
}
}
- # Remove agents
- $agents = @("blog-researcher", "blog-writer", "blog-seo", "blog-reviewer")
- foreach ($agent in $agents) {
- $agentPath = Join-Path $AgentDir "$agent.md"
- if (Test-Path $agentPath) {
- Remove-Item -Force $agentPath
- Write-Color Green " Removed: $agentPath"
+ # Remove agents via glob (closes VULN-035: blog-translator was missing
+ # from the static list).
+ if (Test-Path $AgentDir) {
+ Get-ChildItem -Path $AgentDir -Filter "blog-*.md" | ForEach-Object {
+ Remove-Item -Force $_.FullName
+ Write-Color Green " Removed: $($_.FullName)"
+ }
+ }
+
+ # Purge credential artifacts from cross-skill data dirs (audit follow-up
+ # to VULN-805 in cybersec audit: cookies/tokens left behind post-uninstall
+ # is a meaningful exposure window).
+ $credPaths = @(
+ (Join-Path $env:USERPROFILE ".config" "claude-seo" "oauth-token.json"),
+ (Join-Path $env:USERPROFILE ".config" "claude-seo" "google-api.json")
+ )
+ foreach ($credPath in $credPaths) {
+ if (Test-Path $credPath) {
+ Remove-Item -Force $credPath -ErrorAction SilentlyContinue
+ Write-Color Green " Removed credential: $credPath"
}
}