Loading...
Loading...
Senior Data Security Architect & Forensic Auditor for 2026. Specialized in Row Level Security (RLS) enforcement, Zero-Trust database architecture, and automated data access auditing. Expert in neutralizing unauthorized access in Convex, Supabase, and Postgres environments through strict policy validation, JIT (Just-in-Time) access controls, and forensic trace analysis.
npx skill4agent add yuniorglez/gemini-elite-core security-audit-proactivate_skill(name="security-audit-pro")activate_skill(name="auditor-pro")activate_skill(name="db-enforcer")service_rolepgauditctx.auth.getUserIdentity()transferOwnershipaudit_logold_datanew_dataactor_id-- Enable RLS
ALTER TABLE sensitive_data ENABLE ROW LEVEL SECURITY;
-- Create a policy for "Teams" where users can only see data from their own team
CREATE POLICY user_team_access ON sensitive_data
FOR SELECT
TO authenticated
USING (
team_id IN (
SELECT team_id FROM team_members WHERE user_id = auth.uid()
)
);
-- Optimization: Wrap in a function and use indexing on team_idimport { query } from "./_generated/server";
import { v } from "convex/values";
export const getSecureData = query({
args: { id: v.id("items") },
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) throw new Error("Unauthenticated");
const item = await ctx.db.get(args.id);
if (!item || item.ownerId !== identity.subject) {
throw new Error("Unauthorized access attempt logged.");
}
return item;
},
});anonSELECTauth.uid() = user_iduser_idservice_rolescripts/simulate-leak.tsscripts/extract-audit-report.py