AI-SafeQuery
Secure AI Blockchain-Logged DB Queries
Created on 7th September 2025
•
AI-SafeQuery
Secure AI Blockchain-Logged DB Queries
The problem AI-SafeQuery solves
- Enterprises expose sensitive data across multiple departments, yet running queries directly on production databases is inherently risky. Mistakes or malicious actions can lead to data breaches or accidental data loss.
- Current monitoring tools are often reactive, making it difficult for admins to detect unsafe or unauthorized queries in real time.
- Regulatory frameworks (e.g., GDPR, HIPAA, SOX) mandate immutable audit trails and strict accountability for data access—manual logging is error-prone and insufficient.
- Teams increasingly need natural language access to databases to accelerate decision-making, but this creates a gap between usability and security. Without role-based access control, sensitive data may be exposed to unauthorized personnel.
Challenges we ran into
1. AI Query Generation Ambiguity
- Problem: When converting natural language into SQL, the AI sometimes referenced tables/columns that didn’t exist in the schema.
- Solution: Added dynamic schema fetching + schema-aware prompt engineering, ensuring only valid tables/columns are used.
2. Preventing Unsafe Queries
- Problem: Direct execution of queries like
DROP TABLEorDELETE *could cause catastrophic data loss. - Solution: Built a Query Safety Check tool that flags/blocks destructive operations and routes them to Admin Approval.
3. Immutable Audit Logging
- Problem: Standard logging could be tampered with, reducing trust in compliance.
- Solution: Implemented a Blockchain-Style Logger using cryptographic hashes, making logs tamper-proof and audit-ready.
4. Role-Based Access Control (RBAC)
- Problem: Initially, all users had equal permissions, which was a security risk.
- Solution: Added fine-grained RBAC (reader, writer, admin, super_admin) and enforced permissions at query execution level.
5. Deployment Integration
- Problem: Ensuring smooth deployment from AI Agent → Backend → Frontend while keeping services connected securely.
- Solution: Used Dockerized services with environment configs and tested end-to-end flows before cloud deployment.
6. Deployment on Akash Network
- Problem: We attempted multiple times to deploy on Akash Network, but kept running into the error: “Bid is not available.”
- Solution: Due to time constraints, we had to use vercel deployment.
7. Vebwire API Integration
- Problem: We tried integrating the Vebwire API, but were blocked due to token unavailability.
- Solution: used alternative blockchain technology (out of track).
8. Strict Time & Academic Constraints
- Problem: Balancing development with exams and limited hackathon hours was challenging.
- Solution: We focused on building a secure, working MVP within 32 hours, prioritizing enterprise-grade features first.
Discussion
Builders also viewed
See more projects on Devfolio
