Title: bug: JSON literals are accepted as numeric survey prefill values · Issue #8213 · formbricks/formbricks · GitHub
Open Graph Title: bug: JSON literals are accepted as numeric survey prefill values · Issue #8213 · formbricks/formbricks
X Title: bug: JSON literals are accepted as numeric survey prefill values · Issue #8213 · formbricks/formbricks
Description: Issue Numeric survey prefill parsing currently accepts JSON literals like true, false, and null as numbers. Examples: ?npsQuestionId=true ?ratingQuestionId=true ?npsQuestionId=null Current behavior: parseNumber("true") returns 1 parseNum...
Open Graph Description: Issue Numeric survey prefill parsing currently accepts JSON literals like true, false, and null as numbers. Examples: ?npsQuestionId=true ?ratingQuestionId=true ?npsQuestionId=null Current behavior...
X Description: Issue Numeric survey prefill parsing currently accepts JSON literals like true, false, and null as numbers. Examples: ?npsQuestionId=true ?ratingQuestionId=true ?npsQuestionId=null Current behavior...
Opengraph URL: https://github.com/formbricks/formbricks/issues/8213
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: JSON literals are accepted as numeric survey prefill values","articleBody":"## Issue\n\nNumeric survey prefill parsing currently accepts JSON literals like `true`, `false`, and `null` as numbers.\n\nExamples:\n\n```text\n?npsQuestionId=true\n?ratingQuestionId=true\n?npsQuestionId=null\n```\n\nCurrent behavior:\n\n- `parseNumber(\"true\")` returns `1`\n- `parseNumber(\"false\")` returns `0`\n- `parseNumber(\"null\")` returns `0`\n- NPS/rating validators can then accept those coerced values as valid numeric prefill answers\n\nExpected behavior: numeric prefill values should only accept actual parsed numbers. JSON booleans/null should be rejected and ignored as invalid prefill values.\n\n## Impact\n\nMalformed or incorrectly generated survey links can silently prefill real NPS/rating answers with unintended values instead of being ignored.\n\n## Fix\n\n`parseNumber` now accepts only finite parsed JSON numbers, avoiding `Number(...)` coercion of booleans/null.\n\n## Tests\n\nAdded regression coverage for:\n\n- `parseNumber(\"true\")`, `parseNumber(\"false\")`, and `parseNumber(\"null\")`\n- `validateNPS(\"true\")` / `validateNPS(\"null\")`\n- `validateRating(..., \"true\")` / `validateRating(..., \"null\")`\n\nVerified:\n\n```bash\ngit diff --check\npnpm vitest run apps/web/modules/survey/link/lib/prefill/parsers.test.ts apps/web/modules/survey/link/lib/prefill/validators.test.ts\npnpm --filter @formbricks/web exec eslint modules/survey/link/lib/prefill/parsers.ts modules/survey/link/lib/prefill/parsers.test.ts modules/survey/link/lib/prefill/validators.test.ts\n```\n\nBranch: https://github.com/bharathkumar39293/formbricks/tree/fix/reject-json-literals-prefill-number\n\nSince PR creation is restricted for contributors, I’m happy to open a PR if access is granted, or a maintainer can cherry-pick the commit.","author":{"url":"https://github.com/bharathkumar39293","@type":"Person","name":"bharathkumar39293"},"datePublished":"2026-06-02T10:01:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/8213/formbricks/issues/8213"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e1d5252e-4106-489a-d918-40937aae07d1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1CC:E17B4:5CC1302:80B0934:6A4BB360 |
| html-safe-nonce | 6d3a5c036b1c61706befbe15e1ffc2403deb08cdb2eb3178153c5f5fa68208e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUNDOkUxN0I0OjVDQzEzMDI6ODBCMDkzNDo2QTRCQjM2MCIsInZpc2l0b3JfaWQiOiIzNjY1OTE1NTA0MTY0MDU3OTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3d7072efd8f5ee0641e52ac78e4684007f0d3623ceeb098a0b625bfe8c792b29 |
| hovercard-subject-tag | issue:4570430796 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/formbricks/formbricks/8213/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e509480c783eff5a1ccfa2ad2f99f2c0ca947b4a670f510c15d0ca47062363a4/formbricks/formbricks/issues/8213 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e509480c783eff5a1ccfa2ad2f99f2c0ca947b4a670f510c15d0ca47062363a4/formbricks/formbricks/issues/8213 |
| og:image:alt | Issue Numeric survey prefill parsing currently accepts JSON literals like true, false, and null as numbers. Examples: ?npsQuestionId=true ?ratingQuestionId=true ?npsQuestionId=null Current behavior... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bharathkumar39293 |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae1c14875555a1dd92bdef45baa6dd9aa796df891e4e471989f7117fe3139fc1 |
| turbo-cache-control | no-preview |
| go-import | github.com/formbricks/formbricks git https://github.com/formbricks/formbricks.git |
| octolytics-dimension-user_id | 105877416 |
| octolytics-dimension-user_login | formbricks |
| octolytics-dimension-repository_id | 500289888 |
| octolytics-dimension-repository_nwo | formbricks/formbricks |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 500289888 |
| octolytics-dimension-repository_network_root_nwo | formbricks/formbricks |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 68fba4ebcf15cde644b66de9a06e0a8582279435 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width