-
-
Notifications
You must be signed in to change notification settings - Fork 0
Security
Security posture and secrets handling for ShadowCheck
ShadowCheck uses a layered model:
- Transport security: HTTPS/TLS, HSTS, reverse-proxy hardening
- Application security: CSP, CORS, input validation, rate limiting
- Data security: parameterized SQL, least-privilege DB roles, audit-friendly backups
- Access control: session auth, admin gating, API key protection for sensitive routes
- Secrets management: AWS Secrets Manager as the canonical store, environment variables only as explicit runtime overrides
Applied by the server security middleware:
Content-Security-Policy
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Strict-Transport-Security
Exact header values can evolve with deployment settings, but the intent is stable: reduce script injection, clickjacking, MIME confusion, and downgrade risk.
ShadowCheck does not use Docker secrets or local keyring as the primary mechanism.
The current implementation is:
- AWS Secrets Manager: canonical source of truth
- Environment variables: explicit runtime overrides only
Secrets are loaded by server/src/services/secretsManager.ts.
The following guidance is obsolete and should not be used:
- Docker secret files under
/run/secrets/* - local
secrets/*.txtfiles - keyring /
keytarworkflows as the normal path
db_password
db_admin_passwordmapbox_tokenwigle_api_namewigle_api_tokenwigle_api_encodedgoogle_maps_api_keymapbox_unlimited_api_keyopencage_api_keylocationiq_api_key
At startup, the app:
- checks for an explicit environment override for a secret
- otherwise loads from AWS Secrets Manager
- auto-generates
db_passwordonly if missing, then attempts to persist it back to AWS Secrets Manager
This means AWS remains the authoritative store even when bootstrap recovery is needed.
- Do not write secrets to
.env - Do not create helper files containing secrets
- Do not rely on Docker secret mounts
- Do not document keyring-only procedures as current practice
- Keep non-secret config separate from credential material
Rotate database and service credentials on a regular schedule and verify the updated values exist in AWS Secrets Manager before restarting dependent services.
If you rotate database credentials, also confirm:
- the PostgreSQL user password matches the stored secret
- the application can still read the updated secret
- any admin tooling using
db_admin_passwordis updated consistently
Database queries should remain parameterized:
const result = await query('SELECT * FROM networks WHERE bssid = $1', [bssid]);Avoid string interpolation for SQL input.
- Admin-only routes remain gated behind authenticated admin access
- Sensitive operational endpoints can require API key checks
- Session and cookie behavior should be reviewed with every auth change
- keep credentials in AWS Secrets Manager
- use environment variables only as intentional overrides
- rotate credentials regularly
- validate secrets at startup
- use parameterized queries everywhere
- keep file permissions tight on non-secret operational config
- use HTTPS in deployed environments
- commit secrets
- store secrets in
.env - write secret helper files to disk
- document Docker secrets as the active production model
- treat local keyring as the canonical source
Primary risks:
- unauthorized data access
- credential leakage
- admin endpoint abuse
- injection and input-manipulation attacks
Primary mitigations:
- parameterized SQL
- rate limiting
- CSP / header hardening
- least-privilege DB access
- startup secret validation
- keeping secrets out of the filesystem
If a required secret is missing:
- check the AWS secret exists in the configured secret bundle
- verify AWS region and IAM access
- use an environment override only if you intentionally need a temporary local override
If AWS Secrets Manager cannot be reached:
- verify
AWS_REGIONorAWS_DEFAULT_REGION - verify IAM credentials and permissions
- confirm the configured secret name is correct
ShadowCheck may log that AWS Secrets Manager is unavailable; treat that as a deployment or credentials problem first, not as a cue to fall back to disk-backed secret files.
- Architecture
- Development
- Repo docs:
docs/SECRETS.md - Repo docs:
docs/SECURITY_POLICY.md