-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update WireGuard COM interface to pass params instead of config #24261
Conversation
browser/brave_vpn/win/brave_vpn_wireguard_service/status_tray/status_tray_runner.cc
Outdated
Show resolved
Hide resolved
13997db
to
7dc2e0a
Compare
browser/brave_vpn/win/brave_vpn_wireguard_service/service/brave_wireguard_manager.cc
Show resolved
Hide resolved
browser/brave_vpn/win/brave_vpn_wireguard_service/service/wireguard_service_runner.cc
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment here: https://hackerone.com/reports/2481145#activity-28112578
components/brave_vpn/common/wireguard/wireguard_utils_unittest.cc
Outdated
Show resolved
Hide resolved
browser/brave_vpn/win/brave_vpn_wireguard_service/service/brave_wireguard_manager.cc
Show resolved
Hide resolved
7c6191c
to
e8355eb
Compare
e8355eb
to
5d347ea
Compare
address && wcslen(address) == 0 && | ||
endpoint && wcslen(endpoint) == 0; | ||
if (reconnect_using_last_config) { | ||
*last_error = !brave_vpn::wireguard::LaunchWireguardService(L""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we expect this to happen under some circumstances or are we trying to handle an unexpected condition here? If it's the latter I think we should just fail here because we might be unintentionally opening another attack vector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the current behavior - I thought I made comments in this PR explaining... but basically the tray program is passing empty string for the arguments. This triggers the "reconnect using the last known config" logic.
We could rework the tray program - but that's a bigger change of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, best is to harden this part with the follow-up in brave/brave-browser#39229
c19cd52
to
01d22c2
Compare
Issue solved - build works locally 🎉 Investigating the COM interface defined here: brave-core/components/brave_vpn/common/wireguard/win/brave_wireguard_manager_idl.idl Line 7 in 9f8f2e5
There is already a separate CLSID per-channel (Release, Beta, Nightly, etc): brave-core/browser/brave_vpn/win/service_details.cc Lines 29 to 34 in 9f8f2e5
The next step I'm looking at now is making a per-channel IID (interface ID). We could then update the code to return the correct IID per channel here: brave-core/browser/brave_vpn/win/service_details.cc Lines 102 to 104 in 9f8f2e5
And then the IDL can be rebuilt. Basically, if this gets installed, the IID registration (where # of arguments changes) will break other channels trying to use VPN on the machine. If this was merged and installed for Nightly, Release channel VPN would stop working properly for Windows folks because the COM interface changed. |
06867b9
to
b58bef9
Compare
Includes per-field validation for all fields NOTE: this updates the COM IID to avoid breakage for other channels Fixes brave/brave-browser#37960
- Moved wchar_t => std::string to the Windows specific file - Utils methods now all work with std::string - Additional IP address checks - Validation methods now return `std::optional<std::string>`
Code has been tested with PR builder on Windows.
b58bef9
to
755f596
Compare
OK made some changes and verified it works with latest PR builder. |
Tested and this works great 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[puLL-Merge] - brave/brave-core@24261 DescriptionThis PR updates the Brave VPN WireGuard service implementation, particularly focusing on improving security and input validation. The changes include modifying the interface for enabling VPN connections, adding input validation for WireGuard configuration parameters, and updating the COM interface identifier. Possible Issues
Security Hotspots
ChangesChanges
These changes significantly improve the security and robustness of the Brave VPN WireGuard implementation by adding thorough input validation and improving error handling. |
Important to have a default value as methods will only set (using GetLastError) if an error occurs.
Fixes brave/brave-browser#37960
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
See brave/brave-browser#37960