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
Dedicated serialization context for Browser module.
🔄 Types of changes
Cleanup (formatting, renaming)
PR Type
Enhancement
Description
Create dedicated BrowserJsonSerializerContext for Browser module
Remove Browser types from shared BiDiJsonSerializerContext
Update Browser module to use module-specific serialization context
Improve separation of concerns for JSON serialization
Diagram Walkthrough
flowchart LR
A["BiDiJsonSerializerContext<br/>Shared context"] -->|"includes"| B["Browser types<br/>CloseCommand, etc."]
C["BrowserJsonSerializerContext<br/>New dedicated context"] -->|"replaces"| B
D["BrowserModule"] -->|"uses"| C
A -->|"chains to"| C
Objective: To create a detailed and reliable record of critical system actions for security analysis and compliance.
Status: Missing auditing: The new Browser module methods invoke commands without adding or referencing any audit logging of critical actions such as browser close or download behavior changes.
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful degradation
Status: Unhandled failures: The new command executions delegate to Broker without visible error handling or context-specific exceptions, making it unclear how failures or null/edge cases are managed.
Objective: To prevent the leakage of sensitive system information through error messages while providing sufficient detail for internal debugging.
Status: Error exposure unknown: The code adds no user-facing error handling and relies on Broker; without visibility into Broker, it is unclear whether detailed internal errors could be surfaced to callers.
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent vulnerabilities
Status: Input validation gap: Methods accept options and construct parameters passed to Broker without visible validation or sanitization of external inputs such as proxies or behaviors in the new code paths.
Validate destinationFolder (null/empty/whitespace) and normalize/encode or reject invalid values before invoking the command to avoid invalid requests or injection issues.
nvborisenko
changed the title
[dotnet] [bidi] Dedicated json context for Browser module
[dotnet] [bidi] Dedicated json context for all modules
Nov 30, 2025
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.
User description
Dedicated serialization context for Browser module.
🔄 Types of changes
PR Type
Enhancement
Description
Create dedicated
BrowserJsonSerializerContextfor Browser moduleRemove Browser types from shared
BiDiJsonSerializerContextUpdate Browser module to use module-specific serialization context
Improve separation of concerns for JSON serialization
Diagram Walkthrough
File Walkthrough
BrowserModule.cs
Implement dedicated Browser JSON serialization contextdotnet/src/webdriver/BiDi/Browser/BrowserModule.cs
BiDiJsonSerializerContextwith newBrowserJsonSerializerContextInitializemethod to chainBiDiJsonSerializerContextintoBrowser-specific context
BrowserJsonSerializerContextclass with[JsonSerializable]attributes for all Browser types
_jsonContext.Browser_CloseCommandto_jsonContext.CloseCommandBiDiJsonSerializerContext.cs
Remove Browser types from shared contextdotnet/src/webdriver/BiDi/Json/BiDiJsonSerializerContext.cs
[JsonSerializable]attributes for Browser module typesTypeInfoPropertyName