Adam BlansettSenior Full-Stack & AI Engineer
DevOps & Security
11 min read
Adam Blansett

Architecting a Self-Hosted AI IT Administrator: SCIM 2.0 Dry-Run Diffs, Alertmanager Triage, and Zero-Shell Runbooks

Inside the Phase 1 implementation of ai-it-admin: Joiner/Mover/Leaver SCIM 2.0 dry-run provisioning diffs, RFC 7644 BulkRequest export, HMAC Alertmanager webhooks, SaaS/MFA audits, and advisory-only zero-shell runbooks RAG.

IT OperationsSCIM 2.0AlertmanagerRunbooks RAGSSRF DefenseFastAPIAudit Chains

Internal IT and platform engineering teams sit at the intersection of high-volume identity tickets, noisy Alertmanager pages, drifting SaaS entitlements, and tribal operational runbooks. Handing those workflows to an unrestricted AI agent with shell access or live directory credentials creates unacceptable outage and privilege-escalation risk.

When architecting AI IT Administrator Platform (open-source on GitHub), the core engineering principle was strict read-before-write governance: every directory mutation previews as an RFC 7644 SCIM 2.0 diff, every runbook recommendation stays locked to `advisory_only`, and every state change writes to a concurrency-safe SHA-256 audit chain.

Joiner/Mover/Leaver SCIM 2.0 Dry-Run Diffs & RFC 7644 BulkRequest Export#

Under `/api/v1/identity/*`, Joiner, Mover, and Leaver transitions are evaluated against declarative least-privilege role templates rather than ad-hoc prompts. Whenever a request asks for entitlements outside the user's department baseline, the planner flags explicit privilege deviations before generating a deterministic provisioning diff and exporting a standard RFC 7644 SCIM 2.0 `BulkRequest` JSON payload via `/api/v1/identity/plans/{id}/scim-payload`.

No directory state or SaaS license allocation mutates during planning. Execution occurs atomically only after an authorized `it_approver` or `admin` signs off, preventing unreviewed role escalation or accidental offboarding lockouts.

HMAC-Signed Alertmanager Webhooks, Fingerprinting & SaaS Access Audits#

Operational telemetry under `/api/v1/telemetry/*` tracks service latency, error rates, TLS certificate expiry, and quota thresholds while verifying `X-Webhook-Signature` HMAC-SHA256 digests on inbound Alertmanager webhooks. Incoming alerts are hashed into deterministic SHA-256 fingerprints so alert storms collapse into deduplicated incident threads triaged against indexed runbooks.

In parallel, `/api/v1/access-audit/*` continuously reconciles SaaS application rosters against active directory identities and least-privilege templates—surfacing orphaned accounts, stale API tokens older than 90 days, privilege drift, and missing MFA behind human-approved remediation queues.

Zero-Blind-Shell Runbooks RAG, SSRF Guards & Concurrency-Safe Audits#

Incident response teams need fast answers from Markdown runbooks without letting an LLM execute commands behind their back. The `/api/v1/runbooks/*` engine pairs deterministic signed feature-hash vector search with keyword retrieval while enforcing `advisory_only` mode at every boundary:

runbook_safety_guard.py
FORBIDDEN_SHELL_PATTERNS = (
    r"rm\s+-rf", r"curl\s+.*\|\s*(sh|bash)", r"DROP\s+DATABASE",
    r"kubectl\s+delete\s+namespace", r"\$\([^)]+\)", r"`[^`]+`",
)

def inspect_commands_for_safety(draft_text: str) -> tuple[str, list[str]]:
    blocked = [p for p in FORBIDDEN_SHELL_PATTERNS if re.search(p, draft_text, re.I)]
    return ("advisory_only", blocked)
  • Outbound Secret & PII Redaction: `redact_pii()` scrubs PEM private keys, AWS access keys, JWTs, API tokens, and internal IPs before cloud Gemini fallback or outbound Slack/PagerDuty tests.
  • SSRF Webhook Isolation: `validate_webhook_url()` rejects loopback, RFC1918 private subnets, `.internal` hosts, and cloud metadata endpoints on `/api/v1/integrations/webhooks`.
  • Concurrency-Locked Audit Chain & Telemetry: Per-loop `asyncio.Lock` sequence serialization prevents SHA-256 chain forks under concurrent writes, paired with sliding-window `RateLimitMiddleware`, `structlog` JSON logs, and Prometheus `/api/v1/metrics`.
Deployment Readiness: Across 14 tables and 2 Alembic migrations, the FastAPI + async SQLAlchemy 2.0 backend and 6-view React 18 TypeScript console run cleanly with local Ollama models or offline deterministic mocks for CI.

If you are modernizing internal identity workflows or building guarded operations tooling, explore my Software Architecture and AI Engineering services or schedule an architecture call.

Applied Architecture

Production Case Studies & Capabilities

Explore how these engineering patterns are deployed in production systems and available through client engagements.

Case Study

AI IT Administrator Platform

Open-source Python (FastAPI), async SQLAlchemy 2.0 + PostgreSQL/pgvector, and React 18 IT administration control plane featuring Joiner/Mover/Leaver SCIM 2.0 dry-run diffs & RFC 7644 BulkRequest export, HMAC-signed Alertmanager webhooks & alert deduplication, SaaS/MFA access drift audits, zero-blind-shell runbooks RAG, SSRF-guarded Slack/PagerDuty connectors, and a concurrency-locked SHA-256 audit chain.

Read Case Study
Related Engineering Service

Software Architecture & System Design

Fast-moving teams frequently accrue hidden architectural liabilities: tangled domain logic, unmaintainable monoliths, or over-engineered microservices that paralyze development.

Related Engineering Service

AI Engineering & LLM Integration

Many AI initiatives fail in production due to prompt fragility, high token latency, hallucination risks, and lack of structured evaluation. I bridge the gap between experimental LLM prompts and deterministic software engineering.

Frequently Asked Questions

Why separate SCIM 2.0 dry-run diff planning from directory execution?
Joiner, Mover, and Leaver requests regularly touch identity groups, SSO roles, and paid SaaS seats. Computing a dry-run diff against least-privilege templates and exporting an inspectable RFC 7644 BulkRequest payload first lets IT approvers catch privilege deviations before mutating any directory.
How does ai-it-admin prevent an AI runbook assistant from running destructive shell commands?
Remediation drafts never import or invoke subprocess or shell runners and remain locked to advisory_only mode. Before any draft is stored or returned, inspect_commands_for_safety() strips and logs dangerous patterns listed in FORBIDDEN_SHELL_PATTERNS such as rm -rf, curl | bash, DROP DATABASE, and kubectl delete namespace.
How does the platform handle concurrent audit logging and alert storms?
record_audit_event() serializes sequence allocation per event loop with an asyncio.Lock so concurrent requests cannot fork the SHA-256 audit chain, while Alertmanager webhooks deduplicate noisy incidents by deterministic SHA-256 alert fingerprints.
Share this technical guide

Need Help Solving This in Your Application?

I partner with founders, executives, and engineering leaders to design architectures, resolve production bottlenecks, and deliver resilient software.

Related Technical Articles

DevOps & Security
12 min read

Automating Compliance, Data Governance, QA, and IT Operations with Guarded Self-Hosted AI

How deterministic policy scanners, legal-hold DSAR blocks, HKDF/Fernet PII tokenization, SCIM 2.0 dry-run diffs, and OpenAPI E2E test synthesis power internal governance and release engineering safely.

SOC 2 ComplianceData GovernanceSCIM 2.0Release EngineeringPII TokenizationDSARSecurity Scanners
Read Article