Contour Envoy xDS Config NACK and Sync Delay Sentinel
Audits Project Contour ingress controller for Envoy xDS configuration NACKs, CDS sync delay, and proxy disconnects.
Audit SurrealDB ACCESS methods for refresh grants that never expire, alert on breach, and record flagged methods for review.
SurrealDB's own documentation calls out DURATION FOR GRANT NONE by name: a refresh
token grant configured this way never expires. That is a deliberate, named capability,
not a bug - but left in place on an ACCESS method nobody is actively reviewing, it is
exactly the kind of standing risk a compliance program or security review will flag
sooner or later. This blueprint runs INFO FOR DB, SurrealDB's own system-introspection
statement, finds any ACCESS method configured this way, alerts Slack on breach, and can
write an audit-trail record naming the flagged method for review - never altering the
ACCESS method's own definition.
periodic_grant_check (io.kestra.plugin.core.trigger.Schedule) runs every 6 hours, always forcing auto_remediate: "false" and dry_run: "true" through its own inputs: override regardless of this flow's defaults. Shipped disabled so you can validate a manual run first.audit_access_grants (io.kestra.plugin.surrealdb.Query) runs INFO FOR DB; with fetchType: STORE, returning a uri to the stored result - SurrealDB's own accesses map, keyed by access method name, each value being the re-serialized DEFINE ACCESS statement text.evaluate_access_risk (io.kestra.plugin.scripts.python.Script) reads that stored result and collects every access method whose definition text contains FOR GRANT NONE, emitting unbounded_count and unbounded_accesses through Kestra.outputs.evaluate_access_gate (io.kestra.plugin.core.flow.If) flags a breach whenever unbounded_count > max_unbounded_grants.then (breach): route_remediation (io.kestra.plugin.core.flow.Switch on auto_remediate) either considers remediation ("true", gated again by dry_run through check_dry_run) or only logs that remediation is disabled ("false"). When both gates allow it, record_flagged_access (io.kestra.plugin.core.flow.Loop) runs create_audit_record (io.kestra.plugin.surrealdb.Query, a plain CREATE) for each flagged access method, writing a security_audit_log record. alert_access_risk always fires to Slack regardless of which path ran.else (compliant): log_access_healthy records a clean check.log_audit_complete always runs last, printing the headline numbers regardless of which branch fired.errors block alerts Slack separately if the flow itself fails - an unreachable instance or insufficient privileges must not read as "no breach".security_audit_log record; the flagged ACCESS method's own DURATION settings are never changed by this flow.auto_remediate, dry_run) between "risk detected" and "audit record actually written".RECORD or BEARER access methods for application auth who want unlimited refresh grants caught automatically.INFO FOR DB beyond basic CREATE/SELECT usage.INFO FOR DB is a one-shot introspection query with no memory of the last check, no threshold logic, and no notification path. Kestra supplies the schedule, the risk classification as a first-class branch, two independent authorization gates before anything is written, and an execution history that shows exactly when an unbounded grant first appeared and whether it was flagged for review.
INFO FOR DB and, if remediation runs, CREATE records.Local testing:
docker run -d --name surrealdb-grant-sentinel -p 8001:8000 surrealdb/surrealdb:latest start --user root --pass root
docker network connect YOUR_KESTRA_NETWORK surrealdb-grant-sentinel (only needed if the Kestra Worker runs in a separate Docker network than this container; set surrealdb_host to surrealdb-grant-sentinel from inside that network, or localhost with port 8001 from the host, matching this plugin's connection properties).
SURREALDB_PASSWORD: password for surrealdb_username, matching this plugin's own documented pattern (see surreal-db.yaml).SLACK_WEBHOOK: Slack incoming webhook used by alert_access_risk and the errors block.SECRET_, base64-encoded, and read back in flows with {{ secret('NAME') }} - for example SECRET_SLACK_WEBHOOK=$(echo -n 'https://hooks.slack.com/...' | base64). This keeps credentials out of the flow YAML but, per Kestra's own documentation, offers no encryption at rest or access control beyond the host environment; use the Enterprise secrets backend for stronger guarantees.surrealdb_host (STRING, default localhost): SurrealDB connection host.surrealdb_namespace (STRING, default test): SurrealDB namespace (distinct from the Kestra flow namespace).surrealdb_database (STRING, default test): database audited by INFO FOR DB.surrealdb_username (STRING, default root): account used to run the audit and, if enabled, the remediation.max_unbounded_grants (INT, default 0): breach threshold; 0 means any unbounded-grant access method at all breaches.auto_remediate (SELECT: "false", "true"; default "false"): must be "true" for the audit record to even be considered.dry_run (SELECT: "true", "false"; default "true"): must be explicitly "false", together with auto_remediate: "true", for the record to actually be written.outputs.audit_access_grants.uri: the raw stored INFO FOR DB result for every run.outputs.evaluate_access_risk.vars.unbounded_count / .unbounded_accesses: the computed risk result for every run.DURATION FOR GRANT NONE to produce a realistic breach (see SurrealDB's own DEFINE ACCESS documentation for the full statement syntax).SURREALDB_PASSWORD and SLACK_WEBHOOK secrets.auto_remediate: "false") and confirm alert_access_risk fires naming the expected access method, and that log_remediation_disabled logs without writing anything.auto_remediate: "true" and dry_run: "true" and confirm log_dry_run_remediation describes the audit record without writing it.auto_remediate: "true" and dry_run: "false" and confirm with SELECT * FROM security_audit_log; that the record now exists.periodic_grant_check once you trust the check; it always runs in the safe auto_remediate: "false" / dry_run: "true" mode regardless of what you leave the flow's own defaults set to.INFO FOR ROOT; to catch root-level access methods, not just database-level ones audited here.surrealdb_database values with io.kestra.plugin.core.flow.Loop to sweep multiple databases in one run.Pause approval task instead of (or alongside) the static auto_remediate input, for a human-reviewed record on production databases.ALTER ACCESS confirms support for modifying DURATION, extend create_audit_record into an actual remediation step that bounds the grant duration - this blueprint deliberately only records the risk for review, since that capability was not confirmed from available documentation.STORE output was not confirmed against a live instance. SurrealDB's query protocol typically wraps each statement's result in a per-statement envelope; evaluate_access_risk's script defensively handles both a bare result object and a list-of-statement-results, but this has not been exercised against a running SurrealDB server in this environment.DURATION FOR GRANT NONE is valid, documented syntax - but DURATION FOR TOKEN NONE is explicitly rejected by SurrealDB on record-access methods. Verified from SurrealDB's own documentation: "Record-access authentication tokens are issued to end users and may be passed to third parties, so they must expire. As a result, DURATION FOR TOKEN NONE is rejected." This blueprint only checks FOR GRANT, the one case SurrealDB's docs confirm can legitimately be set to never expire.ALTER ACCESS. Whether ALTER ACCESS supports modifying DURATION was not confirmed from available documentation; remediation here is limited to an additive audit-trail CREATE, never a change to the flagged access method itself.auto_remediate and dry_run are independent gates, not a single boolean. Both must be "true"/"false" respectively for the audit-record Loop to run; setting only one leaves the other still blocking.Switch case keys "true"/"false" are quoted strings. auto_remediate renders as the literal string "true" or "false"; unquoted true:/false: YAML map keys would parse as booleans instead and would not match.