Title: Python: Unexpected flow from RemoteFlowSource · github/codeql · Discussion #5589 · GitHub
Open Graph Title: Python: Unexpected flow from RemoteFlowSource · github/codeql · Discussion #5589
X Title: Python: Unexpected flow from RemoteFlowSource · github/codeql · Discussion #5589
Description: Python: Unexpected flow from RemoteFlowSource
Open Graph Description: I'm working with a fairly easy flow, where the source is RemoteFlowSource and the sinks are both unsafe_dn and unsafe_filter. @app.route("/normal") def normal(): unsafe_dn = "dc=%s" % request.args[...
X Description: I'm working with a fairly easy flow, where the source is RemoteFlowSource and the sinks are both unsafe_dn and unsafe_filter. @app.route("/normal") def normal(): unsafe_dn = "dc=...
Opengraph URL: https://github.com/github/codeql/discussions/5589
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Python: Unexpected flow from RemoteFlowSource","text":"\u003cp dir=\"auto\"\u003eI'm working with a fairly easy flow, where the \u003ccode class=\"notranslate\"\u003esource\u003c/code\u003e is \u003ccode class=\"notranslate\"\u003eRemoteFlowSource\u003c/code\u003e and the sinks are both \u003ccode class=\"notranslate\"\u003eunsafe_dn\u003c/code\u003e and \u003ccode class=\"notranslate\"\u003eunsafe_filter\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"highlight highlight-source-python notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"@app.route(\u0026quot;/normal\u0026quot;)\ndef normal():\n unsafe_dn = \u0026quot;dc=%s\u0026quot; % request.args['dc']\n unsafe_filter = \u0026quot;(user=%s)\u0026quot; % request.args['username']\n\n srv = ldap3.Server('ldap://127.0.0.1', port=1337)\n conn = ldap3.Connection(srv, user=unsafe_dn, auto_bind=True)\n conn.search(unsafe_dn, unsafe_filter, attributes=[\n \u0026quot;testAttr1\u0026quot;, \u0026quot;testAttr2\u0026quot;])\"\u003e\u003cpre class=\"notranslate\"\u003e\u003cspan class=\"pl-en\"\u003e@\u003cspan class=\"pl-s1\"\u003eapp\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eroute\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e\"/normal\"\u003c/span\u003e)\u003c/span\u003e\n\u003cspan class=\"pl-k\"\u003edef\u003c/span\u003e \u003cspan class=\"pl-en\"\u003enormal\u003c/span\u003e():\n \u003cspan class=\"pl-s1\"\u003eunsafe_dn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"dc=%s\"\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e%\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003erequest\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eargs\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'dc'\u003c/span\u003e]\n \u003cspan class=\"pl-s1\"\u003eunsafe_filter\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s\"\u003e\"(user=%s)\"\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e%\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003erequest\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eargs\u003c/span\u003e[\u003cspan class=\"pl-s\"\u003e'username'\u003c/span\u003e]\n\n \u003cspan class=\"pl-s1\"\u003esrv\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eldap3\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eServer\u003c/span\u003e(\u003cspan class=\"pl-s\"\u003e'ldap://127.0.0.1'\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eport\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e1337\u003c/span\u003e)\n \u003cspan class=\"pl-s1\"\u003econn\u003c/span\u003e \u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003eldap3\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003eConnection\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003esrv\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003euser\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-s1\"\u003eunsafe_dn\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eauto_bind\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003eTrue\u003c/span\u003e)\n \u003cspan class=\"pl-s1\"\u003econn\u003c/span\u003e.\u003cspan class=\"pl-c1\"\u003esearch\u003c/span\u003e(\u003cspan class=\"pl-s1\"\u003eunsafe_dn\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eunsafe_filter\u003c/span\u003e, \u003cspan class=\"pl-s1\"\u003eattributes\u003c/span\u003e\u003cspan class=\"pl-c1\"\u003e=\u003c/span\u003e[\n \u003cspan class=\"pl-s\"\u003e\"testAttr1\"\u003c/span\u003e, \u003cspan class=\"pl-s\"\u003e\"testAttr2\"\u003c/span\u003e])\u003c/pre\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThe thing is that, I get three different flows. The first one is the intended one (\u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e(l.3) -\u0026gt; \u003ccode class=\"notranslate\"\u003erequest.args\u003c/code\u003e(l3) -\u0026gt; \u003ccode class=\"notranslate\"\u003erequest.args['dc']\u003c/code\u003e(l.3) -\u0026gt; \u003ccode class=\"notranslate\"\u003eunsafe_dn\u003c/code\u003e), but the other ones are related to \u003ccode class=\"notranslate\"\u003eunsafe_filter\u003c/code\u003e and make some strange jumps (\u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e(l.9) directly jumps to \u003ccode class=\"notranslate\"\u003erequest.args\u003c/code\u003e(l.10) \u0026amp; \u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e(l.9) -\u0026gt;\u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e(l.10)).\u003c/p\u003e\n\u003cp dir=\"auto\"\u003e\u003ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https://user-images.githubusercontent.com/46056498/113349610-9e680180-9338-11eb-967e-955dcab99e6b.png\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/46056498/113349610-9e680180-9338-11eb-967e-955dcab99e6b.png\" alt=\"image\" style=\"max-width: 100%;\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI guess \u003ca href=\"https://github.com/github/codeql/pull/5443#discussion_r605207553\" data-hovercard-type=\"pull_request\" data-hovercard-url=\"/github/codeql/pull/5443/hovercard\"\u003ethis comment\u003c/a\u003e is also related to this issue.\u003cbr\u003e\nComplete unit tests and query: \u003ca class=\"issue-link js-issue-link\" data-error-text=\"Failed to load title\" data-id=\"835026063\" data-permission-text=\"Title is private\" data-url=\"https://github.com/github/codeql/issues/5443\" data-hovercard-type=\"pull_request\" data-hovercard-url=\"/github/codeql/pull/5443/hovercard\" href=\"https://github.com/github/codeql/pull/5443\"\u003e#5443\u003c/a\u003e\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThanks in advance for your time! :D\u003c/p\u003e","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003eI think that \u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e (l.9) -\u0026gt; \u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e (l.10) (in the third path explanation) is use-use flow. That is, the reference to \u003ccode class=\"notranslate\"\u003erequest\u003c/code\u003e on line 10 is \"the next use\" of that variable after the reference on line 9. Use-use flow is normally compressed out of the path explanations, but it may be shown here because we force is to show all subscript reads. However, it seems to also give you the version where it is compressed away in the second path explanation.\u003c/p\u003e","upvoteCount":1,"url":"https://github.com/github/codeql/discussions/5589#discussioncomment-573179"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:dd00a756-8a0c-7afa-fb1f-9cc2c35167f7 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 8886:25A137:88B0BF:BF19C6:6A4C97DD |
| html-safe-nonce | 150eeb14dba9c6df5f7c8d1ffb22b1121370d694c169b95e639b2ca7fe403e50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODg2OjI1QTEzNzo4OEIwQkY6QkYxOUM2OjZBNEM5N0REIiwidmlzaXRvcl9pZCI6IjI5NzI4MjkyNTcxNDk3NDkyMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a954c2be2d40a5de2480b98d329b57d7e198130a89fdd0f3064a85fde6fc5cb6 |
| hovercard-subject-tag | discussion:3303093 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/github/codeql/5589/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/734f2e2d01776c6c94aaa04cfbee707fb3cf62102ec147a22d78d9407d85c637/github/codeql/discussions/5589 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/734f2e2d01776c6c94aaa04cfbee707fb3cf62102ec147a22d78d9407d85c637/github/codeql/discussions/5589 |
| og:image:alt | I'm working with a fairly easy flow, where the source is RemoteFlowSource and the sinks are both unsafe_dn and unsafe_filter. @app.route("/normal") def normal(): unsafe_dn = "dc=%s" % request.args[... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/github/codeql git https://github.com/github/codeql.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 143040428 |
| octolytics-dimension-repository_nwo | github/codeql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143040428 |
| octolytics-dimension-repository_network_root_nwo | github/codeql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7a2dede45637df6b92ddcfe2a557e67d4b5854ae |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width