Skip to content

fix(security): prevent path traversal bypass in WASM HTTP allowlist#137

Merged
ilblackdragon merged 5 commits intonearai:mainfrom
bigguybobby:fix/path-traversal-allowlist-bypass
Feb 18, 2026
Merged

fix(security): prevent path traversal bypass in WASM HTTP allowlist#137
ilblackdragon merged 5 commits intonearai:mainfrom
bigguybobby:fix/path-traversal-allowlist-bypass

Conversation

@bigguybobby
Copy link
Copy Markdown
Contributor

@bigguybobby bigguybobby commented Feb 17, 2026

Summary

Fixes a path traversal bypass in WASM HTTP allowlist validation.

Root Cause

Allowlist path-prefix checks were performed against the raw URL path. A path like /v1/../admin passed a /v1/ prefix check before being normalized by the HTTP layer.

Changes

  • Normalize URL paths in parse_url() before allowlist matching.
  • Add normalize_path() to resolve . and .. segments without escaping root.
  • Add regression tests for traversal and normalization behavior.

Validation

  • Allowlist unit tests pass, including new traversal regression cases.
  • Full test suite passed locally during branch validation.

The allowlist validator checked url_path.starts_with(prefix) on the
raw, unnormalized path. A WASM tool could request a URL like:

  https://api.openai.com/v1/../admin

The starts_with("/v1/") check would pass, but the server would
resolve the ".." and serve /admin — effectively bypassing the
path prefix restriction.

This commit adds normalize_path() which resolves . and .. segments
before validation, closing the bypass. It also includes 6 new tests
covering traversal attacks and normalization correctness.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

@ilblackdragon ilblackdragon merged commit 2d3eb4d into nearai:main Feb 18, 2026
1 of 2 checks passed
ilblackdragon pushed a commit that referenced this pull request Feb 18, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot mentioned this pull request Feb 18, 2026
jaswinder6991 pushed a commit to jaswinder6991/ironclaw that referenced this pull request Feb 26, 2026
…earai#137)

* fix(security): prevent path traversal bypass in WASM HTTP allowlist

The allowlist validator checked url_path.starts_with(prefix) on the
raw, unnormalized path. A WASM tool could request a URL like:

  https://api.openai.com/v1/../admin

The starts_with("/v1/") check would pass, but the server would
resolve the ".." and serve /admin — effectively bypassing the
path prefix restriction.

This commit adds normalize_path() which resolves . and .. segments
before validation, closing the bypass. It also includes 6 new tests
covering traversal attacks and normalization correctness.

* deslop: remove redundant comments, consolidate tests

* chore(allowlist): trim nonessential traversal helper comment

* harden URL parsing for wasm allowlist and proxy paths

---------

Co-authored-by: Illia Polosukhin <ilblackdragon@gmail.com>
jaswinder6991 pushed a commit to jaswinder6991/ironclaw that referenced this pull request Feb 26, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
…earai#137)

* fix(security): prevent path traversal bypass in WASM HTTP allowlist

The allowlist validator checked url_path.starts_with(prefix) on the
raw, unnormalized path. A WASM tool could request a URL like:

  https://api.openai.com/v1/../admin

The starts_with("/v1/") check would pass, but the server would
resolve the ".." and serve /admin — effectively bypassing the
path prefix restriction.

This commit adds normalize_path() which resolves . and .. segments
before validation, closing the bypass. It also includes 6 new tests
covering traversal attacks and normalization correctness.

* deslop: remove redundant comments, consolidate tests

* chore(allowlist): trim nonessential traversal helper comment

* harden URL parsing for wasm allowlist and proxy paths

---------

Co-authored-by: Illia Polosukhin <ilblackdragon@gmail.com>
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants