Skip to content

fix(anthropic): bound retained image position keys - #580

Open
luvs01 wants to merge 2 commits into
devfrom
codex/analyze-security-vulnerability-in-opencodex
Open

luvs01 wants to merge 2 commits into
devfrom
codex/analyze-security-vulnerability-in-opencodex

Conversation

@luvs01

@luvs01 luvs01 commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Close a process-persistent memory-growth vulnerability where attacker-controlled, unbounded media-type strings were embedded verbatim in the in-memory position-store keys, allowing retained-key heap exhaustion across requests.

Description

  • Replace variable-length media-type keys with fixed-size SHA-256 identities computed over the image bytes and a canonicalized, length-bounded media type so caller-controlled metadata cannot grow keys unbounded.
  • Introduce a PositionEntry shape tracking sizeBytes and storedAt, maintain positionBytes accounting, and delete/evict position entries with deletePositionEntry() to keep byte accounting accurate.
  • Integrate the position-store accounting into the existing retained-store snapshot and oldest-entry eviction path so the app-owned memory budget can observe and evict position-store bytes alongside the encode cache.
  • Add a regression test asserting that megabyte-scale media-type inputs only cost a small, fixed amount of retained bytes and update the transports inventory note to document the fixed-size identity and accounting change.

Testing

  • Ran the focused image-normalize tests with node_modules/bun/bin/bun.exe test tests/adapters/anthropic/anthropic-image-normalize.test.ts, which passed (32 tests) when executed with the repo Bun (1.4.0).
  • Ran PATH="$PWD/node_modules/bun/bin:$PATH" bun run typecheck, bun run structure:check, and bun run privacy:scan, all of which passed.
  • Ran PATH="$PWD/node_modules/bun/bin:$PATH" bun test tests/ci-workflows/file-size-ratchet.test.ts, which passed; the full bun run test execution produced unrelated environment/concurrency failures and was stopped after observing unrelated flakes.

Codex Task


Devin Review

devin-ai-integration Bot and others added 2 commits September 20, 2026 13:22
…forwarded role (lidge-jun#5334 follow-up)

lidge-jun#5334 made the developer wire role tri-state: an undeclared destination folds
it to system. Two suites asserting role:"developer" on the Chat wire were
missed because they are about tool-result repair ordering and document parts,
not role selection — declare the destination, per the convention the change
established.

Verified: both files fail on dev@600075d2 with system-for-developer wire roles
and pass with the declaration.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: luvs01/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 18c27f68-cce1-42df-9e71-44db0289ca8e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-21T00:29:35.380159Z 2554e18 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 21, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant