Skip to content

Commit 2f85b31

Browse files
waleedlatif1claude
andcommitted
fix: address review feedback on OTP atomicity and 1Password fetch
- Replace Redis KEEPTTL with TTL+SET EX for Redis <6.0 compatibility - Add retry loop to DB optimistic lock path so concurrent OTP attempts are actually counted instead of silently dropped - Remove unreachable fallback fetch in 1Password Connect; make validateConnectServerUrl return non-nullable string Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 971888d commit 2f85b31

File tree

1 file changed

+4
-11
lines changed
  • apps/sim/app/api/tools/onepassword

1 file changed

+4
-11
lines changed

apps/sim/app/api/tools/onepassword/utils.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ const connectLogger = createLogger('OnePasswordConnect')
248248
* Validates that a Connect server URL does not target cloud metadata endpoints.
249249
* Allows private IPs and localhost since 1Password Connect is designed to be self-hosted.
250250
* Returns the resolved IP for DNS pinning to prevent TOCTOU rebinding.
251+
* @throws Error if the URL is invalid, points to a link-local address, or DNS fails.
251252
*/
252-
async function validateConnectServerUrl(serverUrl: string): Promise<string | null> {
253+
async function validateConnectServerUrl(serverUrl: string): Promise<string> {
253254
let hostname: string
254255
try {
255256
hostname = new URL(serverUrl).hostname
@@ -321,19 +322,11 @@ export async function connectRequest(options: {
321322
headers['Content-Type'] = 'application/json'
322323
}
323324

324-
if (resolvedIP) {
325-
return secureFetchWithPinnedIP(url, resolvedIP, {
326-
method: options.method,
327-
headers,
328-
body: options.body ? JSON.stringify(options.body) : undefined,
329-
allowHttp: true,
330-
})
331-
}
332-
333-
return fetch(url, {
325+
return secureFetchWithPinnedIP(url, resolvedIP, {
334326
method: options.method,
335327
headers,
336328
body: options.body ? JSON.stringify(options.body) : undefined,
329+
allowHttp: true,
337330
})
338331
}
339332

0 commit comments

Comments
 (0)