Skip to content

apt_guard

Query event collection for an external behavioral-security analysis pipeline

apt_guard · Query event collection for an external behavioral-security analysis pipeline

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102279apt_guardapt_guard1.0SECC

PostgreSQL · 15

Usage

Sources:

apt_guard 1.0 records database activity for a research behavioral-security pipeline. The upstream container uses PostgreSQL 15. The native module collects events; external Python and machine-learning services provide the surrounding analysis and mitigation workflow. This is not an independently validated database firewall.

Collect Events

Configure the shared library and restart PostgreSQL:

shared_preload_libraries = 'apt_guard'

Install as a superuser in the monitored database and inspect collected events:

CREATE EXTENSION apt_guard;
SELECT * FROM apt_events ORDER BY event_time DESC LIMIT 10;
SELECT * FROM apt_alerts ORDER BY id DESC LIMIT 10;

The extension installs tables for users, sessions, events, sequence patterns and alerts. Executor and utility hooks collect command text, timing, outcomes and relation information. The external agent and dashboard require their own deployment; creating the extension does not start them.

Boundaries and Maintenance

Query text can contain sensitive values. Restrict access to collection tables and to the external services, configure retention, and measure collection overhead before using a busy database. Internal collection-table queries are deliberately skipped, so recorded events are not a complete independent audit trail. Errors and transaction behavior can affect persistence; test the failure paths relevant to the workload.

The container example’s credentials are development examples, not production defaults to adopt. The reviewed repository has no license file; no reuse license is assumed. Upgrade the library and SQL objects together, and restart backends that already loaded the old module.

Table reader