Skip to content

fix(enex): validate large inline images without regexp stack growth - #209

Merged
koreyba merged 1 commit into
mainfrom
codex/inline-image-validation
Nov 4, 2026
Merged

koreyba merged 1 commit into
mainfrom
codex/inline-image-validation

Conversation

@koreyba

@koreyba koreyba commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

The first main coverage run after #208 rejected a syntactically valid 14,000,000-character base64 image URL: ImageDownloader returned null and the filename assertion failed. Its quantified base64 regexp can overflow the stack when V8 regexp optimization is disabled. The precise V8 tier state in the failed main job is unknown because embedded-image errors deliberately redact their details; the public API failure is independently reproduced in that engine mode.

Remove at most two trailing padding characters, then search for a single invalid alphabet character. Keep the existing MIME whitelist, base64 grouping, proxy restrictions and error redaction. This avoids input-sized regexp stack growth while retaining the accepted short-input grammar.

Validation:

  • Added a deterministic regression that runs the real TypeScript downloader in an isolated Node 24 subprocess with regexp optimization disabled. It failed against the old code (null resource), then passed with correct filename/MIME/data and exactly one synthetic fetch. Parent process flags stay unchanged; there is no external request.
  • All 10 image-service cases pass with coverage, matched Allure scope, complete modeling and zero findings. The existing 14 MB input, assertions and timeout remain; padding/alphabet cases were expanded.
  • Full combined coverage run on exact CI Node 24.22.1: 2,173 passed, 6 existing skips, 0 failures across 2,179 native Jest cases. All 2,178 baseline identities remain plus the new regression. Allure records 2,119 cases with matched expectations and zero findings; the other 60 are existing plain-jsdom docblock cases independently checked in Jest JSON, not test exclusions.
  • 30,000 short inputs matched the old validation grammar. TypeScript, ESLint and diff checks pass.

No CI configuration, assertion budget, retry, timeout or source inclusion setting is changed. All fresh GitHub checks passed at 8aa8cd1, including the new regression, core/web unit, all component shards/aggregate, E2E, Build, CodeQL, Semgrep, Cloudflare, SonarCloud and combined Allure publication. The merged main coverage run independently confirmed this Jest fix.

PR Tests 41844354071 retained all 1,146 component identities with zero retries/flaky/skipped cases and complete Allure modeling. Raw coverage retains all 298 source files; instrumentation maps for 297 unchanged files match the baseline, with only the reviewed image-downloader change differing (+7 statements / +5 branch points). Combined report contains 3,285 results and the new regression passed on GitHub. CodeRabbit was automatically skipped because of repository stars, not completed as review.

Rollout: main fee631bbfa75ca1a88ed053adb5ce2f50fdebd56 Jest coverage job passed all 2,179 cases (2,173 passed, six existing skips), including both large-image cases. That parent run is not green: one of 1,146 component cases exposed a native tab-drag snapping race. Its reproduced cause and minimal fix are tracked in #210; the other 1,145 component cases passed.

Final rollout: merged main 4c734702412c5b948fc268b37a93043d84a61378 coverage run 41854124816 passed all 143 specs / 1,146 original component identities with no retries/flaky/skipped cases; native Jest passed 2,177 with six existing skips (2,183 total). All 298 source maps match the reviewed PR210 tree. Component elapsed 11m57s versus 29m12s baseline (-59.1%); summed family runner time 42m04s (+44.1%). The duplicate main component execution remains removed. Published main report has 3,269 results (3,263 passed, six existing unit skips).

All four main Actions workflows succeeded, but the external main SonarCloud quality gate is still FAILED, independently of its scanner job succeeding. The same C security/reliability conditions already failed on pre-optimization main 3852946. Main’s previous-version baseline starts 2026-03-05: 14 older bug/vulnerability findings remain. The one new S3403 warning on require.main === module is a confirmed false positive: direct CLI execution emits the 143-spec plan, importing the module does not execute CLI, and Node documents this exact CommonJS guard. The finding remains visible; no gate, rule or issue status was changed. All PR checks, including the PR Sonar gate, were green at each exact reviewed head before the guarded merges.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

  • Trigger review

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

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2a865560-e077-48ac-a196-7129eea874f7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Status

Updated for PR #209 at 8aa8cd1 on 2026-11-04T14:22:33.467Z.

📊 Allure Test Report

Open Allure Report

Contributing Workflows

Workflow Status Suites
Unit Tests ✅ Completed Core Unit, Core Integration, Web Unit, Mobile Unit
Component Tests ✅ Completed Web Component
E2E Tests (PR Preview) ✅ Completed Web E2E

Catalog: All reports

🤖 Android Build Panel

Check a box below to trigger a release build:

  • 🚀 Build Stage Release APK
  • 🚀 Build Prod Release APK

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying everfreenote with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8aa8cd1
Status: ✅  Deploy successful!
Preview URL: https://3ed2119d.everfreenote.pages.dev
Branch Preview URL: https://codex-inline-image-validatio.everfreenote.pages.dev

View logs

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Allure Report Summary

Name Duration Stats New Flaky Retry Report
Allure Report Allure Report 13m 14s Passed tests 3279   Skipped tests 6 1 0 0 View

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

New Tests in Allure Report Allure Report

Show 1 new test

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@koreyba
koreyba merged commit fee631b into main Nov 4, 2026
30 checks passed
@koreyba
koreyba deleted the codex/inline-image-validation branch November 4, 2026 14:25
@koreyba
koreyba restored the codex/inline-image-validation branch November 4, 2026 14:27

This branch was previously deployed

1 inactive deployment
Stage — 8aa8cd14 Deployed Nov 4, 2026 by koreyba via build #1052
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