
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A CLI tool for managing PostgreSQL Row Level Security (RLS) policies as code
A powerful CLI tool for managing PostgreSQL Row Level Security (RLS) policies as code using TypeScript.
Install globally via npm:
npm install -g rls-guard
Initialize a new configuration:
rls-guard init
Configure your database and policies in rls.config.ts:
import { config, currentUserId, tenantId, publicAccess } from 'rls-guard/lib/rls-config';
const rlsConfig = config()
.database(db => db
.connectionUrl("postgresql://user:pass@localhost:5432/mydb")
)
// Users can only see their own records
.addPolicy(p => p
.name("user_isolation")
.onTable("users")
.forCommand("SELECT")
.withExpression(currentUserId())
.forRoles("authenticated_user")
)
// Admin users have full access
.addPolicy(p => p
.name("admin_full_access")
.onTable("users")
.forCommand("ALL")
.withExpression(publicAccess())
.forRoles("admin")
);
export default rlsConfig;
Deploy your policies:
# Preview changes
rls-guard deploy --dry-run
# Apply to database
rls-guard deploy
Connect using a connection URL:
.database(db => db
.connectionUrl("postgresql://user:pass@localhost:5432/mydb?sslmode=disable")
)
Or individual parameters:
.database(db => db
.host("localhost")
.port(5432)
.database("mydb")
.username("user")
.password("pass")
.ssl(false)
)
Permissive policies (default) - Allow access when conditions are met:
.addPolicy(p => p
.name("user_data_access")
.onTable("user_data")
.forCommand("SELECT")
.withExpression(currentUserId())
.forRoles("user")
.asPermissive() // This is the default
)
Restrictive policies - Block access unless conditions are met:
.addPolicy(p => p
.name("sensitive_data_restriction")
.onTable("sensitive_data")
.forCommand("SELECT")
.withExpression("false") // Block by default
.forRoles("public")
.asRestrictive()
)
currentUserId(column?) - Match current user IDtenantId(column?) - Multi-tenant isolationrecentData(column, days) - Time-based accessownerOnly(userCol, ownerCol) - Owner-based accessroleCheck(role) - Role-based conditionspublicAccess() - Always allow (returns true)noAccess() - Always deny (returns false)rls-guard initCreate a new rls.config.ts file with example policies.
rls-guard pull [options]Extract existing RLS policies from your PostgreSQL database and generate a configuration file.
Options:
--connection <url> - Database connection string (or set DATABASE_URL env var)--output, -o <file> - Output file path (default: rls.config.ts)--tables, -t <tables> - Comma-separated list of tables to extract--format, -f <format> - Output format: typescript or json (default: typescript)--comments, -c - Add explanatory comments to generated config--no-mask - Don't mask sensitive connection info in outputExample:
# Extract all policies to TypeScript config
rls-guard pull --connection "postgresql://user:pass@localhost:5432/mydb"
# Extract specific tables with comments
rls-guard pull --tables "users,posts" --comments --output policies.config.ts
# Generate JSON format
rls-guard pull --format json --output policies.json
rls-guard deploy [options]Deploy RLS policies to your PostgreSQL database.
Options:
--dry-run - Show SQL commands without executing them--config, -c <path> - Path to config file (default: rls.config.ts)rls-guard versionShow the current version.
RLS Guard includes comprehensive test suites:
# Run unit and basic integration tests
npm test
# Run database integration tests (requires PostgreSQL)
npm run test:db
# Set up test database with Docker
npm run test:db-setup
# Run full test suite with Docker database
npm run test:full
See TESTING.md for detailed testing documentation.
We welcome contributions! RLS Guard is an open-source project that benefits from community involvement.
Check out our Feature Roadmap to see planned features and improvements. Pick any item that interests you!
npm installSee the complete roadmap for detailed feature plans and development priorities.
MIT License
FAQs
A CLI tool for managing PostgreSQL Row Level Security (RLS) policies as code
We found that rls-guard demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.