deps(genkit-agent): override openai to 7.8.0 for Socket alert - #205
Conversation
Socket blocks PR 201 on a medium "potential vulnerability" in openai@4.104.0, pulled in by @genkit-ai/compat-oai@1.41.0. genkit and @genkit-ai/compat-oai are already latest and still declare openai@^4.95.0, so override the transitive pin to the current openai release. The example uses non-streaming ai.generate(), which maps to client.chat.completions.create — still present on 7.x. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
There was a problem hiding this comment.
Arcjet Review — 🟡 Medium Risk
Decision: Approved
Rationale: Small, well-scoped change to an example project's package.json: adds an npm overrides entry to force openai@7.8.0 in order to clear a Socket 'potential vulnerability' alert on the 4.x pulled in by @genkit-ai/compat-oai. The change is confined to examples/genkit-agent, not production/library code. The description reasonably justifies why the parent packages can't be bumped and calls out the compatibility surface used by this example (non-streaming ai.generate() → chat.completions.create, APIError export), acknowledging that streaming via compat-oai would break under 7.x. Dependency-change trigger fires but the risk is limited to an example. Approving as a Medium judgment call with an inline comment about package-manager compatibility of the overrides field.
Summary of Changes
Adds an overrides block to examples/genkit-agent/package.json pinning openai to 7.8.0 to override the transitive openai@4.104.0 (via @genkit-ai/compat-oai@1.41.0) flagged by Socket. No source code changes.
Escalation Triggers
- Dependency Changes: Modifies examples/genkit-agent/package.json, adding an
overridesentry forcing a major version jump (openai 4.x → 7.8.0) on a transitive dependency.
Notes
No lockfile appears in the Files Changed list; the description states 'The lockfile no longer resolves 4.104.0', so a lockfile update was likely made and either filtered out of the diff view or should have been committed. Reviewers should verify the lockfile in the branch actually reflects openai@7.8.0.
Path filtering: 1 file excluded by ignore paths. 1 of 2 files included in review.
Review: 7f3c50fc | Model: anthropic/claude-opus-4-7 | Powered by Arcjet Review
| "typescript": "5.9.3" | ||
| }, | ||
| "overrides": { | ||
| "openai": "7.8.0" |
There was a problem hiding this comment.
Which package manager does this example use? The top-level overrides field is npm's convention; pnpm reads pnpm.overrides and Yarn Classic uses resolutions. If this example is installed with pnpm/yarn, this override may silently be ignored and openai@4.104.0 will still be resolved transitively. Worth confirming with a fresh install + npm ls openai (or the equivalent) that only 7.8.0 is present, and either mirroring the override under pnpm.overrides/resolutions or documenting that npm is required here.
| "typescript": "5.9.3" | ||
| }, | ||
| "overrides": { | ||
| "openai": "7.8.0" |
There was a problem hiding this comment.
The PR description notes streaming via compat-oai breaks on openai 7.x because client.beta.chat.completions.stream is gone. Could you add a short comment in the README (or near the example's generate call) noting that this example is intentionally non-streaming and that enabling streaming would require reverting/relaxing this override? That will save the next contributor from a confusing runtime error.
Add OVERRIDES.md so the Socket pin on openai@4.104.0 is documented: why we cannot bump Genkit, what 7.8.0 is compatible with, and when to remove the override. Link it from CONTRIBUTING and the example README. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
c5668d5
into
david/cursor/genkit-agent-example
* feat(examples): add genkit-agent (Genkit Guard example) Vendors unpublished @arcjet/guard/genkit/v1 from arcjet-js@f7619e4c1c2a4f48a3342b7f8ab74a928ceb7309 (david/cursor/guard-genkit-v1-8e4b). Shows inbound screening before generate(), guardTool on lookup_order, and guardMiddleware on an unwrapped tool. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> * fix(examples): slim genkit-agent to match other Guard examples Drop extra comments, page diagnostics, and README sections so the demo matches mastra-agent's shape. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> * deps(genkit-agent): override openai to 7.8.0 for Socket alert (#205) * deps(genkit-agent): override openai to 7.8.0 Socket blocks PR 201 on a medium "potential vulnerability" in openai@4.104.0, pulled in by @genkit-ai/compat-oai@1.41.0. genkit and @genkit-ai/compat-oai are already latest and still declare openai@^4.95.0, so override the transitive pin to the current openai release. The example uses non-streaming ai.generate(), which maps to client.chat.completions.create — still present on 7.x. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> * docs: record genkit-agent openai override Add OVERRIDES.md so the Socket pin on openai@4.104.0 is documented: why we cannot bump Genkit, what 7.8.0 is compatible with, and when to remove the override. Link it from CONTRIBUTING and the example README. Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> * deps(genkit-agent): use published @arcjet/guard 1.11.0 (#206) @arcjet/guard@1.11.0 exports ./genkit/v1, so drop the vendored build from david/cursor/guard-genkit-v1-8e4b. npm ci now installs from the registry; Docker no longer copies vendor/. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: David Mytton <davidmytton@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: David Mytton <davidmytton@users.noreply.github.com>
Socket’s blocking alert on #201 is a medium potential vulnerability on
openai@4.104.0, pulled in by@genkit-ai/compat-oai@1.41.0.Cannot update the parent packages.
genkitand@genkit-ai/compat-oaiare already at latest (1.41.0). Upstream still declaresopenai@^4.95.0, and evencompat-oai@1.42.0-rc.1on genkitmainkeeps that pin. There is no published 4.x newer than 4.104.0, and no GHSA — this is Socket’s own “potential vulnerability” class.Workaround: npm
overridesforceopenai@7.8.0(current latest). The lockfile no longer resolves 4.104.0.Compatibility: this example uses non-streaming
ai.generate(), which maps toclient.chat.completions.create— still present on 7.x.APIErrorremains a named export.client.beta.chat.completions.streamis gone in 7.x, so Genkit streaming throughcompat-oaiwould break; this demo does not stream.Docs:
OVERRIDES.mdrecords why the pin exists and when to remove it. Linked fromCONTRIBUTING.mdand the genkit-agent README.Other Socket Block rows on #201 are AI “code anomaly” signals on Genkit’s telemetry stack (
@genkit-ai/core, firebase, otel, zod, …). Those come withgenkititself and are not cleared by this override.This PR is meant to land on #201 (
david/cursor/genkit-agent-example).