René's URL Explorer Experiment


Title: [Rust] weird behavior in dataflow when trying to select a specific node · Issue #19983 · github/codeql · GitHub

Open Graph Title: [Rust] weird behavior in dataflow when trying to select a specific node · Issue #19983 · github/codeql

X Title: [Rust] weird behavior in dataflow when trying to select a specific node · Issue #19983 · github/codeql

Description: (Apologies for the vague issue title, but I just didn't know any better title...) Description of the issue (I don't think this is related to #19982 but linking anyway) When running the "working base version" (see below for code), I succe...

Open Graph Description: (Apologies for the vague issue title, but I just didn't know any better title...) Description of the issue (I don't think this is related to #19982 but linking anyway) When running the "working bas...

X Description: (Apologies for the vague issue title, but I just didn't know any better title...) Description of the issue (I don't think this is related to #19982 but linking anyway) When running the &quo...

Opengraph URL: https://github.com/github/codeql/issues/19983

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Rust] weird behavior in dataflow when trying to select a specific node","articleBody":"(Apologies for the vague issue title, but I just didn't know any better title...)\n\n**Description of the issue**\n\n(I don't _think_ this is related to https://github.com/github/codeql/issues/19982 but linking anyway)\n\nWhen running the \"working base version\" (see below for code), I successfully find flow from the argument `data` to `remaining_len - 4 - tail_len..remaining_len - 4` just as I wanted:\n\n\u003cimg width=\"1873\" height=\"486\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/76a7451f-5271-4b21-9643-b43faf491b07\" /\u003e\n\n#### `source` change\n\nThe problem appears when I change the source predicate to this more general version (all results of `read_region` are assumed to return user-controlled data) where I've manually verified that the result of `read_region` is used in a call with a `data` argument:\n```ql\npredicate isSource(DataFlow::Node node) {\n    exists(CallExpr ce, Function f | f.getName().getText() = \"read_region\" |\n      node.asExpr().getExpr() = ce and ce.getStaticTarget() = f\n    ) and\n    node.getLocation().getStartLine() = 727\n  }\n```\n\nThis results in ZERO alerts/#select/nodes/subpaths/edges.\n\n#### any() filtering in `sink`\n\nSo obviously, I tried to debug it and for that I changed the sink predicate to this:\n```ql\n  predicate isSink(DataFlow::Node node) {\n    any()\n  }\n```\n(Yes, yes, there is partial flow and stuff, but good old `any` works pretty well in simple cases :P)\nThis is exactly the flow I'm trying to find.\n\u003cimg width=\"1844\" height=\"392\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/50ca0760-6a47-4c8c-8228-a880180db317\" /\u003e\n\n#### RangeExpr filtering in `sink`\n\nWhat happens if I change my sink predicate to check whether the node is a `RangeExpr` using `node.asExpr().getExpr() instanceof RangeExpr`? That should work, because earlier, `sink.getNode().asExpr().getExpr().getAPrimaryQlClass()` returned `RangeExpr`, right?\n\nWell, we get ZERO alerts/.../... again.\n\n#### getStartLine filterting in `sink`\n\nOkay, then let's change the predicate to `node.getLocation().getStartLine() = 20` because that should also work as we verified that the node of interested has its start line indeed in line 20.\n\nThis **does** give us four results:\nbut our `RangeExpr` is nowhere to be found!?\n\n\u003cimg width=\"916\" height=\"854\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/7effa8c5-2335-4cfd-8f7b-cf9e17aca92f\" /\u003e\n\n### two `sections.rs` files\nThere exist two `sections.rs` files:\n`cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af^/src.zip/home/sg/dev/cosmwasm/packages/std/src/sections.rs`\nand\n`cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af^/src.zip/home/sg/dev/cosmwasm/packages/vm/src/sections.rs`\nbut I don't really see how that could be relevant, but highlighting anyway.\n\n### Summary\nI'm not sure whether I did something dumb or whether I've run into a bug :)\n\n**Reproduction steps**\n```\ngit clone https://github.com/CosmWasm/cosmwasm.git\ngit checkout cf413c5ad6a58a87e0be894584f01506f3b2e0af^\ncodeql database create --language=rust \"cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af^\" --overwrite\n```\n\n\"Working base version\"\n```ql\n/**\n * @name Empty block\n * @kind path-problem\n * @problem.severity warning\n * @id rust/example/empty-block\n */\n\nimport rust\nimport codeql.rust.dataflow.DataFlow\nimport codeql.rust.dataflow.TaintTracking\n\nmodule MyConfig implements DataFlow::ConfigSig {\n  predicate isSource(DataFlow::Node node) {\n    node.asPat().getPat().(IdentPat).getName().getText() = \"data\"\n  }\n\n  predicate isSink(DataFlow::Node node) {\n    exists(IndexExpr ie | node.asExpr().getExpr().(RangeExpr) = ie.getIndex())\n  }\n\n  predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {\n    // If the start/end of a range is tainted, then the whole range is tainted.\n    exists(RangeExpr re |\n      pred.asExpr().getExpr() = [re.getStart(), re.getEnd()] and\n      succ.asExpr().getExpr() = re\n    )\n    or\n    // Propagate taint from `tainted` to the result of `tainted?`\n    exists(TryExpr te |\n      te.getExpr() = pred.asExpr().getExpr() and\n      te = succ.asExpr().getExpr()\n    )\n    or\n    // Propagate taint from `tainted` to `[tainted]`\n    exists(ArrayListExpr ale |\n      ale.getAnExpr() = pred.asExpr().getExpr() and\n      ale = succ.asExpr().getExpr()\n    )\n    or\n    // Propagate taint from `tainted` to `from_be_bytes(tainted)`\n    exists(CallExpr ce, Function f |\n      pred.asExpr().getExpr() = ce.getArg(0) and\n      succ.asExpr().getExpr() = ce and\n      ce.getStaticTarget() = f and\n      f.getName().getText() = \"from_be_bytes\"\n    )\n    or\n    // Propagate taint from `tainted` to `tainted as usize`\n    exists(CastExpr ce |\n      pred.asExpr().getExpr() = ce.getExpr() and\n      succ.asExpr().getExpr() = ce and\n      pred.getLocation().getFile().getAbsolutePath().matches(\"%section%\")\n    )\n  }\n}\n\nmodule Flow = TaintTracking::Global\u003cMyConfig\u003e;\n\nimport Flow::PathGraph\n\nfrom Flow::PathNode source, Flow::PathNode sink\nwhere Flow::flowPath(source, sink)\nselect sink, source, sink,\n  \"PrimaryQlClass: \" + sink.getNode().asExpr().getExpr().getAPrimaryQlClass() + \"start: \" +\n    sink.getLocation().getStartLine()\n```\n\n**Files**\n\n[cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af^.zip](https://github.com/intrigus-lgtm/file-dump/releases/tag/cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af.zip)","author":{"url":"https://github.com/intrigus-lgtm","@type":"Person","name":"intrigus-lgtm"},"datePublished":"2025-07-05T15:01:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/19983/codeql/issues/19983"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:02b11784-baa3-2766-6e4e-cc541375ff5b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDD36:39430A:1B23139:2716C4A:6A4CE1AC
html-safe-noncebfa942a87e6e1b65e357ad77cb6b0e654950ec6168de401dd3c1c9a8ced2e128
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDM2OjM5NDMwQToxQjIzMTM5OjI3MTZDNEE6NkE0Q0UxQUMiLCJ2aXNpdG9yX2lkIjoiNDI5MDgzNzgzMjc1NzIwNzQ2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac00aed5990868474107a60b5a9d5e5865c8303d670a346765ab5ab8381b75469f
hovercard-subject-tagissue:3205064836
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/codeql/19983/issue_layout
twitter:imagehttps://opengraph.githubassets.com/45ee495fd064b0d648b6ee3e6fdbfd09e9fb79c0e81f698f99984de1a3f23a9e/github/codeql/issues/19983
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/45ee495fd064b0d648b6ee3e6fdbfd09e9fb79c0e81f698f99984de1a3f23a9e/github/codeql/issues/19983
og:image:alt(Apologies for the vague issue title, but I just didn't know any better title...) Description of the issue (I don't think this is related to #19982 but linking anyway) When running the "working bas...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameintrigus-lgtm
hostnamegithub.com
expected-hostnamegithub.com
None299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8
turbo-cache-controlno-preview
go-importgithub.com/github/codeql git https://github.com/github/codeql.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id143040428
octolytics-dimension-repository_nwogithub/codeql
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id143040428
octolytics-dimension-repository_network_root_nwogithub/codeql
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec5a57f04eeb310f57c73fd6d751d957e2ca27ed2
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/github/codeql/issues/19983#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fissues%2F19983
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fissues%2F19983
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github%2Fcodeql
Reloadhttps://github.com/github/codeql/issues/19983
Reloadhttps://github.com/github/codeql/issues/19983
Reloadhttps://github.com/github/codeql/issues/19983
Please reload this pagehttps://github.com/github/codeql/issues/19983
github https://github.com/github
codeqlhttps://github.com/github/codeql
Notifications https://github.com/login?return_to=%2Fgithub%2Fcodeql
Fork 2k https://github.com/login?return_to=%2Fgithub%2Fcodeql
Star 9.8k https://github.com/login?return_to=%2Fgithub%2Fcodeql
Code https://github.com/github/codeql
Issues 987 https://github.com/github/codeql/issues
Pull requests 424 https://github.com/github/codeql/pulls
Discussions https://github.com/github/codeql/discussions
Actions https://github.com/github/codeql/actions
Projects https://github.com/github/codeql/projects
Models https://github.com/github/codeql/models
Security and quality 0 https://github.com/github/codeql/security
Insights https://github.com/github/codeql/pulse
Code https://github.com/github/codeql
Issues https://github.com/github/codeql/issues
Pull requests https://github.com/github/codeql/pulls
Discussions https://github.com/github/codeql/discussions
Actions https://github.com/github/codeql/actions
Projects https://github.com/github/codeql/projects
Models https://github.com/github/codeql/models
Security and quality https://github.com/github/codeql/security
Insights https://github.com/github/codeql/pulse
[Rust] weird behavior in dataflow when trying to select a specific nodehttps://github.com/github/codeql/issues/19983#top
https://github.com/hvitved
questionFurther information is requestedhttps://github.com/github/codeql/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/intrigus-lgtm
intrigus-lgtmhttps://github.com/intrigus-lgtm
on Jul 5, 2025https://github.com/github/codeql/issues/19983#issue-3205064836
#19982https://github.com/github/codeql/issues/19982
https://private-user-images.githubusercontent.com/60750685/462780952-76a7451f-5271-4b21-9643-b43faf491b07.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM0MjM3MDUsIm5iZiI6MTc4MzQyMzQwNSwicGF0aCI6Ii82MDc1MDY4NS80NjI3ODA5NTItNzZhNzQ1MWYtNTI3MS00YjIxLTk2NDMtYjQzZmFmNDkxYjA3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzA3VDExMjMyNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJiNjBiZDAzZjkxMDMyMmVlYjI5NDI3NTBhNjAwYmRjOWFkZTM4ODg1NWUzYThkMTNhNGI0MGFhYmIzOWJmZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.v7b5WqgOIz42VOFoI-OU77gi365EhHDRURwlQZKbfr8
https://private-user-images.githubusercontent.com/60750685/462781463-50ca0760-6a47-4c8c-8228-a880180db317.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODM0MjM3MDUsIm5iZiI6MTc4MzQyMzQwNSwicGF0aCI6Ii82MDc1MDY4NS80NjI3ODE0NjMtNTBjYTA3NjAtNmE0Ny00YzhjLTgyMjgtYTg4MDE4MGRiMzE3LnBuZz9YLUFt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NzA3MWM2NTlkZTMyNzU0ZDk5ZjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.WAPLljzinxRoGKrlrYHXMVKaD8zRBNqPFDROA1drGV0
cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af^.ziphttps://github.com/intrigus-lgtm/file-dump/releases/tag/cosmwasm-db-cf413c5ad6a58a87e0be894584f01506f3b2e0af.zip
hvitvedhttps://github.com/hvitved
questionFurther information is requestedhttps://github.com/github/codeql/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.