C++: Add taint models for boost::asio::ip::resolve - #22524
Open
MathiasVP wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The summaries omit taint propagation from the service parameter, and the tests do not cover that flow.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
cpp/ql/lib/ext/Boost.Asio.model.yml — These four summaries only propagate taint from host, but service also determines every returned… |
|
cpp/ql/test/library-tests/dataflow/external-models/asio_streams.cpp — All new calls use a tainted host with a constant empty service, so the fixture cannot detect… |
What changed in this PR
Adds C++ taint models for Boost.Asio resolver overloads across string and string-view configurations.
Changes:
- Models synchronous
basic_resolver::resolveoverloads. - Adds fixtures covering overload signatures.
- Updates generated test expectations.
| File | Description |
|---|---|
cpp/ql/lib/ext/Boost.Asio.model.yml |
Adds resolver taint summaries. |
cpp/ql/test/library-tests/dataflow/external-models/asio_streams.cpp |
Adds resolver fixtures. |
cpp/ql/test/library-tests/dataflow/external-models/flow.expected |
Updates expected model flows. |
cpp/ql/test/library-tests/dataflow/external-models/sinks.expected |
Updates shifted sink locations. |
cpp/ql/test/library-tests/dataflow/external-models/sources.expected |
Updates shifted source locations. |
cpp/ql/test/library-tests/dataflow/external-models/steps.expected |
Adds resolver steps. |
cpp/ql/test/library-tests/dataflow/external-models/validatemodels.expected |
Updates validation output. |
cpp/ql/test/library-tests/dataflow/taint-tests/test_mad-signatures.expected |
Adds matched signatures. |
Suppressed comments (3)
cpp/ql/lib/ext/Boost.Asio.model.yml:33
- The
string_viewoverloads likewise omit flow fromservice, even though it contributes the returned endpoint's port. Add argument 1 as an input for each signature.
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,error_code &)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(string_view,string_view,flags,error_code &)", "", "Argument[0]", "ReturnValue", "taint", "manual"]
cpp/ql/lib/ext/Boost.Asio.model.yml:37
- For the protocol-taking string overloads,
serviceis argument 2 and also contributes to the resolved endpoints. Without correspondingArgument[*2]rows, service-controlled ports are treated as untainted.
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,error_code &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,const string &,const string &,flags,error_code &)", "", "Argument[*1]", "ReturnValue", "taint", "manual"]
cpp/ql/lib/ext/Boost.Asio.model.yml:41
- These protocol-taking
string_viewsummaries also drop taint from argument 2 (service), so a service-derived endpoint is incomplete. Add argument 2 as an input for all four signatures.
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,error_code &)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
- ["boost::asio::ip", "basic_resolver<InternetProtocol>", False, "resolve", "(const InternetProtocol &,string_view,string_view,flags,error_code &)", "", "Argument[1]", "ReturnValue", "taint", "manual"]
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


This PR adds taint models for all the overloads of the ip::basic_resolver::resolve member function. This was needed for some internal Microsoft work.
Annoyingly, whether the interesting parameter is a
const std::string&or aboost::asio::string_viewdepends on a macroBOOST_ASIO_STRING_VIEW_PARAM(see here) so we need to handle both cases in MaD.