Title: fix(view): shadow dangerous globals in with-scoped evaluator by JosunLP · Pull Request #188 · bQuery/bQuery · GitHub
Open Graph Title: fix(view): shadow dangerous globals in with-scoped evaluator by JosunLP · Pull Request #188 · bQuery/bQuery
X Title: fix(view): shadow dangerous globals in with-scoped evaluator by JosunLP · Pull Request #188 · bQuery/bQuery
Description: Summary Fixes #168 (Medium hardening). evaluate/evaluateRaw run new Function('$ctx', 'with($ctx){ return (expr); }'). The proxy has trap returned prop in target, so inherited Object.prototype members resolved from the context and constructor.constructor('…')() reached the Function constructor — arbitrary code execution wherever bq-* attributes carry untrusted content. Fix The issue's suggested own-keys-only has trap is necessary but not sufficient: once the proxy declines constructor, with resolution falls through to the enclosing global scope, where the global object inherits constructor from Object.prototype and exposes Function/eval/globalThis. A bare Function('…')() escapes the same way. So the evaluator now shadows a denylist (constructor, __proto__, prototype, Function, eval, globalThis, global, window, self, top, parent): has reports them present (so they never fall through to the global scope) and get resolves them to undefined unless the context legitimately owns that property. Member access on the resulting undefined throws → undefined. Both the lazy (evaluate) and raw (evaluateRaw) paths are covered. Legitimate templates are unaffected: own context props (including ones shadowing a dangerous name), arithmetic, and method calls on context values (e.g. name.toUpperCase()) all still work. Verification Tests: constructor.constructor(…)() on both evaluate and evaluateRaw, bare Function(…)() and eval(…), plus positive cases (own props, method calls, own-prop shadowing a global name). The exploit tests fail on the pre-fix code. Full suite: 2993 pass / 0 fail. tsc --noEmit + eslint clean. 🤖 Generated with Claude Code
Open Graph Description: Summary Fixes #168 (Medium hardening). evaluate/evaluateRaw run new Function('$ctx', 'with($ctx){ return (expr); }'). The proxy has trap returned prop in target, so inherited Object...
X Description: Summary Fixes #168 (Medium hardening). evaluate/evaluateRaw run new Function('$ctx', 'with($ctx){ return (expr); }'). The proxy has trap returned prop in target, so ...
Opengraph URL: https://github.com/bQuery/bQuery/pull/188
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f829bd43-4c0c-dabe-34d5-fd3c1cb4f3d5 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CABC:1162D4:173BA0C:21FAB66:6A4E4EBB |
| html-safe-nonce | dec6d7d4184b5af2e558534583f337b70765dd83fdbed7f55090ce3b4009bb0f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUJDOjExNjJENDoxNzNCQTBDOjIxRkFCNjY6NkE0RTRFQkIiLCJ2aXNpdG9yX2lkIjoiMjMwOTY2ODU5NDIwMjMzMjg1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | beb8dbae2e9fa1d22c7604c4997cab6c58c7c6f3d5896485d39778b999003717 |
| hovercard-subject-tag | pull_request:4001000559 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/bQuery/bQuery/pull/188/files |
| twitter:image | https://avatars.githubusercontent.com/u/20913954?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/20913954?s=400&v=4 |
| og:image:alt | Summary Fixes #168 (Medium hardening). evaluate/evaluateRaw run new Function('$ctx', 'with($ctx){ return (expr); }'). The proxy has trap returned prop in target, so inherited Object... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/bQuery/bQuery git https://github.com/bQuery/bQuery.git |
| octolytics-dimension-user_id | 256381806 |
| octolytics-dimension-user_login | bQuery |
| octolytics-dimension-repository_id | 1139284244 |
| octolytics-dimension-repository_nwo | bQuery/bQuery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1139284244 |
| octolytics-dimension-repository_network_root_nwo | bQuery/bQuery |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e8506f6d0538364886e3f0153c154c410965e70d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width