You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent vulnerabilities
Status: Incomplete input validation: The new set_screen_settings_override validates width/height but does not validate that contexts/user_contexts are non-empty lists of strings before sending them over the BiDi connection.
Correctly construct command parameters for override
Initialize params as an empty dictionary and only add the screenArea key if width and height are provided. This ensures the override is cleared correctly by omitting the parameter instead of sending null.
-screen_area = None+params: dict[str, Any] = {}
if width is not None and height is not None:
if not isinstance(width, int) or not isinstance(height, int):
raise ValueError("width and height must be integers")
if width < 0 or height < 0:
raise ValueError("width and height must be >= 0")
- screen_area = {"width": width, "height": height}+ params["screenArea"] = {"width": width, "height": height}-params: dict[str, Any] = {"screenArea": screen_area}-
Apply / Chat
Suggestion importance[1-10]: 8
__
Why: This suggestion correctly identifies a potential bug where sending {"screenArea": null} might not clear the override as intended, and proposes a fix that aligns with common BiDi protocol patterns, improving the method's correctness.
Medium
General
Simplify test structure by removing nesting
Simplify the test structure by replacing the nested try...finally blocks with a single block. This improves readability by reducing nesting while ensuring proper resource cleanup.
Why: The suggestion improves code readability and structure by removing unnecessary nested try...finally blocks in the test, making the cleanup logic more straightforward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issues
💥 What does this PR do?
Adds support for
emulation.setScreenSettingsOverrideto the python bindings - https://w3c.github.io/webdriver-bidi/#command-emulation-setScreenSettingsOverride🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes