Complete project rebrand for better positioning in the press freedom and digital security space. FieldWitness communicates both field deployment and evidence testimony — appropriate for the target audience of journalists, NGOs, and human rights organizations. Rename mapping: - soosef → fieldwitness (package, CLI, all imports) - soosef.stegasoo → fieldwitness.stego - soosef.verisoo → fieldwitness.attest - ~/.soosef/ → ~/.fwmetadata/ (innocuous data dir name) - SOOSEF_DATA_DIR → FIELDWITNESS_DATA_DIR - SoosefConfig → FieldWitnessConfig - SoosefError → FieldWitnessError Also includes: - License switch from MIT to GPL-3.0 - C2PA bridge module (Phase 0-2 MVP): cert.py, export.py, vendor_assertions.py - README repositioned to lead with provenance/federation, stego backgrounded - Threat model skeleton at docs/security/threat-model.md - Planning docs: docs/planning/c2pa-integration.md, docs/planning/gtm-feasibility.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
80 lines
2.8 KiB
Python
80 lines
2.8 KiB
Python
"""
|
|
Fieldkit blueprint — killswitch, dead man's switch, status dashboard.
|
|
"""
|
|
|
|
from auth import admin_required, get_username, login_required
|
|
from flask import Blueprint, flash, redirect, render_template, request, url_for
|
|
|
|
from fieldwitness.audit import log_action
|
|
|
|
bp = Blueprint("fieldkit", __name__, url_prefix="/fieldkit")
|
|
|
|
|
|
@bp.route("/")
|
|
@login_required
|
|
def status():
|
|
"""Fieldkit status dashboard — all monitors and system health."""
|
|
from fieldwitness.fieldkit.deadman import DeadmanSwitch
|
|
|
|
deadman = DeadmanSwitch()
|
|
return render_template(
|
|
"fieldkit/status.html",
|
|
deadman_status=deadman.status(),
|
|
)
|
|
|
|
|
|
@bp.route("/killswitch", methods=["GET", "POST"])
|
|
@admin_required
|
|
def killswitch():
|
|
"""Killswitch arming and firing UI."""
|
|
if request.method == "POST":
|
|
action = request.form.get("action")
|
|
if action == "fire" and request.form.get("confirm") == "CONFIRM-PURGE":
|
|
# Require password re-authentication for killswitch
|
|
from auth import verify_user_password
|
|
|
|
password = request.form.get("password", "")
|
|
username = get_username()
|
|
if not verify_user_password(username, password):
|
|
flash("Killswitch requires password confirmation.", "danger")
|
|
return render_template("fieldkit/killswitch.html")
|
|
|
|
from fieldwitness.fieldkit.killswitch import PurgeScope, execute_purge
|
|
|
|
actor = username
|
|
result = execute_purge(PurgeScope.ALL, reason="web_ui")
|
|
outcome = "success" if result.fully_purged else "failure"
|
|
failed_steps = ", ".join(name for name, _ in result.steps_failed)
|
|
log_action(
|
|
actor=actor,
|
|
action="killswitch.fire",
|
|
target="all",
|
|
outcome=outcome,
|
|
source="web",
|
|
detail=(
|
|
f"steps_completed={len(result.steps_completed)} "
|
|
f"steps_failed={len(result.steps_failed)}"
|
|
+ (f" failed={failed_steps}" if failed_steps else "")
|
|
),
|
|
)
|
|
flash(
|
|
f"Purge executed: {len(result.steps_completed)} steps completed, "
|
|
f"{len(result.steps_failed)} failed",
|
|
"warning" if result.steps_failed else "success",
|
|
)
|
|
return redirect(url_for("fieldkit.status"))
|
|
|
|
return render_template("fieldkit/killswitch.html")
|
|
|
|
|
|
@bp.route("/deadman/checkin", methods=["POST"])
|
|
@login_required
|
|
def deadman_checkin():
|
|
"""Record a dead man's switch check-in."""
|
|
from fieldwitness.fieldkit.deadman import DeadmanSwitch
|
|
|
|
deadman = DeadmanSwitch()
|
|
deadman.checkin()
|
|
flash("Check-in recorded.", "success")
|
|
return redirect(url_for("fieldkit.status"))
|