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
This PR fetches the browser_protocol file, retrieves all the includes, fetches them, and concatenates the files into a single browser_protocol.pdl file, allowing the rest of the process to continue.
PR Type
Bug fix
Description
Implements fetching and concatenation of Chrome DevTools Protocol domain files
Adds flatten_browser_pdl() function to resolve include directives in browser_protocol.pdl
Fetches individual domain .pdl files from Chromium repository and merges them
Integrates flattening step into the CDP update workflow
Diagram Walkthrough
flowchart LR
A["Fetch browser_protocol.pdl"] --> B["Parse include directives"]
B --> C["Fetch domain .pdl files"]
C --> D["Concatenate domains"]
D --> E["Overwrite browser_protocol.pdl"]
Loading
File Walkthrough
Relevant files
Bug fix
update_cdp.py
Implement browser_protocol.pdl flattening for Chromium file structure
scripts/update_cdp.py
Added flatten_browser_pdl() function to parse and fetch included domain files
Extracts include directives using regex pattern matching
Fetches domain files from Chromium repository and concatenates them
Integrated flattening step into add_pdls() workflow after initial fetch
Below is a summary of compliance checks for this PR:
Security Compliance
⚪
Unvalidated remote write
Description: The code fetches and writes remote content directly to the local protocol file without validating response status, size, or content type, which could allow corrupted or malicious data to be persisted if the upstream or network is compromised. update_cdp.py [75-81]
Referred Code
fordomain_fileinincludes:
url=base_url+domain_fileresponse=http.request("GET", url)
concatenated+=response.data.decode("utf-8") +"\n"# Overwrite the file with concatenated domainswithopen(file_path, "w") asfile:
file.write(concatenated)
Add a status check after the HTTP request to ensure it was successful (status 200), and raise an exception if it failed to prevent generating a corrupted file.
Why: The suggestion correctly identifies missing error handling for a network request, which could lead to silent failures and corrupted files. Implementing this check improves the script's robustness.
Medium
Learned best practice
Properly close HTTP responses
Ensure the HTTP response is closed after use to avoid leaking connections; use a context manager with preload_content=False or explicitly release it.
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
🔗 Related Issues
Fixes #16299
💥 What does this PR do?
See the linked issue for more details.
This PR fetches the browser_protocol file, retrieves all the includes, fetches them, and concatenates the files into a single
browser_protocol.pdlfile, allowing the rest of the process to continue.PR Type
Bug fix
Description
Implements fetching and concatenation of Chrome DevTools Protocol domain files
Adds
flatten_browser_pdl()function to resolve include directives in browser_protocol.pdlFetches individual domain .pdl files from Chromium repository and merges them
Integrates flattening step into the CDP update workflow
Diagram Walkthrough
File Walkthrough
update_cdp.py
Implement browser_protocol.pdl flattening for Chromium file structurescripts/update_cdp.py
flatten_browser_pdl()function to parse and fetch includeddomain files
add_pdls()workflow after initialfetch