-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/add assignee autocomplete #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| const response = await fetch(`http://localhost:8000/tasks/${taskId}`, { | ||
| method: "PUT", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: `Bearer ${GITHUB_TOKEN}`, | ||
| }, | ||
| body: JSON.stringify({ assignee_user_id: assignedUserId }), | ||
| }); |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the SSRF vulnerability, we need to validate and sanitize the taskId parameter before using it in the URL. Specifically:
- Restrict the format of
taskId: Ensure thattaskIdadheres to a predefined format (e.g., alphanumeric or UUID) to prevent malicious input. - Use an allow-list: If possible, validate
taskIdagainst an allow-list of known valid task IDs. - Avoid direct concatenation: Construct the URL using safe methods that prevent injection or path traversal.
The best approach here is to validate taskId using a regular expression to ensure it conforms to a safe format (e.g., alphanumeric or UUID). This ensures that only legitimate task IDs are used in the request.
-
Copy modified lines R7-R8 -
Copy modified line R10 -
Copy modified line R23
| @@ -6,5 +6,6 @@ | ||
|
|
||
| if (!taskId || !assignedUserId) { | ||
| const taskIdRegex = /^[a-zA-Z0-9_-]+$/; // Allow alphanumeric, underscores, and hyphens | ||
| if (!taskId || !assignedUserId || !taskIdRegex.test(taskId)) { | ||
| return NextResponse.json( | ||
| { error: "Missing required fields" }, | ||
| { error: "Invalid or missing required fields" }, | ||
| { status: 400 }, | ||
| @@ -21,3 +22,3 @@ | ||
|
|
||
| const response = await fetch(`http://localhost:8000/tasks/${taskId}`, { | ||
| const response = await fetch(`http://localhost:8000/tasks/${encodeURIComponent(taskId)}`, { | ||
| method: "PUT", |
No description provided.