VSKI v0.5.6
Security Release
Section titled “Security Release”This release addresses multiple security vulnerabilities identified in a security audit. All users are strongly encouraged to upgrade.
Security Fixes
Section titled “Security Fixes”Critical
Section titled “Critical”- Path Traversal Prevention - Database names from
x-dbnameheader are now sanitized to only allow alphanumeric characters, underscores, and hyphens. This prevents path traversal attacks that could access arbitrary files.
-
SQL Identifier Escaping -
SqlEscapeIdentifier()now properly escapes double quotes by doubling them, preventing potential SQL injection via identifier names. -
CORS Origin Validation - WebSocket connections (realtime and workflow) now validate the Origin header against an allowlist. Configure via
ALLOWED_ORIGINSenvironment variable. -
JWT Secret Warning - In production mode (when
DEVis not set totrue), a red warning is now printed ifJWT_SECRETis not configured. -
Rate Limiting on Auth Endpoints - Authentication endpoints now have configurable rate limiting to prevent brute force attacks:
- Default: 5 attempts per hour per email
- Default: 24 attempts per 24 hours per email
- Returns HTTP 429 with
retry_afterwhen exceeded
Medium
Section titled “Medium”- User Enumeration Fix - Authentication error messages are now generic (“Unauthorized”) to prevent user enumeration attacks.
New Environment Variables
Section titled “New Environment Variables”| Variable | Default | Description |
|---|---|---|
ALLOWED_ORIGINS | * | Comma-separated list of allowed CORS origins. Use * for all origins (not recommended for production) |
AUTH_RATE_LIMIT_PER_HOUR | 5 | Max auth attempts per email per hour |
AUTH_RATE_LIMIT_PER_DAY | 24 | Max auth attempts per email per 24 hours |
Technical Details
Section titled “Technical Details”Files Changed
Section titled “Files Changed”internal/config/config.go- AddedAllowedOrigins,AuthRateLimitPerHour,AuthRateLimitPerDayconfig options and production warningsinternal/db/db.go- AddedsanitizeDBName()function to prevent path traversalinternal/middleware/middleware.go- AddedRateLimiter,RateLimitMiddleware, updatedCORSMiddlewareto accept allowed origins, fixed user enumerationinternal/utils/query.go- ImprovedSqlEscapeIdentifier()to escape double quotesinternal/realtime/gateway.go- Added origin validation for WebSocket connectionsinternal/workflow/gateway.go- Added origin validation for WebSocket connectionsinternal/app/bootstrap.go- Wired up rate limiting and CORS with config
Usage Examples
Section titled “Usage Examples”# Production configurationJWT_SECRET=your-secure-random-string-at-least-32-charsALLOWED_ORIGINS=https://app.example.com,https://admin.example.comAUTH_RATE_LIMIT_PER_HOUR=5AUTH_RATE_LIMIT_PER_DAY=24
# Development (defaults)DEV=true# ALLOWED_ORIGINS defaults to * (all origins)# JWT_SECRET defaults to dev-secret (with warning)Changelog
Section titled “Changelog”v0.5.6 (2026-02-23)
Section titled “v0.5.6 (2026-02-23)”Security
Section titled “Security”- Fixed path traversal vulnerability in database name handling
- Fixed SQL injection via unescaped double quotes in identifiers
- Added WebSocket origin validation (CSWSH prevention)
- Added rate limiting on authentication endpoints
- Fixed user enumeration via authentication error messages
ALLOWED_ORIGINSenvironment variable for CORS configurationAUTH_RATE_LIMIT_PER_HOURenvironment variable (default: 5)AUTH_RATE_LIMIT_PER_DAYenvironment variable (default: 24)- Production warning for missing
JWT_SECRET - Production warning for
ALLOWED_ORIGINS=*
Changed
Section titled “Changed”SqlEscapeIdentifier()now properly escapes double quotesCORSMiddleware()now accepts allowed origins parameter- WebSocket gateways now validate Origin header
- Generic “Unauthorized” error message for auth failures