Skip to content

bounded parsing for safety - #3

Merged
MichaelMure merged 1 commit into
masterfrom
bounded-parsing
Oct 10, 2026
Merged

MichaelMure merged 1 commit into
masterfrom
bounded-parsing

Conversation

@MichaelMure

@MichaelMure MichaelMure commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5 Tier: apex

Fix the oversized-edit allocation path before merging; it can exhaust memory before returning the new limit error.

Findings

  1. P1 Security Oversized edits exhaust memory ▶
  2. P2 Command entries escape the ceiling ▶

Summary

Adds 16 MiB, entry/header, and item limits to parsing and edits. File loads now emit entries while parsing and share an entry budget across includes.

  • Uses smaller offsets and avoids retaining file pieces during loads.
  • Adds limit, include-error-order, and memory tests; removes stored benchmark output.
  • Oversized edits still allocate before rejection. The load documentation also overstates the limit for command entries.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["File bytes"] --> B["Byte limit"]
  B --> C["parseFile: entry and item limits"]
  C --> D["Editable File"]
  D --> E["Build replacement text and output"]
  E --> F["parseFile checks edited output"]
  F -->|Accepted| G["Replace File contents"]
  F -->|ErrLoadLimit| H["Keep original contents"]
  I["Env.Load"] --> J["parseEntries with shared budget"]
  J --> K["Emit entry, then follow include"]
  K -->|Included file| J
  K -->|Continue parent| J
Loading

Reviews (1) · Last reviewed commit: "bounded parsing for safety" · Reviewed by Greptile

Comment thread edit.go
Comment thread env.go

@greptile-apps greptile-apps 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.

MichaelMure has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@MichaelMure
MichaelMure merged commit 7cec7f6 into master Oct 10, 2026
3 checks passed
@MichaelMure
MichaelMure deleted the bounded-parsing branch October 10, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant