🔒 [security fix] Secure task deletion and detailed access with per-task tokens#5
Conversation
- Automatically generate a cryptographically secure random token (deleteToken) for each new task. - Secure DELETE /task/:id: requires x-task-token header if a token is set for the task. - Secure GET /task/:id: new endpoint providing full task details, also requiring x-task-token. - Privacy for GET /tasks: filtered to return only non-sensitive metadata (config and tokens are hidden). - Full backward compatibility: legacy tasks without tokens remain accessible without additional headers. - Automatic database migration to add the deleteToken column.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a6f3e333c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| config ? JSON.stringify(config) : null, | ||
| webhookUrl | ||
| webhookUrl, | ||
| deleteToken |
There was a problem hiding this comment.
Generate delete tokens inside schedule() by default
schedule() now persists deleteToken exactly as provided, but the only generator was added in the HTTP POST /task handler, so other first-party creation paths (for example src/bin/cli.ts schedule command and scheduleManyCosmosQueries) still insert NULL tokens for new tasks. Since both protection checks are conditional on task.deleteToken being truthy, those newly created tasks remain readable/deletable without any x-task-token, which bypasses the security model for non-HTTP scheduling flows.
Useful? React with 👍 / 👎.
🔒 Security Fix: Comprehensive Task Protection
🎯 What: This PR secures the task management API by protecting sensitive data and operations using a per-task token system.
🛡️ Solution:
crypto.randomBytes.GET /tasksis now restricted to metadata (ID, status, timing). Sensitiveconfigdata is removed from the bulk list.GET /task/:idendpoint allows authorized users to see full details (includingconfig) by providing the correct token.x-task-tokenheader for all tasks that possess a token.This dual-layered approach (filtering + token-based detail access/deletion) provides robust security while maintaining a smooth developer experience.
PR created automatically by Jules for task 1397686978802999609 started by @QuenumGerald