This document outlines the REST API endpoints required for the BugZooka application. All endpoints should return JSON responses and follow RESTful conventions.
http://localhost:8000/api
All endpoints require authentication via Auth0 JWT tokens in the Authorization header:
Authorization: Bearer <jwt_token>
{
id: string,
email: string,
name: string,
avatar?: string
}{
id: string,
name: string,
description?: string,
createdAt: Date,
memberCount: number,
members: User[]
}{
id: string,
title: string,
description: string,
roast: string,
reproduction_steps: Array<{
step_number: number,
text: string,
image_url: string
}>,
status: 'pending' | 'confirmed' | 'rejected',
isEditing: boolean
}{
id: string,
teamId: string,
targetUrl: string,
createdBy: string,
settings: {
includeSubdomains: boolean,
customHeaders?: Record<string, string>
},
status: 'pending' | 'running' | 'completed' | 'failed',
bugFindings: BugFinding[],
createdAt: Date,
completedAt?: Date
}Get all teams for the authenticated user.
Response:
{
"teams": [
{
"id": "team-1",
"name": "Security Team Alpha",
"description": "Primary security testing team",
"createdAt": "2024-01-15T10:00:00Z",
"memberCount": 3,
"members": [
{
"id": "user-1",
"email": "john.doe@company.com",
"name": "John Doe",
"avatar": "https://example.com/avatar1.jpg"
}
]
}
]
}Create a new team.
Request Body:
{
"name": "New Security Team",
"description": "Team description"
}Response:
{
"id": "team-2",
"name": "New Security Team",
"description": "Team description",
"createdAt": "2024-01-15T10:00:00Z",
"memberCount": 1,
"members": []
}Update team details.
Request Body:
{
"name": "Updated Team Name",
"description": "Updated description"
}Delete a team.
Response:
{
"message": "Team deleted successfully"
}Add a user to a team.
Request Body:
{
"userId": "user-2"
}Remove a user from a team.
Get all audits for a team.
Query Parameters:
teamId(required): Team ID to filter audits
Response:
{
"audits": [
{
"id": "run-1",
"teamId": "team-1",
"targetUrl": "https://example.com",
"createdBy": "user-1",
"settings": {
"includeSubdomains": false,
"customHeaders": {}
},
"status": "completed",
"bugFindings": [],
"createdAt": "2024-01-15T10:00:00Z",
"completedAt": "2024-01-15T10:30:00Z"
}
]
}Create a new audit.
Request Body:
{
"teamId": "team-1",
"targetUrl": "https://example.com",
"settings": {
"includeSubdomains": false,
"customHeaders": {
"User-Agent": "BugZooka/1.0"
}
},
"testCases": [
{
"id": "test-1",
"test": "Test login functionality",
"expectedOutput": "Should redirect to dashboard"
}
]
}Response:
{
"id": "run-2",
"teamId": "team-1",
"targetUrl": "https://example.com",
"createdBy": "user-1",
"settings": {
"includeSubdomains": false,
"customHeaders": {}
},
"status": "running",
"bugFindings": [],
"createdAt": "2024-01-15T10:00:00Z"
}Get a specific audit.
Update audit status.
Request Body:
{
"status": "completed"
}Get all confirmed bugs across all teams.
Response:
{
"bugs": [
{
"id": "bug-1",
"title": "XSS in Search Function",
"description": "The search functionality is vulnerable to cross-site scripting attacks.",
"roast": "This search is so vulnerable, it might as well be a public bulletin board...",
"reproduction_steps": [
{
"step_number": 1,
"text": "Navigate to the search page",
"image_url": "https://example.com/step1.png"
}
],
"status": "confirmed",
"isEditing": false
}
]
}Get a specific bug finding.
Update bug status (confirm/reject).
Request Body:
{
"status": "confirmed"
}Response:
{
"id": "bug-1",
"status": "confirmed",
"message": "Bug status updated successfully"
}Export a confirmed bug to Jira.
Request Body:
{
"bugId": "bug-1",
"jiraProject": "SEC",
"jiraIssueType": "Bug",
"jiraLabels": ["security", "xss"],
"jiraPriority": "High"
}Response:
{
"jiraTicketId": "SEC-123",
"jiraUrl": "https://company.atlassian.net/browse/SEC-123",
"message": "Bug successfully exported to Jira"
}Export a confirmed bug to GitHub.
Request Body:
{
"bugId": "bug-1",
"githubRepo": "company/security-issues",
"githubLabels": ["bug", "security", "xss"],
"githubMilestone": "Q1-2024"
}Response:
{
"githubIssueId": 456,
"githubUrl": "https://github.com/company/security-issues/issues/456",
"message": "Bug successfully exported to GitHub"
}Get all users in the system.
Response:
{
"users": [
{
"id": "user-1",
"email": "john.doe@company.com",
"name": "John Doe",
"avatar": "https://example.com/avatar1.jpg"
}
]
}Get current authenticated user.
Response:
{
"id": "user-1",
"email": "john.doe@company.com",
"name": "John Doe",
"avatar": "https://example.com/avatar1.jpg"
}All endpoints return appropriate HTTP status codes and error messages:
{
"error": "Bad Request",
"message": "Invalid request body",
"statusCode": 400
}Common Status Codes:
200- Success201- Created400- Bad Request401- Unauthorized403- Forbidden404- Not Found500- Internal Server Error
- Users Table: id, email, name, avatar, created_at
- Teams Table: id, name, description, created_at
- Team_Members Table: team_id, user_id
- Audits Table: id, team_id, target_url, created_by, status, settings, created_at, completed_at
- Bug_Findings Table: id, audit_id, title, description, roast, status, reproduction_steps, created_at
- Reproduction_Steps Table: id, bug_id, step_number, text, image_url
- All endpoints require valid JWT tokens
- Team access is restricted to team members
- Audit access is restricted to team members
- Input validation using Zod schemas
- Rate limiting on export endpoints
- CORS configuration for frontend domain
- Jira Integration: Requires Jira API credentials and project access
- GitHub Integration: Requires GitHub API token and repository access
- Auth0 Integration: JWT token validation middleware
- File Upload: For screenshot images in reproduction steps
The frontend currently uses mock data. To integrate with these APIs:
- Replace mock data calls with actual API calls
- Implement error handling for API responses
- Add loading states for async operations
- Implement proper authentication flow
- Add retry logic for failed requests
// Replace mock data with API call
const fetchConfirmedBugs = async () => {
const response = await fetch('/api/bugs/confirmed', {
headers: {
'Authorization': `Bearer ${token}`
}
});
return response.json();
};
// Export to Jira
const exportToJira = async (bugId: string) => {
const response = await fetch('/api/export/jira', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
bugId,
jiraProject: 'SEC',
jiraIssueType: 'Bug'
})
});
return response.json();
};This API documentation provides the complete backend requirements for the BugZooka application, including all the confirmed bugs functionality and export integrations.