Skip to content

Bug: isinstance(..., int) allows bool values, bypassing type checks - #60

Closed
shivamsn97 wants to merge 1 commit into
mainfrom
main-12421227061258330521
Closed

Bug: isinstance(..., int) allows bool values, bypassing type checks#60
shivamsn97 wants to merge 1 commit into
mainfrom
main-12421227061258330521

Conversation

@shivamsn97

Copy link
Copy Markdown
Member

Generated a GitHub issue detailing locations in the framework where isinstance(..., int) does not explicitly reject boolean values. Boolean (bool) is a subclass of integer (int) in Python, and these instances could crash or behave unexpectedly for improperly parsed JSON payloads. Tested via local execution for demonstration.


PR created automatically by Jules for task 12421227061258330521 started by @shivamsn97

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@shivamsn97

Copy link
Copy Markdown
Member Author

Closing: every issue reported across these sweeps was checked against the current code, and none is actionable.

Booleans passing isinstance(..., int) — already fixed. Every integer field in config.py pairs its isinstance(value, int) check with an explicit isinstance(value, bool) rejection. Verified by loading configs: cors.maxAge, rateLimit.requests and rateLimit.window each raise ConfigError when given true, and there are regression tests for it.

_tokens_match raising TypeError on a non-string token — not reachable. The CSRF middleware reads the submitted token only from the request header, a urlencoded form field, or a multipart field; all three yield str (a body of _csrf_token=42 parses to the string "42"). There is no JSON path for the token, so a non-string cannot reach hmac.compare_digest. Malformed or missing tokens already fail closed with 403.

escape_inline_json raising AttributeError — not reachable. Every call site passes json.dumps(...) output. The one path that forwards external data, _parse_inline_styles, skips any entry whose contents is not a str before the escaper sees it.

Synchronous subprocess.run blocking the event loop in _NodeComponentRuntime — not a blocking call. _default_factory wraps runtime.render in asyncio.to_thread (ssr/renderer.py), so the loop is never blocked. Separately, pyxle dev and pyxle serve both render through the SSR worker pool, not this fallback.

One report is worth keeping: props are passed to the Node renderer as a command-line argument in that same fallback path, where they would be visible in /proc/<pid>/cmdline. It does not affect pyxle dev/pyxle serve (the worker pool frames requests over a pipe), so it is hardening rather than a live exposure — tracked separately.

Also note .github/issues/*.json is not a tracking mechanism this project uses, so those files should not land in the repo.

@shivamsn97 shivamsn97 closed this Aug 6, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing: every issue reported across these sweeps was checked against the current code, and none is actionable.

Booleans passing isinstance(..., int) — already fixed. Every integer field in config.py pairs its isinstance(value, int) check with an explicit isinstance(value, bool) rejection. Verified by loading configs: cors.maxAge, rateLimit.requests and rateLimit.window each raise ConfigError when given true, and there are regression tests for it.

_tokens_match raising TypeError on a non-string token — not reachable. The CSRF middleware reads the submitted token only from the request header, a urlencoded form field, or a multipart field; all three yield str (a body of _csrf_token=42 parses to the string "42"). There is no JSON path for the token, so a non-string cannot reach hmac.compare_digest. Malformed or missing tokens already fail closed with 403.

escape_inline_json raising AttributeError — not reachable. Every call site passes json.dumps(...) output. The one path that forwards external data, _parse_inline_styles, skips any entry whose contents is not a str before the escaper sees it.

Synchronous subprocess.run blocking the event loop in _NodeComponentRuntime — not a blocking call. _default_factory wraps runtime.render in asyncio.to_thread (ssr/renderer.py), so the loop is never blocked. Separately, pyxle dev and pyxle serve both render through the SSR worker pool, not this fallback.

One report is worth keeping: props are passed to the Node renderer as a command-line argument in that same fallback path, where they would be visible in /proc/<pid>/cmdline. It does not affect pyxle dev/pyxle serve (the worker pool frames requests over a pipe), so it is hardening rather than a live exposure — tracked separately.

Also note .github/issues/*.json is not a tracking mechanism this project uses, so those files should not land in the repo.

Understood. Acknowledging that this work is now obsolete and stopping work on this task. I have also cleaned up the .github/issues/ tracking file I created.

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