Add live background job count deltas#957
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b8afee64f
ℹ️ 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".
| const authorized = await authorizeJobsRequest({ | ||
| ability, | ||
| configuration: this.session.configuration, | ||
| options, | ||
| request: this.session.upgradeRequest, | ||
| token | ||
| }) |
There was a problem hiding this comment.
Require origin checks before authorizing count subscriptions
When a jobs mount relies on the documented loopback fallback (no accessTokens/authorize) or on cookie-backed ability auth, this WebSocket subscription reuses the HTTP authorization path without any Origin check; the WebSocket upgrade path accepts the connection before routing frames (checked src/http-server/client/index.js 245-267), and browsers do not apply CORS to WebSockets. A third-party page can therefore open a socket to a local/same-site app, send mountAt, and receive live job-count deltas even though GET /api/stats would be protected by CORS. Gate this channel on same/allowed origins or require the bearer-token path for WebSocket subscriptions.
Useful? React with 👍 / 👎.
Summary
/api/countssnapshot and/ws/countslive channel endpoints/api/stats.totalsemantics while addingcounts.allfor active tabsCorrectness
Validation
npm run lintpassed with zero warnings (includes typecheck and fallow)npm run buildpassedgit diff --check origin/master...HEADpassed