Compare commits

...

4 Commits

Author SHA1 Message Date
juvenal.diaz 2927b05f3f Add OpsProof public portfolio demo
Homelab Main / validate (push) Failing after 2m40s Details
Homelab Main / running-update (push) Has been skipped Details
Homelab Main / debian-ops (push) Has been skipped Details
2026-12-04 16:29:58 -06:00
juvenal.diaz 778fb69038 Add OpsProof post-change reports 2026-12-04 16:26:50 -06:00
juvenal.diaz 675404374b Add OpsProof approval-gated execution 2026-12-04 16:23:31 -06:00
juvenal.diaz f015f2881e Add OpsProof Dex operator login 2026-12-04 16:16:13 -06:00
36 changed files with 1464 additions and 40 deletions

View File

@ -120,6 +120,14 @@
<td><a href="https://feeds.lab2025.duckdns.org/">https://feeds.lab2025.duckdns.org/</a></td>
<td><code>infra/miniflux/README.md</code></td>
</tr>
<tr>
<td>OpsProof public demo</td>
<td>debian (control-plane, 192.168.100.73)</td>
<td>systemd / jeannie deploy-opsproof</td>
<td><a href="http://192.168.100.73:8891/">http://192.168.100.73:8891/</a></td>
<td><a href="https://opsproof.lab2025.duckdns.org/">https://opsproof.lab2025.duckdns.org/</a></td>
<td><code>apps/opsproof/README.md</code></td>
</tr>
<tr>
<td>GitOps mirror</td>
<td>debian (control-plane, 192.168.100.73)</td>

View File

@ -67,9 +67,38 @@ names and cannot become arbitrary Jeannie arguments.
For warning or failing evidence, the same page now builds a proposal-only view
model tied to the Doctor execution and evidence IDs. It shows the exact
focused Jeannie/Holmes action, preconditions, risk, deterministic validation,
and the absence of a target-specific rollback. A proposal stays blocked and
cannot be approved or executed until later slices add identity, authorization,
current-evidence validation, and a validated rollback.
and the absence of a target-specific rollback. It cannot become durable until
an authenticated operator supplies that rollback procedure.
Operator mode uses a dedicated Dex OAuth client through Laravel Go's social
provider support. The authorization-code flow uses PKCE and server-side
sessions. Only verified identities in `LAB_OPSPROOF_OPERATOR_EMAILS` may sign
in; when the variable is omitted, the pipeline defaults to the committed Dex
user identity. Incident and future mutation routes require both authentication
and current membership in that allowlist. The overview remains a read-only
landing page.
An authenticated operator may convert current incident evidence into a durable
proposal only after supplying a rollback procedure. PostgreSQL stores the
proposal, its evidence hash, exact command and arguments, risk, creator, and a
separate one-time approval record. Approval reruns Doctor, requires an exact
evidence-hash match, checks Jeannie's advertised command allowlist, validates
the fixed argument shape, and then records the returned execution ID. The
execution page polls that ID and persists bounded progress output; it never
submits another command while refreshing.
After an execution reaches a terminal state, OpsProof automatically runs the
same focused Doctor target again. It retains the before/after evidence and
bounded execution output in a durable incident report with findings,
diagnostic, Five Whys, mitigation, validation, and recommendation sections.
Failed or incomplete validation is recorded explicitly instead of being shown
as a successful repair.
`/demo` is an unauthenticated portfolio surface backed only by a compiled,
sanitized fixture. It does not construct a Jeannie client and has no approval
or execution controls. The OCI edge exposes only `/demo` and immutable build
assets at `https://opsproof.lab2025.duckdns.org/`; all operator routes remain
unpublished there.
## Security boundary
@ -97,10 +126,10 @@ Each slice should be a small, independently testable commit:
applications);
5. remediation proposal with risk and rollback details (implemented as a
blocked, non-executable proposal);
6. Dex login and operator authorization;
7. approval-gated execution and live progress;
8. post-change validation and incident report;
9. sanitized public demo mode and portfolio link.
6. Dex login and operator authorization (implemented);
7. approval-gated execution and live progress (implemented);
8. post-change validation and incident report (implemented);
9. sanitized public demo mode and portfolio link (implemented).
## Initial demonstration

View File

@ -0,0 +1,80 @@
package bootstrap
import (
"os"
"strings"
laravel "go.laravel.com"
"go.laravel.com/auth"
"go.laravel.com/auth/social"
"go.laravel.com/config"
"go.laravel.com/db"
"go.laravel.com/db/postgres"
"go.laravel.com/inertia"
"go.laravel.com/web"
"app/commands"
"app/database/migrations"
"app/database/schema"
"app/database/seeders"
"app/jobs"
"app/listeners"
"app/models"
"app/resources"
"app/routes"
"app/services"
)
const dexProvider social.Provider = "dex"
func Options() laravel.Options {
issuer := strings.TrimRight(os.Getenv("OPSPROOF_DEX_ISSUER"), "/")
return laravel.Options{
Routes: laravel.Routes{
Web: routes.Web,
API: routes.API,
Channels: routes.Channels,
Health: "/up",
},
Middleware: func(m *laravel.Middleware, cfg *config.Config) {
m.Web.Append(auth.Session[models.User]{})
m.Web.Append(inertia.Middleware{Share: share, ErrorPage: "Error"})
},
Views: resources.Views,
Drivers: []db.Driver{postgres.Driver},
Migrations: migrations.All,
Schema: schema.Dumps,
Seeders: seeders.All,
Commands: commands.All,
Schedule: commands.Schedule,
Listeners: listeners.All,
Jobs: jobs.All,
SocialProviders: map[social.Provider]social.OAuth2{
dexProvider: {
AuthorizeURL: issuer + "/auth",
TokenURL: issuer + "/token",
Scopes: []string{"openid", "profile", "email"},
ClientID: "opsproof",
ClientSecret: os.Getenv("OPSPROOF_DEX_CLIENT_SECRET"),
RedirectURI: os.Getenv("OPSPROOF_DEX_REDIRECT_URL"),
User: social.UserInfo(issuer + "/userinfo"),
},
},
Services: laravel.BuildServices(services.New),
}
}
func share(r *web.Request) (inertia.Props, error) {
operator := inertia.Props{"authenticated": false}
if user := models.CurrentUser(r); user != nil {
operator = inertia.Props{"authenticated": true, "name": user.Name, "email": user.Email, "role": "operator"}
}
return inertia.Props{
"name": config.From(r).App.Name,
"status": r.Session().Get("status"),
"operator": operator,
}, nil
}

View File

@ -0,0 +1,47 @@
package migrations
import (
"context"
"go.laravel.com/schema"
)
func createOpsProofWorkflowTables(ctx context.Context) error {
if err := schema.Create(ctx, "remediation_proposals", func(table *schema.Blueprint) {
table.ID()
table.String("scope")
table.String("target")
table.String("doctor_execution_id")
table.String("evidence_hash")
table.LongText("evidence_json")
table.String("command")
table.Text("arguments_json")
table.String("risk_level")
table.LongText("rollback")
table.String("status")
table.String("created_by")
table.Timestamps()
}); err != nil {
return err
}
if err := schema.Create(ctx, "remediation_approvals", func(table *schema.Blueprint) {
table.ID()
table.BigInteger("proposal_id")
table.String("operator_email")
table.String("evidence_hash")
table.Timestamp("approved_at")
table.Timestamps()
}); err != nil {
return err
}
return schema.Create(ctx, "operation_executions", func(table *schema.Blueprint) {
table.ID()
table.BigInteger("proposal_id")
table.String("jeannie_execution_id")
table.String("status")
table.LongText("output")
table.Text("error")
table.BigInteger("report_id").Default(0)
table.Timestamps()
})
}

View File

@ -0,0 +1,29 @@
package migrations
import (
"context"
"go.laravel.com/schema"
)
func createIncidentReportsTable(ctx context.Context) error {
return schema.Create(ctx, "incident_reports", func(table *schema.Blueprint) {
table.ID()
table.BigInteger("execution_id")
table.BigInteger("proposal_id")
table.String("scope")
table.String("target")
table.String("outcome")
table.LongText("findings")
table.LongText("diagnostic")
table.LongText("five_whys_json")
table.LongText("mitigation")
table.LongText("validation")
table.LongText("recommendation")
table.LongText("before_evidence_json")
table.LongText("after_evidence_json")
table.LongText("execution_output")
table.String("approved_by")
table.Timestamps()
})
}

View File

@ -0,0 +1,11 @@
package migrations
import "go.laravel.com/db"
var All = []db.Migration{
{Name: "0001_01_01_000000_create_users_table", Run: createUsersTable},
{Name: "0001_01_01_000001_create_cache_table", Run: createCacheTable},
{Name: "0001_01_01_000002_create_jobs_table", Run: createJobsTable},
{Name: "2026_12_04_000003_create_opsproof_workflow_tables", Run: createOpsProofWorkflowTables},
{Name: "2026_12_04_000004_create_incident_reports_table", Run: createIncidentReportsTable},
}

View File

@ -0,0 +1,75 @@
package authentication
import (
"crypto/rand"
"encoding/hex"
"net/http"
"os"
"strings"
"time"
"go.laravel.com/auth"
"go.laravel.com/auth/social"
"go.laravel.com/db"
"go.laravel.com/model"
"go.laravel.com/web"
"app/models"
)
const dexProvider social.Provider = "dex"
func Login(request *web.Request) *web.Response {
return social.Redirect(request, dexProvider)
}
func Callback(request *web.Request) *web.Response {
profile, err := social.User(request, dexProvider)
if err != nil {
return web.Fail(err)
}
email := strings.ToLower(strings.TrimSpace(profile.VerifiedEmail()))
if email == "" || !operatorAllowed(email) {
return web.Abort(http.StatusForbidden)
}
name := strings.TrimSpace(profile.Name)
if name == "" {
name = email
}
verified := time.Now().UTC()
password := make([]byte, 32)
if _, err := rand.Read(password); err != nil {
return web.Fail(err)
}
user, _, err := model.FirstOrCreate[models.User](request,
db.Values{"email": email},
db.Values{
"name": name,
"email_verified_at": verified,
"password": "dex-only-" + hex.EncodeToString(password),
},
)
if err != nil {
return web.Fail(err)
}
if err := auth.Login(request, &user, false); err != nil {
return web.Fail(err)
}
return auth.RedirectIntended("/")
}
func Logout(request *web.Request) *web.Response {
if err := auth.Logout(request); err != nil {
return web.Fail(err)
}
return web.Redirect("/")
}
func operatorAllowed(email string) bool {
for _, allowed := range strings.Split(os.Getenv("OPSPROOF_OPERATOR_EMAILS"), ",") {
if strings.EqualFold(strings.TrimSpace(allowed), email) {
return true
}
}
return false
}

View File

@ -0,0 +1,25 @@
package demo
import (
"go.laravel.com/inertia"
"go.laravel.com/web"
)
func Show(*web.Request) *web.Response {
return inertia.Render("Demo", inertia.Props{
"demo": inertia.Props{
"scope": "cluster", "target": "example-api", "outcome": "validated",
"finding": "A disposable application repeatedly restarted after a configuration rollout.",
"diagnostic": "Focused evidence linked the restarts to one invalid application setting; node and storage checks remained healthy.",
"proposal": "Run the constrained Jeannie Doctor repair for the affected application.",
"rollback": "Restore the previous application revision and confirm readiness before reopening traffic.",
"validation": "The execution completed and a fresh focused Doctor run returned no warning or failing evidence.",
"evidence": []inertia.Props{
{"id": "C01", "status": "fail", "check": "Application readiness", "summary": "Desired 1, ready 0"},
{"id": "C02", "status": "warn", "check": "Container restarts", "summary": "Restart backoff observed"},
{"id": "C03", "status": "ok", "check": "Post-change validation", "summary": "Desired state satisfied"},
},
"notice": "Sanitized fixture only. This public route has no Jeannie client, credentials, approval, or execution capability.",
},
})
}

View File

@ -0,0 +1,114 @@
package execution
import (
"encoding/json"
"fmt"
"strings"
"go.laravel.com/db"
"go.laravel.com/inertia"
"go.laravel.com/model"
"go.laravel.com/web"
"app/models"
"app/services"
)
func Show(request *web.Request) *web.Response {
id, err := request.PathInt("execution")
if err != nil {
return web.Fail(err)
}
execution, err := model.Query[models.OperationExecution]().Find(request, id)
if err != nil {
return web.Fail(err)
}
proposal, err := model.Query[models.RemediationProposal]().Find(request, execution.ProposalID)
if err != nil {
return web.Fail(err)
}
remote, err := services.From(request.Context()).Jeannie.Execution(request.Context(), execution.JeannieExecutionID)
if err != nil {
return web.Fail(err)
}
if err := model.Update(request, &execution, db.Values{
"status": remote.Status, "output": remote.Output, "error": remote.Error,
}); err != nil {
return web.Fail(err)
}
execution.Status, execution.Output, execution.Error = remote.Status, remote.Output, remote.Error
if remote.Status == "succeeded" || remote.Status == "failed" {
if err := model.Update(request, &proposal, db.Values{"status": remote.Status}); err != nil {
return web.Fail(err)
}
if execution.ReportID == 0 {
reportID, err := createReport(request, &execution, proposal)
if err != nil {
return web.Fail(err)
}
execution.ReportID = reportID
}
}
return inertia.Render("Execution", inertia.Props{
"view": inertia.Props{"execution": execution, "proposal": proposal},
})
}
func createReport(request *web.Request, execution *models.OperationExecution, proposal models.RemediationProposal) (int64, error) {
client := services.From(request.Context()).Jeannie
after, validationErr := client.Doctor(request.Context(), proposal.Scope, proposal.Target)
afterJSON := "[]"
remaining := 0
firstCause := "No warning or failing evidence remained after the action."
if validationErr == nil {
encoded, err := json.Marshal(after.Evidence)
if err != nil {
return 0, err
}
afterJSON = string(encoded)
for _, evidence := range after.Evidence {
if evidence.Status == "warn" || evidence.Status == "fail" {
remaining++
if firstCause == "No warning or failing evidence remained after the action." && strings.TrimSpace(evidence.Cause) != "" {
firstCause = evidence.Cause
}
}
}
}
outcome := "validated"
validation := fmt.Sprintf("A fresh focused Doctor run found %d warning or failing evidence item(s).", remaining)
if validationErr != nil {
outcome = "validation-failed"
validation = "Fresh focused Doctor validation could not complete: " + validationErr.Error()
} else if execution.Status != "succeeded" || remaining > 0 {
outcome = "needs-attention"
}
arguments := proposal.ArgumentsJSON
findings := fmt.Sprintf("Proposal %d cited evidence fingerprint %s. Jeannie execution %s finished with status %s.", proposal.ID, proposal.EvidenceHash, execution.JeannieExecutionID, execution.Status)
diagnostic := "Before the action, focused Doctor evidence supported the reviewed proposal. After the action: " + firstCause
whys, _ := json.Marshal([]string{
"Why was an operation considered? The stored focused Doctor run contained warning or failing evidence.",
"Why was this exact operation selected? It was the immutable Jeannie command and argument set attached to the proposal.",
"Why was it allowed to run? A logged-in operator approved the proposal after its evidence fingerprint was revalidated.",
"Why is the result considered " + outcome + "? The terminal execution state and fresh Doctor evidence produced that outcome.",
"Why can recurrence be acted on? Keep the focused Doctor check, rollback procedure, and this before/after report as the repeatable control.",
})
report := models.IncidentReport{
ExecutionID: execution.ID, ProposalID: proposal.ID, Scope: proposal.Scope, Target: proposal.Target,
Outcome: outcome, Findings: findings, Diagnostic: diagnostic, FiveWhysJSON: string(whys),
Mitigation: fmt.Sprintf("Jeannie executed %s with arguments %s. The operator-supplied rollback procedure was: %s", proposal.Command, arguments, proposal.Rollback),
Validation: validation,
Recommendation: "If the same evidence returns, compare it with this report before approving another action; update the focused Doctor check when it cannot distinguish desired from actual state.",
BeforeEvidenceJSON: proposal.EvidenceJSON, AfterEvidenceJSON: afterJSON,
ExecutionOutput: execution.Output, ApprovedBy: proposal.CreatedBy,
}
if err := model.Create(request, &report); err != nil {
return 0, err
}
if err := model.Update(request, execution, db.Values{"report_id": report.ID}); err != nil {
return 0, err
}
return report.ID, nil
}

View File

@ -0,0 +1,154 @@
package proposal
import (
"context"
"encoding/json"
"fmt"
"net/http"
"time"
"go.laravel.com/db"
"go.laravel.com/inertia"
"go.laravel.com/model"
"go.laravel.com/validation"
"go.laravel.com/validation/rule"
"go.laravel.com/web"
"app/models"
"app/services"
)
type StoreProposal struct {
Rollback string `json:"rollback"`
}
func (form *StoreProposal) Rules() validation.Rules {
return validation.For(form, rule.Field(&form.Rollback, rule.Required, rule.Min(20), rule.Max(2000)))
}
func Store(request *web.Request) *web.Response {
scope, target := request.PathValue("scope"), request.PathValue("target")
if !services.ValidDoctorTarget(scope, target) {
return web.Abort(http.StatusNotFound)
}
form, err := request.Validate[StoreProposal]()
if err != nil {
return web.Fail(err)
}
incident, err := services.From(request.Context()).Jeannie.Doctor(request.Context(), scope, target)
if err != nil {
return web.Fail(err)
}
if incident.Proposal.Action == "" || len(incident.Proposal.EvidenceIDs) == 0 {
return web.Abort(http.StatusConflict)
}
evidenceHash, err := services.EvidenceFingerprint(incident)
if err != nil {
return web.Fail(err)
}
evidenceJSON, err := json.Marshal(incident.Evidence)
if err != nil {
return web.Fail(err)
}
argumentsJSON, _ := json.Marshal([]string{scope, target, "--ai"})
operator := models.CurrentUser(request)
proposal := models.RemediationProposal{
Scope: scope, Target: target, DoctorExecutionID: incident.ExecutionID,
EvidenceHash: evidenceHash, EvidenceJSON: string(evidenceJSON), Command: "doctor",
ArgumentsJSON: string(argumentsJSON), RiskLevel: incident.Proposal.RiskLevel,
Rollback: form.Rollback, Status: "pending", CreatedBy: operator.Email,
}
if err := model.Create(request, &proposal); err != nil {
return web.Fail(err)
}
return web.Redirect(fmt.Sprintf("/proposals/%d", proposal.ID))
}
func Show(request *web.Request) *web.Response {
id, err := request.PathInt("proposal")
if err != nil {
return web.Fail(err)
}
proposal, err := model.Query[models.RemediationProposal]().Find(request, id)
if err != nil {
return web.Fail(err)
}
return inertia.Render("Proposal", inertia.Props{"proposal": proposal})
}
func Approve(request *web.Request) *web.Response {
id, err := request.PathInt("proposal")
if err != nil {
return web.Fail(err)
}
proposal, err := model.Query[models.RemediationProposal]().Find(request, id)
if err != nil {
return web.Fail(err)
}
if proposal.Status != "pending" {
return web.Abort(http.StatusConflict)
}
client := services.From(request.Context()).Jeannie
current, err := client.Doctor(request.Context(), proposal.Scope, proposal.Target)
if err != nil {
return web.Fail(err)
}
fingerprint, err := services.EvidenceFingerprint(current)
if err != nil {
return web.Fail(err)
}
if fingerprint != proposal.EvidenceHash {
_ = model.Update(request, &proposal, db.Values{"status": "stale"})
return web.Abort(http.StatusConflict)
}
allowed, err := client.CommandAllowed(request.Context(), proposal.Command)
if err != nil {
return web.Fail(err)
}
if !allowed {
return web.Abort(http.StatusForbidden)
}
var arguments []string
if err := json.Unmarshal([]byte(proposal.ArgumentsJSON), &arguments); err != nil {
return web.Fail(err)
}
if len(arguments) != 3 || arguments[0] != proposal.Scope || arguments[1] != proposal.Target || arguments[2] != "--ai" {
return web.Abort(http.StatusForbidden)
}
operator := models.CurrentUser(request)
err = db.Transaction(request, func(ctx context.Context) error {
locked, err := model.Query[models.RemediationProposal]().LockForUpdate().Find(ctx, proposal.ID)
if err != nil {
return err
}
if locked.Status != "pending" {
return fmt.Errorf("proposal is no longer pending")
}
approval := models.RemediationApproval{
ProposalID: proposal.ID, OperatorEmail: operator.Email,
EvidenceHash: proposal.EvidenceHash, ApprovedAt: time.Now().UTC(),
}
if err := model.Create(ctx, &approval); err != nil {
return err
}
return model.Update(ctx, &locked, db.Values{"status": "approved"})
})
if err != nil {
return web.Fail(err)
}
remote, err := client.Submit(request.Context(), proposal.Command, arguments)
if err != nil {
_ = model.Update(request, &proposal, db.Values{"status": "submit_failed"})
return web.Fail(err)
}
execution := models.OperationExecution{
ProposalID: proposal.ID, JeannieExecutionID: remote.ID, Status: remote.Status,
}
if err := model.Create(request, &execution); err != nil {
return web.Fail(err)
}
_ = model.Update(request, &proposal, db.Values{"status": "executing"})
return web.Redirect(fmt.Sprintf("/executions/%d", execution.ID))
}

View File

@ -0,0 +1,21 @@
package report
import (
"go.laravel.com/inertia"
"go.laravel.com/model"
"go.laravel.com/web"
"app/models"
)
func Show(request *web.Request) *web.Response {
id, err := request.PathInt("report")
if err != nil {
return web.Fail(err)
}
report, err := model.Query[models.IncidentReport]().Find(request, id)
if err != nil {
return web.Fail(err)
}
return inertia.Render("Report", inertia.Props{"report": report})
}

View File

@ -0,0 +1,26 @@
package middleware
import (
"net/http"
"os"
"strings"
"go.laravel.com/web"
"app/models"
)
type Operator struct{}
func (Operator) Handle(request *web.Request, next web.Next) *web.Response {
user := models.CurrentUser(request)
if user == nil {
return web.Abort(http.StatusUnauthorized)
}
for _, allowed := range strings.Split(os.Getenv("OPSPROOF_OPERATOR_EMAILS"), ",") {
if strings.EqualFold(strings.TrimSpace(allowed), user.Email) {
return next(request)
}
}
return web.Abort(http.StatusForbidden)
}

View File

@ -0,0 +1,63 @@
package models
import "time"
type RemediationProposal struct {
ID int64 `json:"id"`
Scope string `json:"scope"`
Target string `json:"target"`
DoctorExecutionID string `json:"doctor_execution_id"`
EvidenceHash string `json:"evidence_hash"`
EvidenceJSON string `json:"evidence_json"`
Command string `json:"command"`
ArgumentsJSON string `json:"arguments_json"`
RiskLevel string `json:"risk_level"`
Rollback string `json:"rollback"`
Status string `json:"status"`
CreatedBy string `json:"created_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type RemediationApproval struct {
ID int64 `json:"id"`
ProposalID int64 `json:"proposal_id"`
OperatorEmail string `json:"operator_email"`
EvidenceHash string `json:"evidence_hash"`
ApprovedAt time.Time `json:"approved_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type OperationExecution struct {
ID int64 `json:"id"`
ProposalID int64 `json:"proposal_id"`
JeannieExecutionID string `json:"jeannie_execution_id"`
Status string `json:"status"`
Output string `json:"output"`
Error string `json:"error"`
ReportID int64 `json:"report_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type IncidentReport struct {
ID int64 `json:"id"`
ExecutionID int64 `json:"execution_id"`
ProposalID int64 `json:"proposal_id"`
Scope string `json:"scope"`
Target string `json:"target"`
Outcome string `json:"outcome"`
Findings string `json:"findings"`
Diagnostic string `json:"diagnostic"`
FiveWhysJSON string `json:"five_whys_json"`
Mitigation string `json:"mitigation"`
Validation string `json:"validation"`
Recommendation string `json:"recommendation"`
BeforeEvidenceJSON string `json:"before_evidence_json"`
AfterEvidenceJSON string `json:"after_evidence_json"`
ExecutionOutput string `json:"execution_output"`
ApprovedBy string `json:"approved_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}

View File

@ -0,0 +1,61 @@
interface Demo {
scope: string;
target: string;
outcome: string;
finding: string;
diagnostic: string;
proposal: string;
rollback: string;
validation: string;
notice: string;
evidence: Array<{ id: string; status: string; check: string; summary: string }>;
}
export default function DemoPage({ demo }: { demo: Demo }) {
return (
<main className="min-h-screen bg-[#071019] px-5 py-10 text-slate-100">
<div className="mx-auto max-w-6xl">
<header className="border-b border-white/10 pb-8">
<p className="text-xs uppercase tracking-[0.22em] text-cyan-300">OpsProof · public portfolio demo</p>
<h1 className="mt-4 max-w-4xl text-4xl font-semibold tracking-tight sm:text-6xl">
Evidence, approval, repair, and proof in one operational record.
</h1>
<p className="mt-5 max-w-3xl text-sm leading-6 text-slate-400">{demo.notice}</p>
</header>
<section className="grid gap-4 py-8 md:grid-cols-3">
{demo.evidence.map((item) => (
<article key={item.id} className="rounded-2xl border border-white/10 bg-[#0a141e] p-5">
<div className="flex items-center justify-between">
<span className="font-mono text-xs text-cyan-300">{item.id}</span>
<span className="text-[10px] uppercase text-slate-500">{item.status}</span>
</div>
<h2 className="mt-4 font-medium text-white">{item.check}</h2>
<p className="mt-2 text-sm leading-6 text-slate-400">{item.summary}</p>
</article>
))}
</section>
<section className="grid gap-px overflow-hidden rounded-3xl border border-white/10 bg-white/10 lg:grid-cols-2">
{[
['Finding', demo.finding],
['Diagnostic', demo.diagnostic],
['Approval-gated proposal', demo.proposal],
['Operator rollback', demo.rollback],
['Post-change validation', demo.validation],
['Outcome', demo.outcome],
].map(([heading, body]) => (
<article key={heading} className="bg-[#0b1621] p-6">
<p className="text-xs uppercase tracking-[0.18em] text-cyan-200">{heading}</p>
<p className="mt-3 text-sm leading-6 text-slate-400">{body}</p>
</article>
))}
</section>
<footer className="py-8 text-xs text-slate-600">
Built with Laravel Go, React/Inertia, PostgreSQL, Dex, Jeannie, Holmes, and an OCI edge boundary.
</footer>
</div>
</main>
);
}

View File

@ -0,0 +1,54 @@
import { router } from '@inertiajs/react';
import { useEffect } from 'react';
interface ExecutionView {
execution: {
id: number;
jeannie_execution_id: string;
status: string;
output: string;
error: string;
report_id: number;
};
proposal: {
id: number;
scope: string;
target: string;
evidence_hash: string;
};
}
export default function ExecutionPage({ view }: { view: ExecutionView }) {
const active = view.execution.status === 'queued' || view.execution.status === 'running';
useEffect(() => {
if (!active) return;
const timer = window.setInterval(() => router.reload({ only: ['view'] }), 2000);
return () => window.clearInterval(timer);
}, [active]);
return (
<main className="min-h-screen bg-[#071019] px-5 py-8 text-slate-100">
<div className="mx-auto max-w-5xl">
<p className="text-xs uppercase tracking-[0.2em] text-cyan-300">Approval-gated execution</p>
<h1 className="mt-3 text-3xl font-semibold">{view.proposal.scope} / {view.proposal.target}</h1>
<div className="mt-6 rounded-2xl border border-white/10 bg-[#0a141e] p-6">
<div className="flex items-center justify-between">
<span className="font-mono text-xs text-slate-500">{view.execution.jeannie_execution_id}</span>
<span className="rounded-md border border-cyan-300/20 bg-cyan-300/10 px-2 py-1 text-xs uppercase text-cyan-200">
{view.execution.status}
</span>
</div>
<pre className="mt-5 max-h-[32rem] overflow-auto whitespace-pre-wrap rounded-xl bg-black/20 p-4 text-xs leading-5 text-slate-400">
{view.execution.output || (active ? 'Waiting for Jeannie output…' : view.execution.error || 'No output returned.')}
</pre>
{active && <p className="mt-3 text-xs text-slate-500">Refreshing every two seconds.</p>}
{!active && view.execution.report_id > 0 && (
<a href={`/reports/${view.execution.report_id}`} className="mt-5 inline-flex rounded-lg bg-cyan-300 px-4 py-2 text-sm font-semibold text-slate-950">
Open incident report
</a>
)}
</div>
</div>
</main>
);
}

View File

@ -1,3 +1,6 @@
import { router } from '@inertiajs/react';
import { useState } from 'react';
interface Evidence {
id: string;
status: string;
@ -34,6 +37,12 @@ interface Incident {
interface Props {
laravelVersion: string;
operator: {
authenticated: boolean;
name?: string;
email?: string;
role?: string;
};
view: {
available: boolean;
message: string;
@ -48,8 +57,15 @@ const tone: Record<string, string> = {
skip: 'border-slate-500/20 bg-slate-500/10 text-slate-400',
};
export default function IncidentPage({ laravelVersion, view }: Props) {
export default function IncidentPage({ laravelVersion, view, operator }: Props) {
const incident = view.incident;
const [rollback, setRollback] = useState('');
const [submitting, setSubmitting] = useState(false);
function storeProposal() {
setSubmitting(true);
router.post(`/incidents/${incident.scope}/${incident.target}/proposals`, { rollback }, { onFinish: () => setSubmitting(false) });
}
return (
<main className="min-h-screen bg-[#071019] text-slate-100 selection:bg-cyan-300 selection:text-slate-950">
@ -62,9 +78,12 @@ export default function IncidentPage({ laravelVersion, view }: Props) {
</a>
<p className="mt-3 font-semibold tracking-tight">OpsProof incident evidence</p>
</div>
<span className="rounded-full border border-cyan-300/30 bg-cyan-300/10 px-3 py-1.5 text-xs text-cyan-200">
Read-only investigation
</span>
<div className="text-right">
<span className="rounded-full border border-cyan-300/30 bg-cyan-300/10 px-3 py-1.5 text-xs text-cyan-200">
Authenticated operator
</span>
<p className="mt-2 text-[11px] text-slate-500">{operator.email}</p>
</div>
</header>
{!view.available ? (
@ -218,13 +237,30 @@ export default function IncidentPage({ laravelVersion, view }: Props) {
</code>
))}
</div>
<button
type="button"
disabled={!incident.proposal.readyForApproval}
className="mt-5 w-full cursor-not-allowed rounded-lg bg-white/8 px-4 py-3 text-sm text-slate-500"
>
Approval unavailable until identity, authorization, and rollback controls exist
</button>
{incident.proposal.status === 'blocked' && (
<div className="mt-5">
<label htmlFor="rollback" className="text-xs uppercase tracking-[0.18em] text-slate-600">
Operator-supplied rollback procedure
</label>
<textarea
id="rollback"
value={rollback}
onChange={(event) => setRollback(event.target.value)}
rows={4}
maxLength={2000}
placeholder="Describe the exact rollback or restoration procedure before creating the durable proposal."
className="mt-3 w-full rounded-xl border border-white/10 bg-black/20 p-3 text-sm text-slate-300 outline-none focus:border-violet-300/50"
/>
<button
type="button"
onClick={storeProposal}
disabled={submitting || rollback.trim().length < 20}
className="mt-3 w-full rounded-lg bg-violet-300 px-4 py-3 text-sm font-semibold text-slate-950 disabled:cursor-not-allowed disabled:bg-white/8 disabled:text-slate-500"
>
{submitting ? 'Revalidating evidence…' : 'Create durable proposal'}
</button>
</div>
)}
</div>
</section>
</>

View File

@ -0,0 +1,70 @@
import { router } from '@inertiajs/react';
import { useState } from 'react';
interface Proposal {
id: number;
scope: string;
target: string;
doctor_execution_id: string;
evidence_hash: string;
command: string;
arguments_json: string;
risk_level: string;
rollback: string;
status: string;
created_by: string;
created_at: string;
}
export default function ProposalPage({ proposal }: { proposal: Proposal }) {
const [submitting, setSubmitting] = useState(false);
function approve() {
setSubmitting(true);
router.post(`/proposals/${proposal.id}/approval`, {}, { onFinish: () => setSubmitting(false) });
}
return (
<main className="min-h-screen bg-[#071019] px-5 py-8 text-slate-100">
<div className="mx-auto max-w-4xl">
<a href={`/incidents/${proposal.scope}/${proposal.target}`} className="text-xs text-cyan-300">
← Incident evidence
</a>
<section className="mt-6 overflow-hidden rounded-3xl border border-violet-300/20 bg-[#0a141e]">
<div className="border-b border-white/10 p-7">
<p className="text-xs uppercase tracking-[0.2em] text-violet-200">Durable proposal #{proposal.id}</p>
<h1 className="mt-3 text-3xl font-semibold">{proposal.scope} / {proposal.target}</h1>
<p className="mt-3 font-mono text-xs text-slate-500">Evidence SHA-256 {proposal.evidence_hash}</p>
</div>
<div className="grid gap-px bg-white/10 md:grid-cols-2">
<div className="space-y-5 bg-[#0b1621] p-6">
<p className="text-xs uppercase tracking-[0.18em] text-slate-600">Exact proposed action</p>
<code className="block rounded-lg bg-black/20 p-3 text-xs text-violet-100">
./jeannie {proposal.command} {JSON.parse(proposal.arguments_json).join(' ')}
</code>
<p className="text-sm text-slate-400">Created by {proposal.created_by}</p>
</div>
<div className="space-y-5 bg-[#0b1621] p-6">
<p className="text-xs uppercase tracking-[0.18em] text-slate-600">Risk and rollback</p>
<p className="text-sm uppercase text-rose-200">{proposal.risk_level} risk</p>
<p className="whitespace-pre-wrap text-sm leading-6 text-slate-400">{proposal.rollback}</p>
</div>
</div>
<div className="p-6">
<p className="text-sm text-amber-200">
Approval re-runs Doctor, compares the evidence hash, checks the Jeannie allowlist, and validates the exact arguments before submission.
</p>
<button
type="button"
onClick={approve}
disabled={submitting || proposal.status !== 'pending'}
className="mt-5 w-full rounded-lg bg-violet-300 px-4 py-3 font-semibold text-slate-950 disabled:cursor-not-allowed disabled:bg-white/8 disabled:text-slate-500"
>
{submitting ? 'Revalidating…' : proposal.status === 'pending' ? 'Approve once and execute' : `Proposal ${proposal.status}`}
</button>
</div>
</section>
</div>
</main>
);
}

View File

@ -0,0 +1,74 @@
interface Report {
id: number;
execution_id: number;
scope: string;
target: string;
outcome: string;
findings: string;
diagnostic: string;
five_whys_json: string;
mitigation: string;
validation: string;
recommendation: string;
before_evidence_json: string;
after_evidence_json: string;
execution_output: string;
approved_by: string;
created_at: string;
}
function list(value: string): string[] {
try {
const parsed = JSON.parse(value);
return Array.isArray(parsed) ? parsed.map(String) : [];
} catch {
return [];
}
}
export default function ReportPage({ report }: { report: Report }) {
return (
<main className="min-h-screen bg-[#071019] px-5 py-8 text-slate-100">
<div className="mx-auto max-w-5xl">
<p className="text-xs uppercase tracking-[0.2em] text-cyan-300">Evidence-backed incident report</p>
<div className="mt-3 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">
<h1 className="text-3xl font-semibold">{report.scope} / {report.target}</h1>
<span className="w-fit rounded-md border border-cyan-300/20 bg-cyan-300/10 px-3 py-1 text-xs uppercase text-cyan-200">
{report.outcome}
</span>
</div>
<div className="mt-8 grid gap-4">
{[
['Findings', report.findings],
['Diagnostic', report.diagnostic],
['Mitigation', report.mitigation],
['Validation', report.validation],
['Recommendation', report.recommendation],
].map(([heading, body]) => (
<section key={heading} className="rounded-2xl border border-white/10 bg-[#0a141e] p-6">
<h2 className="text-xs uppercase tracking-[0.18em] text-cyan-200">{heading}</h2>
<p className="mt-3 text-sm leading-6 text-slate-400">{body}</p>
</section>
))}
<section className="rounded-2xl border border-white/10 bg-[#0a141e] p-6">
<h2 className="text-xs uppercase tracking-[0.18em] text-cyan-200">Five Whys</h2>
<ol className="mt-3 space-y-3 text-sm leading-6 text-slate-400">
{list(report.five_whys_json).map((item, index) => <li key={item}>{index + 1}. {item}</li>)}
</ol>
</section>
<section className="rounded-2xl border border-white/10 bg-[#0a141e] p-6">
<h2 className="text-xs uppercase tracking-[0.18em] text-cyan-200">Bounded execution output</h2>
<pre className="mt-3 max-h-80 overflow-auto whitespace-pre-wrap rounded-xl bg-black/20 p-4 text-xs leading-5 text-slate-400">
{report.execution_output || 'No execution output was returned.'}
</pre>
</section>
</div>
<p className="mt-6 text-xs text-slate-600">Approved by {report.approved_by} · report {report.id} · execution {report.execution_id}</p>
</div>
</main>
);
}

View File

@ -1,6 +1,16 @@
import { router } from '@inertiajs/react';
interface Props {
laravelVersion: string;
overview: Overview;
operator: Operator;
}
interface Operator {
authenticated: boolean;
name?: string;
email?: string;
role?: string;
}
interface StatusRow {
@ -176,7 +186,7 @@ function LiveOverview({ overview }: { overview: Overview }) {
);
}
export default function Welcome({ laravelVersion, overview }: Props) {
export default function Welcome({ laravelVersion, overview, operator }: Props) {
return (
<main className="min-h-screen bg-[#071019] text-slate-100 selection:bg-cyan-300 selection:text-slate-950">
<div className="pointer-events-none fixed inset-0 bg-[radial-gradient(circle_at_15%_10%,rgba(34,211,238,0.10),transparent_25%),radial-gradient(circle_at_85%_20%,rgba(99,102,241,0.12),transparent_28%)]" />
@ -191,6 +201,19 @@ export default function Welcome({ laravelVersion, overview }: Props) {
</div>
</div>
<div className="flex items-center gap-3 text-xs">
{operator.authenticated ? (
<button
type="button"
onClick={() => router.post('/logout')}
className="rounded-full border border-white/10 px-3 py-1.5 text-slate-300 hover:border-cyan-300/40 hover:text-cyan-200"
>
{operator.name} · sign out
</button>
) : (
<a href="/login" className="rounded-full border border-cyan-300/30 px-3 py-1.5 text-cyan-200 hover:bg-cyan-300/10">
Operator sign in
</a>
)}
<span className="hidden rounded-full border border-cyan-300/30 bg-cyan-300/10 px-3 py-1.5 text-cyan-200 sm:inline">
Read-only live view
</span>

View File

@ -3,17 +3,35 @@ package routes
import (
"net/http"
"go.laravel.com/auth"
"go.laravel.com/config"
"go.laravel.com/routing"
"go.laravel.com/web"
"app/handlers/authentication"
"app/handlers/demo"
"app/handlers/execution"
"app/handlers/incident"
"app/handlers/proposal"
"app/handlers/report"
"app/handlers/welcome"
appmiddleware "app/middleware"
)
func Web(route *routing.Router, cfg *config.Config) {
route.Get("/", welcome.Show)
route.Get("/incidents/{scope}/{target}", incident.Show)
route.Get("/demo", demo.Show)
route.Get("/login", authentication.Login).Name("login")
route.Get("/auth/dex/callback", authentication.Callback)
route.Post("/logout", authentication.Logout).Middleware(auth.Authenticate{}, appmiddleware.Operator{})
operator := route.Middleware(auth.Authenticate{}, appmiddleware.Operator{})
operator.Get("/incidents/{scope}/{target}", incident.Show)
operator.Post("/incidents/{scope}/{target}/proposals", proposal.Store)
operator.Get("/proposals/{proposal}", proposal.Show)
operator.Post("/proposals/{proposal}/approval", proposal.Approve)
operator.Get("/executions/{execution}", execution.Show)
operator.Get("/reports/{report}", report.Show)
route.Fallback(func(*web.Request) *web.Response {
return web.Abort(http.StatusNotFound)

View File

@ -3,6 +3,7 @@ package services
import (
"bytes"
"context"
"crypto/sha256"
"encoding/json"
"errors"
"fmt"
@ -187,29 +188,87 @@ type execution struct {
ID string `json:"id"`
Status string `json:"status"`
Output string `json:"output"`
Error string `json:"error"`
}
type RemoteExecution struct {
ID string `json:"id"`
Status string `json:"status"`
Output string `json:"output"`
Error string `json:"error"`
}
func (client *JeannieClient) CommandAllowed(ctx context.Context, command string) (bool, error) {
var response struct {
Commands []string `json:"commands"`
}
if err := client.request(ctx, http.MethodGet, "/v1/commands", nil, &response); err != nil {
return false, err
}
for _, allowed := range response.Commands {
if allowed == command {
return true, nil
}
}
return false, nil
}
func (client *JeannieClient) Submit(ctx context.Context, command string, args []string) (RemoteExecution, error) {
payload, err := json.Marshal(map[string]any{"command": command, "args": args})
if err != nil {
return RemoteExecution{}, err
}
var submitted RemoteExecution
if err := client.request(ctx, http.MethodPost, "/v1/execute", bytes.NewReader(payload), &submitted); err != nil {
return RemoteExecution{}, err
}
if submitted.ID == "" {
return RemoteExecution{}, errors.New("Jeannie API returned an empty execution ID")
}
return submitted, nil
}
func (client *JeannieClient) Execution(ctx context.Context, id string) (RemoteExecution, error) {
if !kubernetesApplicationName.MatchString(id) {
return RemoteExecution{}, errors.New("invalid Jeannie execution ID")
}
var current RemoteExecution
if err := client.request(ctx, http.MethodGet, "/v1/executions/"+id, nil, &current); err != nil {
return RemoteExecution{}, err
}
current.Output = cleanExcerpt(current.Output, 12000)
current.Error = cleanExcerpt(current.Error, 1200)
return current, nil
}
func EvidenceFingerprint(incident IncidentSnapshot) (string, error) {
payload, err := json.Marshal(struct {
Scope string `json:"scope"`
Target string `json:"target"`
Evidence []IncidentEvidence `json:"evidence"`
}{incident.Scope, incident.Target, incident.Evidence})
if err != nil {
return "", err
}
hash := sha256.Sum256(payload)
return fmt.Sprintf("%x", hash[:]), nil
}
func (client *JeannieClient) execute(ctx context.Context, command string, args []string, timeout time.Duration) (execution, error) {
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
payload, err := json.Marshal(map[string]any{"command": command, "args": args})
submitted, err := client.Submit(ctx, command, args)
if err != nil {
return execution{}, fmt.Errorf("encode %s request: %w", command, err)
}
var submitted execution
if err := client.request(ctx, http.MethodPost, "/v1/execute", bytes.NewReader(payload), &submitted); err != nil {
return execution{}, fmt.Errorf("submit %s request: %w", command, err)
}
if submitted.ID == "" {
return execution{}, errors.New("Jeannie API returned an empty execution ID")
}
for {
var current execution
if err := client.request(ctx, http.MethodGet, "/v1/executions/"+submitted.ID, nil, &current); err != nil {
remote, err := client.Execution(ctx, submitted.ID)
if err != nil {
return execution{}, fmt.Errorf("read %s execution: %w", command, err)
}
current := execution(remote)
switch current.Status {
case "queued", "running":
timer := time.NewTimer(client.PollInterval)

View File

@ -0,0 +1,44 @@
package feature_test
import (
"testing"
"go.laravel.com/auth/social"
"go.laravel.com/laraveltest"
"app/tests"
)
func TestDexLoginRequiresAnAllowedVerifiedOperator(t *testing.T) {
client := tests.New(t, laraveltest.Env(map[string]string{
"OPSPROOF_DEX_ISSUER": "https://auth.example.test",
"OPSPROOF_DEX_CLIENT_SECRET": "test-secret",
"OPSPROOF_OPERATOR_EMAILS": "operator@example.test",
}))
client.WithoutRedirects().Get("/incidents/cluster/n8n").AssertRedirect("/login")
allowed := client.FakeSocial("dex", &social.Profile{
ID: "dex-operator",
Name: "Homelab Operator",
Email: "operator@example.test",
EmailVerified: true,
})
allowed.WithoutRedirects().Get("/auth/dex/callback").AssertRedirect("/")
allowed.Get("/").AssertOK().AssertInertia("Welcome").AssertProp("operator.authenticated", true)
}
func TestDexLoginRejectsAnUnlistedIdentity(t *testing.T) {
client := tests.New(t, laraveltest.Env(map[string]string{
"OPSPROOF_DEX_ISSUER": "https://auth.example.test",
"OPSPROOF_DEX_CLIENT_SECRET": "test-secret",
"OPSPROOF_OPERATOR_EMAILS": "operator@example.test",
})).FakeSocial("dex", &social.Profile{
ID: "dex-other",
Name: "Other User",
Email: "other@example.test",
EmailVerified: true,
})
client.Get("/auth/dex/callback").AssertForbidden()
}

View File

@ -0,0 +1,17 @@
package feature_test
import (
"testing"
"go.laravel.com/laraveltest"
"app/tests"
)
func TestPublicDemoUsesSanitizedFixtureWithoutAuthentication(t *testing.T) {
client := tests.New(t, laraveltest.Env(map[string]string{
"OPSPROOF_JEANNIE_URL": "http://127.0.0.1:1",
"OPSPROOF_JEANNIE_TOKEN": "must-not-be-used",
}))
client.Get("/demo").AssertOK().AssertInertia("Demo").AssertProp("demo.outcome", "validated")
}

View File

@ -5,8 +5,10 @@ import (
"net/http/httptest"
"testing"
"app/models"
"app/services"
"app/tests"
"go.laravel.com/laraveltest"
)
func TestIncidentPageRendersDeterministicDoctorEvidence(t *testing.T) {
@ -23,7 +25,9 @@ func TestIncidentPageRendersDeterministicDoctorEvidence(t *testing.T) {
}))
defer server.Close()
client := tests.New(t)
client := tests.New(t, laraveltest.Env(map[string]string{"OPSPROOF_OPERATOR_EMAILS": "operator@example.test"})).ActingAs(&models.User{
ID: 1, Name: "Operator", Email: "operator@example.test",
})
services.From(client.Context()).Jeannie = services.NewJeannieClient(server.URL, "test-token")
client.Get("/incidents/cluster/n8n").AssertOK().AssertInertia("Incident")
}

View File

@ -0,0 +1,56 @@
package feature_test
import (
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"go.laravel.com/laraveltest"
"app/models"
"app/services"
"app/tests"
)
func TestProposalApprovalRevalidatesAndSubmitsExactDoctorAction(t *testing.T) {
doctorRequests := 0
server := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
switch request.URL.Path {
case "/v1/commands":
_, _ = response.Write([]byte(`{"commands":["doctor","status"]}`))
case "/v1/execute":
var payload struct {
Args []string `json:"args"`
}
_ = json.NewDecoder(request.Body).Decode(&payload)
if len(payload.Args) == 3 && payload.Args[2] == "--ai" {
_, _ = response.Write([]byte(`{"id":"execution-approved","status":"queued"}`))
return
}
doctorRequests++
_, _ = response.Write([]byte(`{"id":"doctor-` + string(rune('0'+doctorRequests)) + `","status":"queued"}`))
case "/v1/executions/doctor-1", "/v1/executions/doctor-2", "/v1/executions/doctor-3":
_, _ = response.Write([]byte(`{"id":"doctor","status":"failed","output":"{\"title\":\"Doctor\",\"rows\":[{\"status\":\"fail\",\"area\":\"Kubernetes apps\",\"check\":\"n8n\",\"summary\":\"CrashLoopBackOff\",\"detail\":\"container exits\",\"cause\":\"startup failure\"}]}"}`))
case "/v1/executions/execution-approved":
_, _ = response.Write([]byte(`{"id":"execution-approved","status":"succeeded","output":"repair completed"}`))
default:
http.NotFound(response, request)
}
}))
defer server.Close()
client := tests.New(t, laraveltest.Env(map[string]string{"OPSPROOF_OPERATOR_EMAILS": "operator@example.test"})).ActingAs(&models.User{
ID: 1, Name: "Operator", Email: "operator@example.test",
})
services.From(client.Context()).Jeannie = services.NewJeannieClient(server.URL, "test-token")
client.WithoutRedirects().Post("/incidents/cluster/n8n/proposals", url.Values{
"rollback": {"Restore the previous deployment revision and verify pod readiness."},
}).AssertRedirect("/proposals/1")
client.Get("/proposals/1").AssertOK().AssertInertia("Proposal")
client.WithoutRedirects().Post("/proposals/1/approval", url.Values{}).AssertRedirect("/executions/1")
client.Get("/executions/1").AssertOK().AssertInertia("Execution").AssertProp("view.execution.status", "succeeded").AssertProp("view.execution.report_id", float64(1))
client.Get("/reports/1").AssertOK().AssertInertia("Report").AssertProp("report.outcome", "needs-attention")
}

View File

@ -19,6 +19,7 @@ locals {
searxng_server_name = "search.${var.server_name}"
privatebin_server_name = "paste.${var.server_name}"
miniflux_server_name = "feeds.${var.server_name}"
opsproof_server_name = "opsproof.${var.server_name}"
heimdall_backend_host = var.heimdall_backend_host != "" ? var.heimdall_backend_host : var.gitea_backend_host
homepage_backend_host = var.homepage_backend_host != "" ? var.homepage_backend_host : var.gitea_backend_host
oidc_backend_host = (
@ -28,13 +29,14 @@ locals {
searxng_backend_host = var.searxng_backend_host != "" ? var.searxng_backend_host : var.gitea_backend_host
privatebin_backend_host = var.privatebin_backend_host != "" ? var.privatebin_backend_host : var.gitea_backend_host
miniflux_backend_host = var.miniflux_backend_host != "" ? var.miniflux_backend_host : var.gitea_backend_host
opsproof_backend_host = var.opsproof_backend_host != "" ? var.opsproof_backend_host : var.gitea_backend_host
jeannie_api_server_name = "api.${var.server_name}"
office_server_name = var.office_server_name
office_onlyoffice_server_name = var.office_onlyoffice_server_name
matrix_server_names = var.matrix_enabled ? [var.matrix_server_name, var.element_server_name] : []
monitoring_names = var.monitoring_backend_host != "" ? ["grafana.${var.server_name}", "prometheus.${var.server_name}", "alertmanager.${var.server_name}"] : []
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names))
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)]
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.opsproof_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names))
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.opsproof_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)]
default_conf = templatefile("${path.module}/templates/default.conf.tftpl", {
server_name = var.server_name
monitoring_backend_host = var.monitoring_backend_host
@ -66,6 +68,9 @@ locals {
miniflux_server_name = local.miniflux_server_name
miniflux_backend_host = local.miniflux_backend_host
miniflux_backend_port = tostring(var.miniflux_backend_port)
opsproof_server_name = local.opsproof_server_name
opsproof_backend_host = local.opsproof_backend_host
opsproof_backend_port = tostring(var.opsproof_backend_port)
jeannie_api_server_name = local.jeannie_api_server_name
jeannie_api_backend_host = var.jeannie_api_backend_host
jeannie_api_backend_port = tostring(var.jeannie_api_backend_port)

View File

@ -118,7 +118,7 @@ server {
server {
listen 80;
server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${searxng_server_name} ${privatebin_server_name} ${miniflux_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name};
server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${searxng_server_name} ${privatebin_server_name} ${miniflux_server_name} ${opsproof_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name};
location ^~ /.well-known/acme-challenge/ {
root /var/www/certbot;
@ -131,6 +131,48 @@ server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name}
}
}
server {
listen 443 ssl;
http2 on;
server_name ${opsproof_server_name};
ssl_certificate /etc/nginx/certs/current.crt;
ssl_certificate_key /etc/nginx/certs/current.key;
ssl_protocols TLSv1.2 TLSv1.3;
if ($blocked_uris) { return 403; }
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy no-referrer;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()";
location = / {
return 302 /demo;
}
location = /demo {
proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port};
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
add_header Cache-Control "no-store";
}
location ^~ /build/ {
proxy_pass http://${opsproof_backend_host}:${opsproof_backend_port};
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
expires 1h;
}
location / {
return 404;
}
}
server {
listen 443 ssl;
http2 on;

View File

@ -255,6 +255,16 @@ variable "miniflux_backend_port" {
default = 8890
}
variable "opsproof_backend_host" {
type = string
default = ""
}
variable "opsproof_backend_port" {
type = number
default = 8891
}
variable "jeannie_api_backend_host" {
type = string
default = ""

View File

@ -641,7 +641,9 @@ is missing. Default is to fail and ask for host bootstrap.
`LAB_OPSPROOF_INSTALL_DIR`, `LAB_OPSPROOF_HTTP_PORT`, `LAB_OPSPROOF_BIND_IP`
: Override the OpsProof data root, HTTP port, and listen address. Defaults are
`/data/homelab-opsproof`, `8891`, and `127.0.0.1`.
`/data/homelab-opsproof`, `8891`, and `127.0.0.1`. The canonical inventory uses
`0.0.0.0` so the OCI edge can reach only the separately restricted public demo
route over Tailscale.
`LAB_OPSPROOF_GO_VERSION`, `LAB_OPSPROOF_GO_SHA256`
: Pin the isolated Go toolchain used only to build OpsProof. The archive is

View File

@ -61,6 +61,9 @@ confirmed by deterministic validation.
- Store the Jeannie bearer token server-side only.
- Use Dex OIDC for operator mode; never expose operator actions in public demo
mode.
- Give OpsProof its own generated Dex client secret, use authorization code
with PKCE, require a verified email, and re-check the operator allowlist on
every protected request rather than treating a past login as authorization.
- Fail closed when Jeannie is unreachable or its advertised command surface
differs from the proposal.
- Collect the overview through Jeannie's authenticated, read-only status
@ -72,6 +75,17 @@ confirmed by deterministic validation.
Keep the proposal blocked when identity, current-evidence validation, or a
target-specific rollback is absent; rendering a command never grants the
authority to execute it.
- Persist proposals, approvals, and execution IDs separately. An approval is
single-use and valid only when freshly collected evidence has the same hash,
the command remains advertised by Jeannie, and its arguments still match the
constrained target. Progress reads the recorded execution; it never retries
the state-changing POST.
- Run the focused Doctor target once after a terminal execution and write a
durable before/after report. Preserve a failed validation as an explicit
outcome rather than inferring success from the execution status alone.
- Keep the public portfolio route fixture-only. The OCI edge may proxy `/demo`
and `/build/`, but must return 404 for login, incident, proposal, execution,
report, and every other application route.
## Why not Laravel Rust now?

View File

@ -25,6 +25,7 @@ Update `homelab.yml`, then run `scripts/render-service-catalog`.
| SearXNG | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-searxng | [local](http://192.168.100.73:8888/) | [public](https://search.lab2025.duckdns.org/) | `infra/searxng/README.md` |
| PrivateBin | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-privatebin | [local](http://192.168.100.73:8889/) | [public](https://paste.lab2025.duckdns.org/) | `infra/privatebin/README.md` |
| Miniflux | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-miniflux | [local](http://192.168.100.73:8890/) | [public](https://feeds.lab2025.duckdns.org/) | `infra/miniflux/README.md` |
| OpsProof public demo | debian (control-plane, 192.168.100.73) | systemd / jeannie deploy-opsproof | [local](http://192.168.100.73:8891/) | [public](https://opsproof.lab2025.duckdns.org/) | `apps/opsproof/README.md` |
| GitOps mirror | debian (control-plane, 192.168.100.73) | Bare Git repository | `/home/jv/git-server/my-homelab-configs.git` | [public](ssh://jv@192.168.100.73/home/jv/git-server/my-homelab-configs.git) | `README.md#gitops-and-gitea-actions` |
| Container Registry | debian (control-plane, 192.168.100.73) | Argo CD / apps/container-registry | [local](http://192.168.100.73:30500/v2/_catalog) | | `apps/container-registry/` |
| Traefik | Kubernetes | OpenTofu / bootstrap/platform | [local](http://192.168.100.240/) | [public](https://lab2025.duckdns.org) | `README.md#loadbalancer-services` |

View File

@ -33,6 +33,7 @@ domain:
- search.lab2025.duckdns.org
- paste.lab2025.duckdns.org
- feeds.lab2025.duckdns.org
- opsproof.lab2025.duckdns.org
network:
lan_cidr: 192.168.100.0/24
@ -208,6 +209,13 @@ services:
install_dir: /data/homelab-miniflux
http_port: 8890
public_url: https://feeds.lab2025.duckdns.org/
opsproof:
host: debian
install_dir: /data/homelab-opsproof
http_port: 8891
bind_ip: 0.0.0.0
public_url: http://192.168.100.73:8891/
demo_public_url: https://opsproof.lab2025.duckdns.org/
gitops_mirror:
host: debian
path: /home/jv/git-server/my-homelab-configs.git

View File

@ -76,6 +76,11 @@ mapping = {
"services.miniflux.install_dir": "LAB_MINIFLUX_INSTALL_DIR",
"services.miniflux.http_port": "LAB_MINIFLUX_HTTP_PORT",
"services.miniflux.public_url": "LAB_MINIFLUX_PUBLIC_URL",
"services.opsproof.install_dir": "LAB_OPSPROOF_INSTALL_DIR",
"services.opsproof.http_port": "LAB_OPSPROOF_HTTP_PORT",
"services.opsproof.bind_ip": "LAB_OPSPROOF_BIND_IP",
"services.opsproof.public_url": "LAB_OPSPROOF_PUBLIC_URL",
"services.opsproof.demo_public_url": "LAB_OPSPROOF_DEMO_PUBLIC_URL",
"services.local_registry.endpoint": "LAB_REGISTRY_ENDPOINT",
"services.ollama.url": "LAB_OLLAMA_URL",
"services.ollama.bind_address": "LAB_OLLAMA_BIND_ADDRESS",
@ -243,6 +248,7 @@ for service_name, env_name in [
("searxng", "LAB_SEARXNG_BACKEND_HOST"),
("privatebin", "LAB_PRIVATEBIN_BACKEND_HOST"),
("miniflux", "LAB_MINIFLUX_BACKEND_HOST"),
("opsproof", "LAB_OPSPROOF_BACKEND_HOST"),
]:
service_lan = service_host_value(service_name, "lan_ip") or services_host_lan
service_tailscale = service_host_value(service_name, "tailscale_ip") or services_host_tailscale
@ -358,6 +364,8 @@ export_homelab_inventory_tf_vars() {
export_if_unset TF_VAR_privatebin_backend_port "${LAB_PRIVATEBIN_HTTP_PORT:-8889}"
export_if_unset TF_VAR_miniflux_backend_host "${LAB_MINIFLUX_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
export_if_unset TF_VAR_miniflux_backend_port "${LAB_MINIFLUX_HTTP_PORT:-8890}"
export_if_unset TF_VAR_opsproof_backend_host "${LAB_OPSPROOF_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
export_if_unset TF_VAR_opsproof_backend_port "${LAB_OPSPROOF_HTTP_PORT:-8891}"
export_if_unset TF_VAR_office_server_name "${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}"
export_if_unset TF_VAR_office_backend_host "${LAB_OFFICE_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}"
export_if_unset TF_VAR_office_backend_port "${LAB_OFFICE_HTTP_PORT:-8090}"

View File

@ -1078,8 +1078,22 @@ render_dex_config() {
local office_client_secret="${12:-}"
local argocd_public_url="${13:-}"
local argocd_client_secret="${14:-}"
local opsproof_public_url="${15:-}"
local opsproof_client_secret="${16:-}"
local office_client_block=""
local argocd_client_block=""
local opsproof_client_block=""
if [[ -n "${opsproof_public_url}" && -n "${opsproof_client_secret}" ]]; then
opsproof_client_block="$(cat <<OPSPROOF_CLIENT_EOF
- id: opsproof
name: OpsProof
secret: "${opsproof_client_secret}"
redirectURIs:
- ${opsproof_public_url%/}/auth/dex/callback
OPSPROOF_CLIENT_EOF
)"
fi
if [[ -n "${argocd_public_url}" && -n "${argocd_client_secret}" ]]; then
argocd_client_block="$(cat <<ARGOCD_CLIENT_EOF
@ -1137,6 +1151,7 @@ staticClients:
- ${gitea_public_url}/user/oauth2/${gitea_source_name}/callback
${office_client_block}
${argocd_client_block}
${opsproof_client_block}
staticPasswords:
- email: "${user_email}"
@ -1169,6 +1184,9 @@ deploy_dex() {
local dex_uid="${LAB_DEX_CONTAINER_UID:-1001}"
local dex_gid="${LAB_DEX_CONTAINER_GID:-1001}"
local elapsed=0
local opsproof_oidc_env="${LAB_OPSPROOF_INSTALL_DIR:-/data/homelab-opsproof}/.oidc.env"
local opsproof_public_url=""
local opsproof_client_secret=""
require_debian_server "deploy-dex"
@ -1202,6 +1220,10 @@ deploy_dex() {
dex_env="$(dex_secret_values)" || exit 1
eval "${dex_env}"
office_client_secret="${office_client_secret:-${DEX_OFFICE_CLIENT_SECRET:-}}"
if [[ -r "${opsproof_oidc_env}" ]]; then
opsproof_public_url="$(sed -n 's/^OPSPROOF_PUBLIC_URL=//p' "${opsproof_oidc_env}" | head -n 1)"
opsproof_client_secret="$(sed -n 's/^OPSPROOF_DEX_CLIENT_SECRET=//p' "${opsproof_oidc_env}" | head -n 1)"
fi
echo "Deploying Dex on the Debian host at ${install_dir}..."
@ -1231,7 +1253,9 @@ deploy_dex() {
"${office_public_url}" \
"${office_client_secret}" \
"${LAB_ARGOCD_PUBLIC_URL:-https://argocd.${LAB_DOMAIN:-lab2025.duckdns.org}}" \
"${DEX_ARGOCD_CLIENT_SECRET:-}" |
"${DEX_ARGOCD_CLIENT_SECRET:-}" \
"${opsproof_public_url}" \
"${opsproof_client_secret}" |
sudo tee "${install_dir}/config.yaml" >/dev/null
sudo chown "${dex_uid}:${dex_gid}" "${install_dir}/config.yaml"
sudo chown -R "${dex_uid}:${dex_gid}" "${data_dir}"
@ -5670,6 +5694,7 @@ deploy_opsproof() {
local install_dir="${LAB_OPSPROOF_INSTALL_DIR:-/data/homelab-opsproof}"
local http_port="${LAB_OPSPROOF_HTTP_PORT:-8891}"
local bind_ip="${LAB_OPSPROOF_BIND_IP:-127.0.0.1}"
local health_ip="${LAB_OPSPROOF_BIND_IP:-127.0.0.1}"
local go_version="${LAB_OPSPROOF_GO_VERSION:-1.27.4}"
local go_sha256="${LAB_OPSPROOF_GO_SHA256:-7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840}"
local starter_commit="${LAB_OPSPROOF_STARTER_COMMIT:-6dd8bd22b9d335e55b190aa16f3271e73c97cd25}"
@ -5694,12 +5719,21 @@ deploy_opsproof() {
local postgres_uid=""
local postgres_gid=""
local database_url=""
local oidc_env="${install_dir}/.oidc.env"
local oidc_secret=""
local public_url="${LAB_OPSPROOF_PUBLIC_URL:-http://${bind_ip}:${http_port}}"
local operator_emails="${LAB_OPSPROOF_OPERATOR_EMAILS:-}"
local opsproof_dex_values=""
local elapsed=0
local node_major=""
local required
require_debian_server "deploy-opsproof"
if [[ "${health_ip}" == "0.0.0.0" || "${health_ip}" == "::" ]]; then
health_ip="127.0.0.1"
fi
if ! [[ "${http_port}" =~ ^[0-9]+$ ]] || ((http_port < 1 || http_port > 65535)); then
echo "LAB_OPSPROOF_HTTP_PORT must be a valid TCP port." >&2
return 1
@ -5739,6 +5773,19 @@ deploy_opsproof() {
echo "LAB_OPSPROOF_JEANNIE_URL must be an HTTP or HTTPS URL." >&2
return 1
fi
if ! [[ "${public_url}" =~ ^https?://[^[:space:]]+$ ]]; then
echo "LAB_OPSPROOF_PUBLIC_URL must be an HTTP or HTTPS URL." >&2
return 1
fi
if [[ -z "${operator_emails}" ]]; then
opsproof_dex_values="$(dex_secret_values)" || return 1
eval "${opsproof_dex_values}"
operator_emails="${DEX_USER_EMAIL:-}"
fi
if [[ -z "${operator_emails}" || "${operator_emails}" == *[[:space:]]* ]]; then
echo "LAB_OPSPROOF_OPERATOR_EMAILS must contain a comma-separated operator email allowlist without spaces." >&2
return 1
fi
if [[ -z "${jeannie_api_token}" || "${jeannie_api_token}" == *[[:space:]]* ]]; then
echo "OpsProof requires the Jeannie API token through LAB_OPSPROOF_JEANNIE_TOKEN, JEANNIE_SERVER_TOKEN, or ${jeannie_api_env}." >&2
return 1
@ -5762,6 +5809,21 @@ deploy_opsproof() {
sudo install -d -o "${service_user}" -g "${service_user}" -m 0750 \
"${install_dir}" "${install_dir}/releases" "${install_dir}/toolchains"
if [[ -s "${oidc_env}" ]]; then
oidc_secret="$(sed -n 's/^OPSPROOF_DEX_CLIENT_SECRET=//p' "${oidc_env}" | head -n 1)"
fi
if ! [[ "${oidc_secret}" =~ ^[[:xdigit:]]{64}$ ]]; then
oidc_secret="$(openssl rand -hex 32)"
fi
umask 077
printf '%s\n' \
"OPSPROOF_PUBLIC_URL=${public_url%/}" \
"OPSPROOF_DEX_CLIENT_SECRET=${oidc_secret}" >"${oidc_env}"
chmod 0600 "${oidc_env}"
# Dex owns the OAuth client registry. Re-render it from the committed
# encrypted source plus this private generated client secret.
deploy_dex
sudo install -d -m 0700 "${install_dir}/postgres"
if ! sudo docker image inspect "${postgres_image}" >/dev/null 2>&1; then
@ -5879,12 +5941,16 @@ COMPOSE_EOF
"APP_ENV=production" \
"APP_KEY=${app_key}" \
"APP_DEBUG=false" \
"APP_URL=http://${bind_ip}:${http_port}" \
"APP_URL=${public_url%/}" \
"SERVER_HOST=${bind_ip}" \
"SERVER_PORT=${http_port}" \
"DATABASE_URL=${database_url}" \
"OPSPROOF_JEANNIE_URL=${jeannie_api_url}" \
"OPSPROOF_JEANNIE_TOKEN=${jeannie_api_token}" \
"OPSPROOF_DEX_ISSUER=$(dex_public_url | sed 's:/*$::')" \
"OPSPROOF_DEX_CLIENT_SECRET=${oidc_secret}" \
"OPSPROOF_DEX_REDIRECT_URL=${public_url%/}/auth/dex/callback" \
"OPSPROOF_OPERATOR_EMAILS=${operator_emails}" \
"SESSION_DRIVER=memory" \
"CACHE_STORE=memory" \
"QUEUE_CONNECTION=sync" \
@ -5929,9 +5995,9 @@ UNIT_EOF
sudo systemctl enable opsproof.service
sudo systemctl restart opsproof.service
until curl -fsS --connect-timeout 3 "http://${bind_ip}:${http_port}/up" >/dev/null; do
until curl -fsS --connect-timeout 3 "http://${health_ip}:${http_port}/up" >/dev/null; do
if ((elapsed >= 90)); then
echo "Timed out waiting for OpsProof on http://${bind_ip}:${http_port}/up" >&2
echo "Timed out waiting for OpsProof on http://${health_ip}:${http_port}/up" >&2
sudo systemctl status opsproof.service --no-pager >&2 || true
sudo journalctl -u opsproof.service -n 120 --no-pager >&2 || true
return 1

View File

@ -152,6 +152,14 @@ def service_rows(values: dict[str, object]) -> list[dict[str, str]]:
"public": value(values, "services.miniflux.public_url", f"https://feeds.{domain}/"),
"docs": "infra/miniflux/README.md",
},
{
"name": "OpsProof public demo",
"host": value(values, "services.opsproof.host", "debian"),
"managed_by": "systemd / jeannie deploy-opsproof",
"local": value(values, "services.opsproof.public_url", f"http://{debian_ip}:8891/"),
"public": value(values, "services.opsproof.demo_public_url", f"https://opsproof.{domain}/"),
"docs": "apps/opsproof/README.md",
},
{
"name": "GitOps mirror",
"host": value(values, "services.gitops_mirror.host", "debian"),

View File

@ -70,6 +70,8 @@ class OpsProofPipelineTests(unittest.TestCase):
self.assertNotIn('"CACHE_STORE=file"', pipeline)
self.assertIn('"OPSPROOF_JEANNIE_URL=${jeannie_api_url}"', pipeline)
self.assertIn('"OPSPROOF_JEANNIE_TOKEN=${jeannie_api_token}"', pipeline)
self.assertIn('"OPSPROOF_DEX_CLIENT_SECRET=${oidc_secret}"', pipeline)
self.assertIn('"OPSPROOF_OPERATOR_EMAILS=${operator_emails}"', pipeline)
self.assertIn("JEANNIE_SERVER_TOKEN=//p", pipeline)
self.assertIn('"${release_dir}/opsproof" migrate --force', pipeline)
self.assertIn(
@ -128,13 +130,73 @@ class OpsProofPipelineTests(unittest.TestCase):
self.assertIn("Remediation proposal", incident)
self.assertIn("Risk review", incident)
self.assertIn("Deterministic validation", incident)
self.assertIn("Approval unavailable until identity", incident)
self.assertIn("Create durable proposal", incident)
self.assertNotIn("fetch('/v1/execute", incident)
self.assertIn("ReadyForApproval bool", client)
self.assertIn('proposal.Status = "blocked"', client)
self.assertIn('"./jeannie doctor cluster " + incident.Target + " --ai"', client)
auth_handler = (
ROOT / "apps/opsproof/overlay/handlers/authentication/authentication.go"
).read_text(encoding="utf-8")
self.assertIn("profile.VerifiedEmail()", auth_handler)
self.assertIn("operatorAllowed(email)", auth_handler)
self.assertIn("auth.Login", auth_handler)
routes = (ROOT / "apps/opsproof/overlay/routes/web.go").read_text(
encoding="utf-8"
)
self.assertIn('route.Get("/login"', routes)
self.assertIn('route.Get("/demo"', routes)
self.assertIn("auth.Authenticate{}", routes)
self.assertIn("appmiddleware.Operator{}", routes)
self.assertIn('operator.Post("/incidents/{scope}/{target}/proposals"', routes)
self.assertIn('operator.Post("/proposals/{proposal}/approval"', routes)
self.assertIn('operator.Get("/executions/{execution}"', routes)
self.assertIn('operator.Get("/reports/{report}"', routes)
proposal_handler = (ROOT / "apps/opsproof/overlay/handlers/proposal/proposal.go").read_text(
encoding="utf-8"
)
self.assertIn("EvidenceFingerprint", proposal_handler)
self.assertIn("CommandAllowed", proposal_handler)
self.assertIn("LockForUpdate", proposal_handler)
self.assertIn('arguments[2] != "--ai"', proposal_handler)
migration = (
ROOT
/ "apps/opsproof/overlay/database/migrations/2026_12_04_000003_create_opsproof_workflow_tables.go"
).read_text(encoding="utf-8")
self.assertIn('"remediation_proposals"', migration)
self.assertIn('"remediation_approvals"', migration)
self.assertIn('"operation_executions"', migration)
execution_page = (
ROOT / "apps/opsproof/overlay/resources/js/pages/Execution.tsx"
).read_text(encoding="utf-8")
self.assertIn("Open incident report", execution_page)
report_page = (
ROOT / "apps/opsproof/overlay/resources/js/pages/Report.tsx"
).read_text(encoding="utf-8")
self.assertIn("Evidence-backed incident report", report_page)
self.assertIn("Five Whys", report_page)
self.assertIn("Bounded execution output", report_page)
demo_handler = (
ROOT / "apps/opsproof/overlay/handlers/demo/show.go"
).read_text(encoding="utf-8")
self.assertIn("Sanitized fixture only", demo_handler)
self.assertNotIn("Jeannie.", demo_handler)
edge = (ROOT / "bootstrap/edge/templates/default.conf.tftpl").read_text(
encoding="utf-8"
)
self.assertIn("server_name ${opsproof_server_name}", edge)
self.assertIn("location = /demo", edge)
self.assertIn("location ^~ /build/", edge)
if __name__ == "__main__":
unittest.main()