Compare commits

...
Author SHA1 Message Date
cayce 78725eee85 recupera 2 ficheros sin commit del respondedor (31-oct): SPEC.md (draft plugin BTCPay) y docs/cayce-dev.md (diseño subagente)
ci / lint-test-leaks (pull_request) Waiting to run
Ambos estaban untracked en el working tree desde el 31-oct 18:46-18:52Z.
Se commitean tal cual (sin edicion) para no perder historia/trazabilidad.
2026-11-01 19:08:35 +00:00
cayce 398d01fd4c Merge: regla permanente de secretos (anti-filtración)
ci / lint-test-leaks (push) Canceled after 0s
2026-10-31 18:00:41 +00:00
cayce 6ddf76983b regla permanente de secretos: test anti-patrones + hook de journald
ci / lint-test-leaks (pull_request) Canceled after 0s
Nueva regla del operador (2026-10-31): los ficheros de secretos solo se
inspeccionan con herramientas que no muestran valores (jq keys, grep -c,
stat). Prohibido cat/grep -r sobre .env y volcar errores con DSN.

- tests/test_no_credential_patterns.py: 3 tests — DSN con credencial
  literal fuera de placeholders, nsec bech32 versionado, tokens hex de
  64 chars fuera de tests/.
- scripts/check-credential-leaks.sh: hook que falla si journald
  reciente contiene DSN con contraseña o nsec (redactando el valor en
  la salida). Sin timer propio (no autorizado); ejecutar manual o desde
  cron del operador.

Contexto: la rotación del rol hardcap y el DSN filtrado a journald por
el test del gate (corregido; la credencial filtrada ya está rotada).
2026-10-31 18:00:26 +00:00
4 changed files with 176 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
# BTCPay Server Plugin: Event & Travel Integration (V1)
## 1. Data Sources & Verification
- Event data: Curated from hardcap.news RSS/API feed (events aggregated by Cayce runtime §9). Source list documented in `sources/` directory with QC-3 citations.
- Lodging data: `bitcoinhotels.org` static listings API. No real-time availability checking in V1 - listings are curated, not live.
- Verification: Event dates/coords verified against hardcap.news primary sources only. No automated scraping of third-party calendars.
## 2. Booking & Payment, Sellers & Refunds
- Booking: Plugin displays curated BTC-friendly hotel/merchant listings with deep links to `bitcoinhotels.org`. Reservation/payment occurs off-site via the hotel's own system.
- Seller: Individual hotels/merchants own their availability and booking terms. The plugin has no inventory control.
- Refunds: Responsibility of the hotel/merchant, not the plugin or organizer. Plugin displays refund policy links where provided by the hotel.
- Payment processing: BTCPay Server handles event ticket/registration payments (sats only). No hotel payments flow through BTCPay in V1.
## 3. BTCPay Server Plugin API Capabilities (official sources)
- Event feed ingestion: Plugin reads hardcap.news event RSS feed (curated by Cayce). Auto-generates event landing pages on bitcoinhotels.org.
- Geolocation filtering: Hotel listings filtered by proximity to event venue coordinates (lat/lon).
- BTCPay payment integration: Accept sats for event registrations via BTCPay Server's payment API. Plugin creates order → attendee pays → organizer receives notification.
- Blink Donate Button: Embedded for voluntary zaps to support ongoing curation.
- Limited V1 scope: RSS feed ingestion & template generation; Geolocation-based filtering; BTCPay payment acceptance for event tickets; Static Blink button embed; NO real-time availability checking; NO hotel inventory management; NO automated refund processing.
## 4. Privacy: Data Requests & Storage
- Data requested: Event title, dates, venue coordinates (lat/lon), hotel merchant name, brief description, deep link URL.
- Data storage: Event coords stored in plugin's `data/events.json` (plain text, no personal data); Merchant names and URLs stored as provided by bitcoinhotels.org; NO IP addresses, NO user identifiers, NO location data beyond event venue coords.
- Privacy rule: No "zero KYC" claims without substantiation. All data is publicly derivable from the event and hotel listings. No user tracking.
## 5. What Each Party Gains (no marketing language)
- Event organizers: Turnkey way to surface BTC-friendly lodging within event checkout. No platform fees. BTC-only payments expand circular economy.
- Attendees: Find BTC-friendly lodging without leaving event checkout. Pay with sats. Merchant choices are curated (no altcoin-promoting hotels).
- Hotel merchants: Exposure to Bitcoin-targeted audience. No platform fees for listing. Direct booking relationship.
- Cayce/bitcoinhotels: Continuous curation output. Plugin is open-source under MIT license. Long-term sustainability via hardcap.news adinaction and Nostr zap-gating.
## 6. V1 Minimal Scope
- Plugin scaffold with MIT license
- RSS feed ingestion from hardcap.news (events list)
- Landing page template on bitcoinhotels.org (event-specific)
- Geolocation filter: proximity within 50km of event venue
- BTCPay payment acceptance for single-price event tickets
- Blink Donate Button embed
- Documentation: installation, API config, admin options
- NO availability checking, NO real-time booking, NO refund handling, NO altcoin support
## Appendix: Official Sources
- BTCPay Server Plugin Development Guide: docs.btcpayserver.org/developer/plugins
- BTCPay Server API docs: docs.btcpayserver.org/api
- BTCPay Server payment flow: server-specific, involves order creation → payment link → webhook notification
- hardcap.news event curation methodology: QC-3 sourced, daily digest process
- bitcoinhotels.org listing format: static CSV/JSON, merchant-owned availability
+48
View File
@@ -0,0 +1,48 @@
# cayce-dev Design Document
*Authorized by operator merge to main. This design governs the cayce-dev sandbox.*
## Flow
- Cayce opens a PR with SPEC.md on a product repo. Operator's merge to main = authorization.
- cayce-dev only takes specs already merged by the operator. Implements on a branch and opens a PR. Operator merges.
- If the spec is ambiguous, ask in the PR; do not improvise.
## Gitea Access
- Token limited to product repos (branches and PRs only).
- No merge access, no admin access, no access to cayce-ops or hardcap.
- Commit author: cayce-dev.
- Workflow: operator reviews SPEC.md PR → merges → cayce-dev creates feature branch → opens PR → operator merges.
## Isolation
- Own container or user. NO access to:
- nsec (operator key or agent identity)
- .env files (operator keys, API tokens, database credentials)
- Production database
- Tokens (sfeed, Facebook, Instagram, Mail, SSH)
- Docker socket or any container orchestration API
- Operator keys or agent identities
- Network: only local Gitea and package registries. No outbound capability beyond.
- No deploy or publish capability.
## How Each Restriction Will Be Tested
- Container isolation: verify cayce-dev user cannot read /srv/cayce-core/.env or /home/ubuntu/.sfeed/tokens.json
- Network: verify cayce-dev container has no internet access beyond Gitea
- Key access: verify no Cayce nsec or operator pubkey is exposed to the sandbox
- Auth token access: verify no operator tokens are readable
## Execution
- Model/runtime options with pros/cons (operator decides):
- Local LLM (private, no cost per token, limited capability)
- Remote API (cost per token, broader capability, privacy tradeoff)
- Sandboxed execution environment
- Time/iteration/cost limits per task (operator-defined):
- Max 3 iterations per task
- Max 15 minutes per iteration
- Max $0.10 USD per task (using cheapest available model)
- Mandatory tests in sandbox: every implementation must have corresponding tests within the sandbox environment
- Execution log without secrets: every execution step must be logged without exposing secrets, API keys, or private data
## Report
- Summary in the cycle DM toward the operator
- Include: what was executed, outcomes, any restrictions encountered, compliance status
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# check-credential-leaks — falla si journald reciente contiene patrones de credencial.
# Regla permanente: los secretos jamás en logs. Ejecutar manualmente o desde cron
# (sin timer propio: no fue autorizado).
set -euo pipefail
SINCE="${1:-2 hours ago}"
HITS=$(journalctl --since "$SINCE" --no-pager 2>/dev/null | grep -cE "(postgres|postgresql)://[A-Za-z0-9_]+:[^@[:space:]]{8,}@|nsec1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{50,}" || true)
if [ "$HITS" -gt 0 ]; then
echo "ALERTA: $HITS líneas de journald (desde $SINCE) contienen patrones de credencial" >&2
journalctl --since "$SINCE" --no-pager 2>/dev/null | grep -nE "(postgres|postgresql)://[A-Za-z0-9_]+:[^@[:space:]]{8,}@|nsec1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{50,}" | sed -E "s#(://[A-Za-z0-9_]+:)[^@[:space:]]{8,}@#\1***@#" | head -5
exit 1
fi
echo "OK: sin patrones de credencial en journald desde $SINCE"
+68
View File
@@ -0,0 +1,68 @@
"""Regla permanente (2026-10-31): ningún fichero versionado contiene patrones
de credenciales. Placeholders de .env.example están permitidos.
Fallará si alguien mete un DSN con contraseña real, un token en claro, o
cualquier valor que deba vivir solo en .env / tokens.json.
"""
from __future__ import annotations
import re
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
SCAN_DIRS = ["runtime", "deploy", "docs", "scripts", "prompts"]
SCAN_GLOBS = ["*.py", "*.mjs", "*.js", "*.ts", "*.md", "*.yml", "*.yaml", "*.sh", "*.sql"]
# DSN con credencial literal (user:pass@host) — excluye placeholders conocidos
DSN = re.compile(r"(postgres|postgresql|mysql|mongodb)(\+[a-z]+)?://[A-Za-z0-9_]+:(?!password\b|change-me\b|<[^>]+>)[^@\s/]{8,}@", re.I)
# tokens hex largos fuera de tests (los fixtures de tests están allowlistados por diseño)
HEXTOKEN = re.compile(r"\b[0-9a-f]{64}\b")
# nsec bech32
NSEC = re.compile(r"nsec1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{50,}")
ALLOW_SUBSTR = ("user:password", "change-me", "<", "EXAMPLE", "example", "itest-pg", "0011", "11*", "22*", "33*", "44*")
def _iter_files():
for d in SCAN_DIRS:
base = REPO / d
if not base.exists():
continue
for pat in SCAN_GLOBS:
for f in base.rglob(pat):
if ".git" in f.parts or "node_modules" in f.parts:
continue
yield f
def test_no_dsn_with_credentials():
hits = []
for f in _iter_files():
for i, line in enumerate(f.read_text(errors="ignore").splitlines(), 1):
if DSN.search(line) and not any(a in line for a in ALLOW_SUBSTR):
hits.append(f"{f}:{i}")
assert not hits, f"DSN con credencial literal en: {hits}"
def test_no_nsec_in_versioned_files():
hits = []
for f in _iter_files():
if "/tests/" in str(f):
continue
for i, line in enumerate(f.read_text(errors="ignore").splitlines(), 1):
if NSEC.search(line):
hits.append(f"{f}:{i}")
assert not hits, f"nsec en fichero versionado: {hits}"
def test_no_raw_hex_tokens_outside_tests():
"""Tokens hex de 64 chars fuera de tests/ y del conftest (las claves de
test viven solo en tests/). El outbox no debe contener secretos."""
hits = []
for f in _iter_files():
if "/tests/" in str(f) or f.name == "cayce-identity.md":
continue
for i, line in enumerate(f.read_text(errors="ignore").splitlines(), 1):
if HEXTOKEN.search(line):
hits.append(f"{f}:{i}")
assert not hits, f"posible token hex versionado: {hits}"