Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36c782e56 | ||
|
|
ad7d735739 | ||
|
|
4bb2dd4449 | ||
|
|
8aea38fc67 | ||
|
|
963bc87c54 |
No files matched your search
@@ -94,8 +94,16 @@ jobs:
|
||||
|
||||
- name: Audit matrixbot dependencies
|
||||
# --local scans the env without spawning a venv (required for standalone Python)
|
||||
# CVE-2026-3219 is in pip itself, not our code — ignore it explicitly
|
||||
run: /opt/python/bin/pip-audit --local --ignore-vuln CVE-2026-3219
|
||||
# CVE-2026-3219 is in pip itself, not our code — ignore it explicitly.
|
||||
# The filelock CVEs (fixed in 4.2.1) are in pip-audit's own dependency
|
||||
# (CacheControl[filecache]); the bot doesn't use filelock, and 4.2+
|
||||
# needs Python 3.11, which this 3.10 audit env can't install.
|
||||
run: >-
|
||||
/opt/python/bin/pip-audit --local
|
||||
--ignore-vuln CVE-2026-3219
|
||||
--ignore-vuln CVE-2026-112906 --ignore-vuln CVE-2026-112907
|
||||
--ignore-vuln CVE-2026-112913 --ignore-vuln CVE-2026-112914
|
||||
--ignore-vuln CVE-2026-112937 --ignore-vuln CVE-2026-112940
|
||||
|
||||
secret-scan:
|
||||
name: Secret scan (gitleaks)
|
||||
|
||||
@@ -177,6 +177,50 @@ for dir in assets public/element-call/assets; do
|
||||
find "$WEBROOT/$dir" -type f -mtime +14 -delete
|
||||
done
|
||||
|
||||
# Every script/stylesheet the app and call pages reference must exist in the
|
||||
# webroot. 2026-10-20: the call page's index.html pointed at scripts the deploy
|
||||
# never copied and calls failed to load; this check would have caught it.
|
||||
missing_assets() { # <index.html> <its directory>
|
||||
grep -oE '(src|href)="[^"]+\.(js|css)"' "$1" | sed -E 's/^(src|href)="//; s/"$//' |
|
||||
while read -r ref; do
|
||||
case "$ref" in
|
||||
http://*|https://*|//*) continue ;;
|
||||
/*) path="$WEBROOT$ref" ;;
|
||||
*) path="$2/${ref#./}" ;;
|
||||
esac
|
||||
[ -f "$path" ] || echo "$ref"
|
||||
done
|
||||
}
|
||||
deploy_alert() { # best effort: the upstream checker's Matrix credentials
|
||||
[ -r /etc/cinny-monitor.env ] || return 0
|
||||
(
|
||||
set -a
|
||||
# shellcheck source=/dev/null
|
||||
source /etc/cinny-monitor.env
|
||||
set +a
|
||||
_ALERT="$1" python3 - <<'PYEOF'
|
||||
import json, os, time, urllib.parse, urllib.request
|
||||
server = os.environ.get("MATRIX_SERVER", "").rstrip("/")
|
||||
room, token = os.environ.get("MATRIX_ROOM", ""), os.environ.get("MATRIX_TOKEN", "")
|
||||
if server and room and token:
|
||||
url = f"{server}/_matrix/client/v3/rooms/{urllib.parse.quote(room, safe='')}/send/m.room.message/deploy{int(time.time() * 1000)}"
|
||||
req = urllib.request.Request(url, method="PUT", data=json.dumps({"msgtype": "m.text", "body": os.environ["_ALERT"]}).encode(),
|
||||
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"})
|
||||
try:
|
||||
urllib.request.urlopen(req, timeout=10)
|
||||
except Exception as exc:
|
||||
print(f"alert failed: {exc}")
|
||||
PYEOF
|
||||
) || true
|
||||
}
|
||||
MISSING=$(missing_assets "$WEBROOT/index.html" "$WEBROOT"; missing_assets "$WEBROOT/public/element-call/index.html" "$WEBROOT/public/element-call")
|
||||
if [ -n "$MISSING" ]; then
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: deployed pages reference missing files:"
|
||||
echo "$MISSING"
|
||||
deploy_alert "⚠️ Lotus Chat deploy ($VITE_APP_VERSION): the live pages reference files that are not on the server, so the app or calls may not load: $(echo "$MISSING" | tr '\n' ' ')"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ===== Deploy complete ($VITE_APP_VERSION) ====="
|
||||
|
||||
# A trigger arrived while we were deploying: release the lock and run once more
|
||||
|
||||
@@ -17,6 +17,14 @@ map $uri $lotus_shell_cache_control {
|
||||
# decoration picker can fetch hundreds of thumbnails, which would otherwise use
|
||||
# up chat_limit and 503 the app's own files.
|
||||
limit_req_zone $binary_remote_addr zone=decorations_limit:10m rate=100r/s;
|
||||
#
|
||||
# [cinny #201 follow-up] Content-hashed app files (js/css/fonts/images/wasm)
|
||||
# likewise: a cold page load fires ~75 requests within a second, and the
|
||||
# service worker precaches all ~126 build files at once (every deploy renames
|
||||
# them), both past chat_limit's burst of 60, so chunks 503ed and pages
|
||||
# rendered blank / the precache install failed. Immutable files, cheap to
|
||||
# serve; pages and the webhook keep chat_limit.
|
||||
limit_req_zone $binary_remote_addr zone=assets_limit:10m rate=100r/s;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
@@ -85,6 +93,8 @@ server {
|
||||
}
|
||||
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
|
||||
include snippets/cinny-security-headers-framed.conf;
|
||||
# Own budget (replaces the server-level chat_limit; see assets_limit).
|
||||
limit_req zone=assets_limit burst=400 nodelay;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable" always;
|
||||
}
|
||||
@@ -93,6 +103,8 @@ server {
|
||||
# Cache content-addressed static assets aggressively
|
||||
location ~* \.(?:js|css|woff2?|png|svg|ico|webp)$ {
|
||||
include snippets/cinny-security-headers.conf;
|
||||
# Own budget (replaces the server-level chat_limit; see assets_limit).
|
||||
limit_req zone=assets_limit burst=400 nodelay;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable" always;
|
||||
}
|
||||
@@ -189,6 +201,8 @@ server {
|
||||
}
|
||||
location ~* \.(?:js|css|woff2?|png|svg|ico|webp|wasm)$ {
|
||||
include snippets/cinny-security-headers-call.conf;
|
||||
# Own budget (replaces the server-level chat_limit; see assets_limit).
|
||||
limit_req zone=assets_limit burst=400 nodelay;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable" always;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user