-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: security release 2026-08-12 #4735
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
Merged
+1,238
−72
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e05c293
fix(webapp,dashboard-agent): stop client-injected repoSnapshot tarbal…
carderne 39174be
fix(webapp): close abuse rate-limit gaps in magic link, MFA disable, …
carderne f92b766
fix(tsql): reject PREWHERE clauses (#91)
carderne 201d899
fix(webapp): scope dashboard waitpoint completion to environments (#90)
carderne 0011a21
fix(webapp): bind Slack OAuth callbacks to one-time state (#82)
carderne 1fe5326
Merge remote-tracking branch 'upstream/main' into release/2026-08-12
753d4a1
Merge remote-tracking branch 'upstream/main' into release/2026-08-12
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: fix | ||
| --- | ||
|
|
||
| Reject alert webhook destinations in reserved benchmarking IP ranges. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: fix | ||
| --- | ||
|
|
||
| TRQL queries using the PREWHERE clause are now rejected with a clear error message. Use WHERE instead, which is filtered the same way but keeps your data isolation guarantees intact. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import { randomBytes } from "node:crypto"; | ||
| import { z } from "zod"; | ||
| import { env } from "~/env.server"; | ||
| import { createRedisClient, type RedisClient } from "~/redis.server"; | ||
| import { commitSession, getUserSession } from "~/services/sessionStorage.server"; | ||
| import { singleton } from "~/utils/singleton"; | ||
|
|
||
| const STATE_TTL_SECONDS = 10 * 60; | ||
| const CREATE_ATTEMPTS = 2; | ||
| const KEY_PREFIX = "oauth:slack:state:"; | ||
| const SLACK_OAUTH_SESSION_BINDING_KEY = "slack-oauth-session-binding"; | ||
|
|
||
| const SlackOAuthStateSchema = z.object({ | ||
| userId: z.string(), | ||
| sessionBinding: z.string(), | ||
| organizationId: z.string(), | ||
| service: z.literal("slack"), | ||
| redirectTo: z.string().regex(/^\/(?!\/)/), | ||
| }); | ||
|
carderne marked this conversation as resolved.
|
||
|
|
||
| export type SlackOAuthState = z.infer<typeof SlackOAuthStateSchema>; | ||
|
|
||
| type CreateSlackOAuthState = SlackOAuthState; | ||
| type StartSlackOAuthState = Omit<CreateSlackOAuthState, "sessionBinding">; | ||
| type ConsumeSlackOAuthState = Pick<SlackOAuthState, "userId" | "sessionBinding" | "service">; | ||
|
|
||
| const consumeScript = ` | ||
| local raw = redis.call("GET", KEYS[1]) | ||
| if not raw then return nil end | ||
| local decoded, state = pcall(cjson.decode, raw) | ||
| if not decoded or type(state) ~= "table" then return nil end | ||
| if state.userId ~= ARGV[1] or state.sessionBinding ~= ARGV[2] or state.service ~= ARGV[3] then | ||
| return nil | ||
| end | ||
| redis.call("DEL", KEYS[1]) | ||
| return raw | ||
| `; | ||
|
|
||
| export class SlackOAuthStateStore { | ||
| constructor(private readonly redis: Pick<RedisClient, "set" | "eval">) {} | ||
|
|
||
| async create(state: CreateSlackOAuthState): Promise<string> { | ||
| const parsedState = SlackOAuthStateSchema.parse(state); | ||
|
|
||
| for (let attempt = 0; attempt < CREATE_ATTEMPTS; attempt++) { | ||
| const nonce = randomBytes(32).toString("base64url"); | ||
| const created = await this.redis.set( | ||
| this.#key(nonce), | ||
| JSON.stringify(parsedState), | ||
| "EX", | ||
| STATE_TTL_SECONDS, | ||
| "NX" | ||
| ); | ||
| if (created === "OK") return nonce; | ||
| } | ||
|
|
||
| throw new Error("Failed to create a unique Slack OAuth state"); | ||
| } | ||
|
|
||
| async consume( | ||
| nonce: string, | ||
| expected: ConsumeSlackOAuthState | ||
| ): Promise<SlackOAuthState | undefined> { | ||
| if (!/^[A-Za-z0-9_-]{43}$/.test(nonce)) return undefined; | ||
|
|
||
| const raw = await this.redis.eval( | ||
| consumeScript, | ||
| 1, | ||
| this.#key(nonce), | ||
| expected.userId, | ||
| expected.sessionBinding, | ||
| expected.service | ||
| ); | ||
| if (typeof raw !== "string") return undefined; | ||
|
|
||
| try { | ||
| return SlackOAuthStateSchema.safeParse(JSON.parse(raw)).data; | ||
| } catch { | ||
| return undefined; | ||
| } | ||
| } | ||
|
|
||
| #key(nonce: string): string { | ||
| return `${KEY_PREFIX}{${nonce}}`; | ||
| } | ||
| } | ||
|
|
||
| export async function createSlackOAuthStateForSession( | ||
| request: Request, | ||
| state: StartSlackOAuthState, | ||
| stateStore: SlackOAuthStateStore = getSlackOAuthStateStore() | ||
| ): Promise<{ nonce: string; sessionCookie: string }> { | ||
| const session = await getUserSession(request); | ||
| const sessionBinding = randomBytes(32).toString("base64url"); | ||
| const nonce = await stateStore.create({ ...state, sessionBinding }); | ||
| session.set(SLACK_OAUTH_SESSION_BINDING_KEY, sessionBinding); | ||
|
|
||
| return { nonce, sessionCookie: await commitSession(session) }; | ||
| } | ||
|
|
||
| export async function consumeSlackOAuthStateForSession( | ||
| request: Request, | ||
| nonce: string, | ||
| userId: string, | ||
| stateStore: SlackOAuthStateStore = getSlackOAuthStateStore() | ||
| ): Promise<SlackOAuthState | undefined> { | ||
| const session = await getUserSession(request); | ||
| const sessionBinding = session.get(SLACK_OAUTH_SESSION_BINDING_KEY); | ||
| if (typeof sessionBinding !== "string") return undefined; | ||
|
|
||
| return stateStore.consume(nonce, { userId, sessionBinding, service: "slack" }); | ||
| } | ||
|
carderne marked this conversation as resolved.
|
||
|
|
||
| export async function clearSlackOAuthSessionBinding(request: Request): Promise<string> { | ||
| const session = await getUserSession(request); | ||
| session.unset(SLACK_OAUTH_SESSION_BINDING_KEY); | ||
| return commitSession(session); | ||
| } | ||
|
|
||
| function getSlackOAuthStateStore(): SlackOAuthStateStore { | ||
| if (!env.CACHE_REDIS_HOST) { | ||
| throw new Error("Cache Redis is required for Slack OAuth state"); | ||
| } | ||
|
|
||
| return singleton( | ||
| "slackOAuthStateStore", | ||
| () => | ||
| new SlackOAuthStateStore( | ||
| createRedisClient("trigger:slack-oauth-state", { | ||
| host: env.CACHE_REDIS_HOST, | ||
| port: env.CACHE_REDIS_PORT, | ||
| username: env.CACHE_REDIS_USERNAME, | ||
| password: env.CACHE_REDIS_PASSWORD, | ||
| tlsDisabled: env.CACHE_REDIS_TLS_DISABLED === "true", | ||
| clusterMode: env.CACHE_REDIS_CLUSTER_MODE_ENABLED === "1", | ||
| }) | ||
| ) | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.