Skip to content

Conversation

@bdrodes
Copy link
Contributor

@bdrodes bdrodes commented Sep 30, 2025

  • Added MaD sinks for URLs in the azure SDK, labeled as 'ssrf'
  • Updated HTTP request clients to use 'ssrf' MaD

@bdrodes bdrodes requested a review from a team as a code owner September 30, 2025 17:58
Copilot AI review requested due to automatic review settings September 30, 2025 17:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Server-Side Request Forgery (SSRF) modeling for the Azure Python SDK by introducing MaD (Models as Data) sinks and updating HTTP request clients to recognize SSRF vulnerabilities. This enables CodeQL to detect when user input can control URLs passed to Azure SDK methods.

  • Added SSRF sink modeling framework for MaD-based HTTP requests
  • Created comprehensive Azure SDK models for KeyVault and Storage services
  • Added test coverage for Azure client SSRF scenarios

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/ql/lib/semmle/python/frameworks/SSRFSink.qll New framework for handling SSRF sinks through MaD models
python/ql/lib/semmle/python/frameworks/Azure.Storage.model.yml MaD definitions for Azure Storage SDK SSRF sinks
python/ql/lib/semmle/python/frameworks/Azure.Keyvault.model.yml MaD definitions for Azure KeyVault SDK SSRF sinks
python/ql/lib/semmle/python/Frameworks.qll Import statement for new SSRFSink framework
python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/test_azure_client.py Test cases for Azure SDK SSRF detection
python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/PartialServerSideRequestForgery.expected Expected results for partial SSRF tests
python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/FullServerSideRequestForgery.expected Expected results for full SSRF tests
python/ql/lib/change-notes/released/2025-09-30-azure_ssrf_models Release notes for the changes

bdrodes and others added 4 commits September 30, 2025 14:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orgery/test_azure_client.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orgery/test_azure_client.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MathiasVP MathiasVP requested a review from tausbn October 14, 2025 15:26
Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the python library in general, but I can review the use of models-as-data.

or
this.getArgByName(_) = urlArg
) and
urlArg = ModelOutput::getASinkNode("ssrf").asSink()
Copy link
Contributor

@owen-mc owen-mc Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Some tests are failing because we do validation on sink kinds and "ssrf" isn't on the list. Please use "request-forgery", which is what all the other languages use. (New sink kinds can of course be added, but if there is an existing one then that should be used first, to keep the different language libraries consistent.)
  • In Python: MaD barriers #21004 we switched to using a slightly different syntax (which matches the static languages). You'll have to rebase on main for this to work.
Suggested change
urlArg = ModelOutput::getASinkNode("ssrf").asSink()
ModelOutput::sinkNode(urlArg, "request-forgery")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@owen-mc
Copy link
Contributor

owen-mc commented Feb 4, 2026

Looking at the other test failures (which aren't related to validation of sink kinds):

  • python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/FullServerSideRequestForgery.qlref and python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/PartialServerSideRequestForgery.qlref are failing because of some line number changes - you should check if the new results make sense, and if so accept them.
  • another test is failing for unrelated reasons. I've made a PR to fix it, which should be merged soon.

@bdrodes bdrodes closed this Feb 4, 2026
@bdrodes
Copy link
Contributor Author

bdrodes commented Feb 4, 2026

Looking at the other test failures (which aren't related to validation of sink kinds):

  • python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/FullServerSideRequestForgery.qlref and python/ql/test/query-tests/Security/CWE-918-ServerSideRequestForgery/PartialServerSideRequestForgery.qlref are failing because of some line number changes - you should check if the new results make sense, and if so accept them.
  • another test is failing for unrelated reasons. I've made a PR to fix it, which should be merged soon.

Fixed.

@bdrodes bdrodes reopened this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants