This document outlines the security policy for Hackwise 2.0, a national-level SaaS hackathon platform built by Sphere Hive at KVG College of Engineering. We take security seriously and appreciate responsible disclosures from the community.
- Supported Versions
- Reporting a Vulnerability
- Response Timeline
- Security Architecture
- Authentication & Authorization
- API Security
- Database Security
- Payment Security
- Environment Variable Security
- Dependency Security
- Known Patched Vulnerabilities
- Security Best Practices for Contributors
- Disclosure Policy
Only the latest production version of Hackwise 2.0 is actively maintained for security patches.
| Version | Supported |
|---|---|
Latest (main branch) |
β Active support |
| Older commits / forks | β Not supported |
If you are running a self-hosted fork, please keep all dependencies up to date and follow the guidance in this document.
Please do NOT open a public GitHub Issue for security vulnerabilities.
Instead, report vulnerabilities responsibly through one of the following channels:
| Channel | Contact |
|---|---|
| π§ Email | spherehive@kvgce.ac.in |
| π GitHub | Use GitHub Private Vulnerability Reporting |
To help us triage and fix the issue quickly, please include:
- Description β A clear summary of the vulnerability
- Affected component β Which API route, page, or module is affected
- Steps to reproduce β Minimal, reproducible proof-of-concept (PoC)
- Impact assessment β What an attacker could potentially achieve
- Suggested fix (optional but appreciated)
| Stage | Target Time |
|---|---|
| Acknowledgement | Within 48 hours |
| Initial triage | Within 5 business days |
| Patch or mitigation | Within 14 days (critical), 30 days (moderate/low) |
| Public disclosure | Coordinated with reporter after patch is live |
We will keep you informed throughout the process and credit you in the advisory (unless you prefer to remain anonymous).
Hackwise 2.0 is built on the following security-conscious stack:
| Layer | Technology | Security Notes |
|---|---|---|
| Framework | Next.js 16 (App Router) | Server-side rendering, no client-side DB exposure |
| Auth | jose (JWT) |
Signed tokens, verified in middleware |
| Database | MySQL via mysql2 connection pool |
Parameterized queries, no raw string interpolation |
| Payments | Razorpay | Server-side order creation, signature verification |
| File Uploads | Cloudinary | Secure CDN, no direct filesystem writes in production |
| Resend API | Server-side only, no credential exposure to client | |
| Hosting | Vercel | HTTPS enforced, environment variables isolated |
- Access is controlled by JWT session tokens stored in
HttpOnlycookies (admin_session) - All
/admin/*and/api/admin/*routes are protected bymiddleware.js - Unauthenticated requests to admin API routes receive a
401 Unauthorizedresponse - Unauthenticated page visits are redirected to
/admin/login
- Teams authenticate via credentials and receive a JWT stored in
HttpOnlycookie (team_session) - All
/dashboard/*and/api/team/*routes are verified viaverifyTeamSession() - Session verification is done server-side in middleware before any route handler executes
- CAs authenticate and receive a JWT stored in
HttpOnlycookie (ca_session) - All
/campus-ambassador/*and/api/ca/*routes (except public apply/login endpoints) require valid CA session - Session verification is done server-side in middleware
// Tokens are verified using jose (JOSE standard - JWS/JWE)
// Never stored in localStorage or sessionStorage
// Always HttpOnly, Secure (in production), SameSite cookies
β οΈ Never expose theJWT_SECRETorADMIN_PASSWORDenvironment variables to the client side or commit them to version control.
- All API routes validate required fields before processing
- Missing or invalid fields return
400 Bad Requestwith descriptive error messages - Numeric fields are validated with
parseInt()/parseFloat()and range-checked
- The accommodation booking API uses a database-level
UNIQUE KEYon(team_lead_email, check_in_date)to prevent duplicate bookings - Application-level pre-checks detect existing records and either update them (for payment retry) or reject with
409 Conflict ER_DUP_ENTRYdatabase errors are explicitly caught and handled
- All API routes catch errors and return generic error messages to the client
- Detailed error information (stack traces, SQL errors) is logged server-side only, never sent to the client
- Analytics failures are silently swallowed (
200 OKwithsuccess: false) to avoid leaking server state
β οΈ Recommendation: Consider adding rate limiting (e.g., via Vercel Edge middleware orupstash/ratelimit) to registration and accommodation booking endpoints to prevent abuse.
All database interactions use parameterized queries via mysql2 to prevent SQL injection:
// β
Safe β parameterized
await pool.query(
'SELECT * FROM `hw-teams` WHERE email = ?',
[userEmail]
);
// β Unsafe β never done in this codebase
await pool.query(`SELECT * FROM hw-teams WHERE email = '${userEmail}'`);- Critical tables (
hw-accommodation-queries,hw-analytics,hw-visitors,hw-logs) are auto-created usingCREATE TABLE IF NOT EXISTSon first access - This prevents startup race conditions without exposing schema management endpoints publicly
- Database credentials are stored exclusively in environment variables (
.env.local/ Vercel project settings) - The connection pool (
lib/db.js) uses SSL/TLS in production environments where supported ECONNREFUSEDerrors are caught and return a user-friendly503 Service Unavailableinstead of leaking connection details
- Database user should have least-privilege permissions β only
SELECT,INSERT,UPDATE,DELETEon the application's tables - No
DROP,CREATE USER,GRANT, orSUPERprivileges should be assigned to the app DB user
Hackwise 2.0 uses Razorpay for accommodation payment processing.
- Razorpay orders are created exclusively on the server via
/api/accommodation/create-order - The
RAZORPAY_KEY_SECRETis never exposed to the client - Only the
RAZORPAY_KEY_ID(public key) andorder_idare sent to the browser
- All payment callbacks verify the Razorpay HMAC-SHA256 signature before marking a payment as successful
- This prevents forged payment success notifications
- The server validates that Razorpay keys are properly configured (not placeholder values) before processing any order
- Returns
500with a human-readable error if keys are missing, preventing silent misconfiguration
- Card data is never handled or stored by this application
- All sensitive card processing happens within Razorpay's PCI-DSS compliant infrastructure
The following environment variables contain sensitive secrets and must never be committed to version control:
| Variable | Sensitivity | Usage |
|---|---|---|
DATABASE_URL |
π΄ Critical | MySQL connection string |
JWT_SECRET |
π΄ Critical | JWT signing key for all sessions |
ADMIN_PASSWORD |
π΄ Critical | Admin panel login |
RAZORPAY_KEY_SECRET |
π΄ Critical | Payment signature verification |
RESEND_API_KEY |
π High | Email sending |
CLOUDINARY_API_SECRET |
π High | Image upload authentication |
RAZORPAY_KEY_ID |
π‘ Medium | Public Razorpay key (still keep private in env) |
CLOUDINARY_API_KEY |
π‘ Medium | Cloudinary API key |
NEXT_PUBLIC_* |
π’ Low | Safely exposed to browser β add no secrets here |
- Never commit
.env.localor any file containing real secrets - The
.gitignoremust include.env*(excluding.env.example) - Use Vercel Environment Variables for production deployments
- Rotate secrets immediately if accidentally exposed
- Use separate keys for development and production environments
We use GitHub Dependabot for automated dependency vulnerability scanning. Dependencies are reviewed and patched regularly.
| Tool | Purpose |
|---|---|
| Dependabot | Automated alerts & PRs for vulnerable dependencies |
npm audit |
Manual local vulnerability scanning |
npm audit fix |
Auto-patching of compatible vulnerability fixes |
- Critical vulnerabilities: Patched within 7 days
- High severity: Patched within 14 days
- Moderate/Low: Reviewed within 30 days
The following vulnerabilities have been identified and patched in this project:
| Field | Detail |
|---|---|
| Package | swiper (npm) |
| CVEs | CVE-2026-25521, CVE-2026-25047, CVE-2026-26021 |
| Affected versions | >= 6.5.1, < 12.1.2 |
| Patched version | 12.1.2 |
| Severity | π΄ High |
| Status | β
Patched β upgraded to ^12.1.2 in package.json |
| Description | A bypass of prototype pollution protection via Array.prototype.indexOf override allowed attackers to pollute Object.prototype, potentially enabling authentication bypass, DoS, or RCE in downstream applications |
| Field | Detail |
|---|---|
| Package | minimatch (npm) |
| Advisories | GHSA-3ppc-4f35-3m26, GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74, GHSA-2g4f-4pwh-qvx6 |
| Severity | π High (Development dependency) |
| Status | β
Patched β updated via npm audit fix in package-lock.json |
| Description | Multiple Regular Expression Denial of Service (ReDoS) vulnerabilities in minimatch via repeated wildcards, non-adjacent GLOBSTAR segments, and nested *() extglobs that generate catastrophically backtracking regular expressions |
| Field | Detail |
|---|---|
| Package | ajv (npm) |
| Severity | π‘ Moderate (Development dependency) |
| Status | β
Patched β updated via npm audit fix in package-lock.json |
| Description | A ReDoS vulnerability when using the $data option in ajv JSON schema validation |
If you are contributing to this project, please follow these guidelines:
- Never use string interpolation for SQL queries β always use parameterized queries
- Never log sensitive data (passwords, tokens, payment IDs) to the console
- Never expose internal error details to API responses β log server-side, return generic messages to clients
- Validate and sanitize all user inputs on the server side, even if validated on the client
- Use
HttpOnly,Secure, andSameSite=Strictflags on all authentication cookies - Implement least-privilege access β API routes should only access data relevant to the authenticated user's role
- Run
npm auditbefore submitting a PR - Do not add dependencies with known critical/high vulnerabilities
- Prefer well-maintained packages with recent update histories
- Keep
package.jsonandpackage-lock.jsonin sync
- Test with placeholder values in
.env.localβ never use real production secrets locally unless absolutely necessary - Add new environment variables to
.env.example(with placeholder values) when introducing them - Never hardcode API keys, passwords, or secrets anywhere in the source code
- Security-sensitive changes (auth, payment, DB schema) require extra review scrutiny
- Reference any related CVEs or security advisories in the PR description
We follow a coordinated disclosure model:
- Reporter submits vulnerability privately
- We acknowledge within 48 hours
- We investigate and develop a fix
- Reporter is notified when a patch is ready
- Fix is deployed to production
- Public advisory is published (crediting the reporter unless anonymity is requested)
We request a minimum 14-day embargo after a patch is ready before public disclosure, to allow all users time to update.
We thank the security researchers and open-source community members who have responsibly disclosed vulnerabilities and helped make Hackwise 2.0 more secure.
Hackwise 2.0 Β· Built by Muhammad Arshad R A Β· SPHERE HIVE
Questions? Reach us at spherehive@kvgce.ac.in