Skip to content

web: js: trim values before passing to wasm#244

Merged
qwandor merged 1 commit into
google:mainfrom
prashantrahul141:web-trim
Jul 9, 2026
Merged

web: js: trim values before passing to wasm#244
qwandor merged 1 commit into
google:mainfrom
prashantrahul141:web-trim

Conversation

@prashantrahul141

Copy link
Copy Markdown
Contributor

User input values are currently directly passed to wasm as long as they are more than 0 characters long. This also means that having an ascii whitespace leads to input being invalid.

This patch introduces trimming before passing it to wasm and also before saving it in the url. So sharing the url is also safe.

Side note: I used an intermediate value because updating {register}.value makes it impossible to type any ascii whitespaces in the input box. It does sound nice but in my opinion, it feels too restrictive.

closes #239

User input values are currently directly passed to wasm as long as they
are more than 0 characters long. This also means that having an ascii
whitespace leads to input being invalid.

This patch introduces trimming before passing it to wasm and also before
saving it in the url. So sharing the url is also safe.

Signed-off-by: Prashant Rahul <prashantrahul141@protonmail.com>
@google-cla

google-cla Bot commented Jul 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.25%. Comparing base (60249f2) to head (f87a606).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #244   +/-   ##
=======================================
  Coverage   16.25%   16.25%           
=======================================
  Files          26       26           
  Lines        1741     1741           
  Branches     1741     1741           
=======================================
  Hits          283      283           
  Misses       1438     1438           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qwandor qwandor merged commit ed80928 into google:main Jul 9, 2026
10 checks passed
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.

Trim input before decode on the web interface

3 participants