feat: supascan audit feature #1963
Draft
+200,295
−1,844
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supascan - System Scanner and Validator
A comprehensive system auditing toolkit for generating and validating baseline specifications using GOSS.
Features
One Unified CLI with Three Commands:
supascan genspec- Generate complete machine baseline (packages, services, configs, users, groups, mounts, kernel params)supascan validate- Validate machines against baseline specifications with critical/advisory categorizationsupascan split- Split a monolithic baseline into separate section files for easier auditingUse Cases:
Quick Start
Generate a Machine Baseline
Split Baseline into Sections
Validate Against Baselines
Installation
Using Nix Flake
Development Environment
git clone https://github.com/supabase/postgres cd postgres nix developThis gives you access to:
supascanCLIgossbinaryUsage
supascan genspec
Generate a comprehensive baseline specification from a running machine.
Captures:
Options:
--format <yaml|json>--config <file>--include-dynamic--include-ports--include-processes--shallow-dirs <path>--shallow-depth <n>--strict--verbose--debugsupascan split
Split a monolithic baseline file into separate section files for targeted auditing.
Creates separate files:
service.yml- Systemd servicesuser.yml- User accountsgroup.yml- Groupsmount.yml- Mount pointspackage.yml- Installed packageskernel-param.yml- Kernel parametersfiles-security.yml- Security-related files (fail2ban, nftables)files-ssl.yml- SSL certificates and keysfiles-postgres-config.yml- PostgreSQL configurationfiles-postgres-data.yml- PostgreSQL data directoryfiles-etc.yml- General /etc filesfiles-systemd.yml- Systemd unit filesfiles-usr.yml,files-usr-local.yml- Application filessupascan validate
Validate the system against multiple baseline specification files with critical/advisory categorization.
Validation Categories:
Critical specs (must pass):
service.yml- Service configurationuser.yml- User accountsgroup.yml- Group membershipsmount.yml- Mount pointspackage.yml- Required packagesfiles-security.yml- Security configurationsfiles-ssl.yml- SSL/TLS filesfiles-postgres-config.yml- Database configurationfiles-postgres-data.yml- Database data permissionsAdvisory specs (informational):
kernel-param.yml- Kernel parametersfiles-etc.yml- General configuration filesfiles-systemd.yml- Systemd unitsfiles-*.yml- Other file categoriesExit Codes:
0- All critical checks passed1- One or more critical checks failedOptions:
--format <tap|documentation|json>--goss <path>--verboseWorkflow Examples
Baseline-Driven Compliance
git add baselines/ git commit -m "Add production baselines"CI/CD Image Validation
Add to your image build pipeline:
Example output:
Configuration
Exclusion Config File
Create a YAML config file to customize exclusions:
Use with:
Default Exclusions
The following are excluded by default to reduce noise:
Paths:
/proc/*,/sys/*,/dev/*,/run/*/tmp/*,/var/tmp/*/var/cache/*,*/.cache/*/var/log/**/__pycache__/*,*.pyc*/.bash_history,*/.zsh_historyShallow Directories:
/nix/store- Nix store (scan top-level only)/data/pgdata- PostgreSQL data/opt/saltstack- Salt installation/usr/local/share,/usr/local/libKernel Parameters:
fs.dentry-state,fs.file-nr,kernel.random.*fs.epoll.max_user_watches,net.netfilter.*Repository Structure
Development
Building
Code Quality
Requirements
sudoaccess for scanning and validation (many checks require root)Credits