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(watchlist): reject non-https delivery_channel at config time

Ilia Alshanetskye603c7b4f0ca
diff --git a/skills/last30days/scripts/watchlist.py b/skills/last30days/scripts/watchlist.py
index e855383a..88c2de80 100644
--- a/skills/last30days/scripts/watchlist.py
+++ b/skills/last30days/scripts/watchlist.py
@@ -249,8 +249,15 @@ def cmd_config(args):
print(json.dumps({"action": "config", "key": "daily_budget", "value": str(args.value)}))
return
if args.key == "delivery":
- store.set_setting("delivery_channel", str(args.value))
- print(json.dumps({"action": "config", "key": "delivery_channel", "value": str(args.value)}))
+ value = str(args.value)
+ # Reject a non-https channel at write time so the operator gets
+ # immediate feedback, rather than discovering it via a stderr line
+ # buried in a research run hours later. Matches the delivery-time guard
+ # in _deliver_findings.
+ if value and urllib.parse.urlparse(value).scheme != "https":
+ raise SystemExit(f"delivery_channel must be an https:// URL, got {value!r}")
+ store.set_setting("delivery_channel", value)
+ print(json.dumps({"action": "config", "key": "delivery_channel", "value": value}))
return
raise SystemExit(f"Unknown config key: {args.key}")
diff --git a/tests/test_watchlist_commands.py b/tests/test_watchlist_commands.py
index 8f6b0b58..830a5fe8 100644
--- a/tests/test_watchlist_commands.py
+++ b/tests/test_watchlist_commands.py
@@ -252,6 +252,18 @@ def test_cmd_config_delivery(temp_db, capsys):
assert output["key"] == "delivery_channel"
+def test_cmd_config_delivery_rejects_non_https(temp_db):
+ """A non-https delivery channel is rejected at write time, not stored."""
+ args = Mock()
+ args.key = "delivery"
+ args.value = "http://evil.example/hooks.slack.com"
+
+ with pytest.raises(SystemExit):
+ watchlist.cmd_config(args)
+
+ assert not store.get_setting("delivery_channel")
+
+
def test_cmd_config_budget(temp_db, capsys):
"""Test configuring daily budget."""
args = Mock()