René's URL Explorer Experiment


Title: isSanitizerGuard works incorrectly when the function name startwith "isValid" · Issue #17393 · github/codeql · GitHub

Open Graph Title: isSanitizerGuard works incorrectly when the function name startwith "isValid" · Issue #17393 · github/codeql

X Title: isSanitizerGuard works incorrectly when the function name startwith "isValid" · Issue #17393 · github/codeql

Description: i am try the the codeql query from https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/ ; the code to analysis is copied from tutorial const fs = require('fs'), path = require('path'); f...

Open Graph Description: i am try the the codeql query from https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/ ; the code to analysis is copied from tutorial const fs = ...

X Description: i am try the the codeql query from https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/ ; the code to analysis is copied from tutorial const fs = ...

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

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isSanitizerGuard works incorrectly when the function name startwith \"isValid\"","articleBody":"i am try the the codeql query from https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/ ; \r\nthe code to analysis is copied from tutorial\r\n```\r\nconst fs = require('fs'),\r\n      path = require('path');\r\n\r\nfunction readFileHelper(p) {     // #2\r\n  if (!checkPath(p)){\r\n    return;\r\n  }\r\n  fs.readFile(p,                 // #4\r\n    'utf8', (err, data) =\u003e {\r\n    if (err) throw err;\r\n    console.log(data);\r\n  });\r\n}\r\n\r\nreadFileHelper(process.argv[2]); // #1\r\n```\r\nand the query is also from tutorial\r\n```\r\n/**\r\n * @name Find usage of request.body and request.query in Express.js\r\n * @description Finds variables assigned from request.body and request.query in Express.js applications.\r\n * @kind problem\r\n * @id js/express-request-body-query\r\n */\r\nimport javascript\r\n\r\nclass CheckPathSanitizerGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {\r\n  CheckPathSanitizerGuard() { this.getCalleeName() = \"checkPath\" }\r\n\r\n  override predicate sanitizes(boolean outcome, Expr e) {\r\n    outcome = true and\r\n    e = getArgument(0).asExpr()\r\n  }\r\n}\r\n\r\nclass CommandLineFileNameConfiguration extends TaintTracking::Configuration {\r\n  CommandLineFileNameConfiguration() { this = \"CommandLineFileNameConfiguration\" }\r\n\r\n  override predicate isSource(DataFlow::Node source) {\r\n    DataFlow::globalVarRef(\"process\").getAPropertyRead(\"argv\").getAPropertyRead() = source\r\n  }\r\n\r\n  override predicate isSink(DataFlow::Node sink) {\r\n    DataFlow::moduleMember(\"fs\", \"readFile\").getACall().getArgument(0) = sink\r\n  }\r\n  override predicate isSanitizerGuard(TaintTracking::SanitizerGuardNode nd) {\r\n    nd instanceof CheckPathSanitizerGuard\r\n  }\r\n}\r\n\r\nfrom CommandLineFileNameConfiguration cfg, DataFlow::Node source, DataFlow::Node sink\r\nwhere cfg.hasFlow(source, sink)\r\nselect source, \"12312323\" \r\n```\r\ni use command line cli (2.18.3 newest version) to get the result\r\n```\r\ncodeql database create codeqldb --language=javascript\r\ncodeql database analyze --rerun --threads 0 \u003cdir of ql\u003e/test2.ql --format=sarif-latest --output=1.sarif\r\n```\r\nIt all works fine.\r\nThen i change the ql, this line \r\n```\r\n  override predicate sanitizes(boolean outcome, Expr e) {\r\n    outcome = true and\r\n    e = getArgument(0).asExpr()\r\n  }\r\n``` \r\nto\r\n```\r\n  override predicate sanitizes(boolean outcome, Expr e) {\r\n    outcome = false and\r\n    e = getArgument(0).asExpr()\r\n  }\r\n```\r\nAs expected, it does not sanitize the output. \r\nThe wierd thing is, if i change the function name of \"checkPath\", to \"isValid\", the sanitizer works very wierd, it sanitize the output no matter outcome is true of false. code is like:\r\n```\r\nconst fs = require('fs'),\r\n      path = require('path');\r\n\r\nfunction readFileHelper(p) {     // #2\r\n  if (!isValid(p)){\r\n    return;\r\n  }\r\n  fs.readFile(p,                 // #4\r\n    'utf8', (err, data) =\u003e {\r\n    if (err) throw err;\r\n    console.log(data);\r\n  });\r\n}\r\n\r\nreadFileHelper(process.argv[2]); // #1\r\n```\r\nql is like\r\n```\r\n/**\r\n * @name Find usage of request.body and request.query in Express.js\r\n * @description Finds variables assigned from request.body and request.query in Express.js applications.\r\n * @kind problem\r\n * @id js/express-request-body-query\r\n */\r\nimport javascript\r\n\r\nclass CheckPathSanitizerGuard extends TaintTracking::SanitizerGuardNode, DataFlow::CallNode {\r\n  CheckPathSanitizerGuard() { this.getCalleeName() = \"isValid\" }\r\n\r\n  override predicate sanitizes(boolean outcome, Expr e) {\r\n    outcome = false and\r\n    e = getArgument(0).asExpr()\r\n  }\r\n}\r\n\r\nclass CommandLineFileNameConfiguration extends TaintTracking::Configuration {\r\n  CommandLineFileNameConfiguration() { this = \"CommandLineFileNameConfiguration\" }\r\n\r\n  override predicate isSource(DataFlow::Node source) {\r\n    DataFlow::globalVarRef(\"process\").getAPropertyRead(\"argv\").getAPropertyRead() = source\r\n  }\r\n\r\n  override predicate isSink(DataFlow::Node sink) {\r\n    DataFlow::moduleMember(\"fs\", \"readFile\").getACall().getArgument(0) = sink\r\n  }\r\n  override predicate isSanitizerGuard(TaintTracking::SanitizerGuardNode nd) {\r\n    nd instanceof CheckPathSanitizerGuard\r\n  }\r\n}\r\n\r\nfrom CommandLineFileNameConfiguration cfg, DataFlow::Node source, DataFlow::Node sink\r\nwhere cfg.hasFlow(source, sink)\r\nselect source, \"12312323\" \r\n```\r\n\r\nThe only thing changed is the function name. \"isValid\" is not some special thing in js i think. I try other function names, everything start with isValid works abnormal, like \"isValidd\" \"isValidg\", anything else works correctly, like \"isVali\"","author":{"url":"https://github.com/oicu0619","@type":"Person","name":"oicu0619"},"datePublished":"2024-09-06T02:05:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/17393/codeql/issues/17393"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c50fb222-f728-99d2-ed1f-20a7c0a09bda
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id944A:343EA:34FB4FE:47075DC:696F0EA4
html-safe-nonce957ebb631562b596ca2654257af3f8354d8150d0e4dff529f58729a6b1acda20
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDRBOjM0M0VBOjM0RkI0RkU6NDcwNzVEQzo2OTZGMEVBNCIsInZpc2l0b3JfaWQiOiI2MzA2MjQ5ODgzNDc1OTcxNzQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac312e8ee7d25aa12a3c4b97b54c803b8dee6efe64cc0a57e879be06387166c995
hovercard-subject-tagissue:2509280043
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/17393/issue_layout
twitter:imagehttps://opengraph.githubassets.com/99080030279734fc6b8b09b754fd90b09cb1eae69957336cbcbc936fa8318372/github/codeql/issues/17393
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/99080030279734fc6b8b09b754fd90b09cb1eae69957336cbcbc936fa8318372/github/codeql/issues/17393
og:image:alti am try the the codeql query from https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/ ; the code to analysis is copied from tutorial const fs = ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameoicu0619
hostnamegithub.com
expected-hostnamegithub.com
Noneb278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee
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
release39aed5006635ab6f45e6b77d23e73b08a00272a3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/github/codeql/issues/17393#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fissues%2F17393
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fissues%2F17393
Sign up https://patch-diff.githubusercontent.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://patch-diff.githubusercontent.com/github/codeql/issues/17393
Reloadhttps://patch-diff.githubusercontent.com/github/codeql/issues/17393
Reloadhttps://patch-diff.githubusercontent.com/github/codeql/issues/17393
github https://patch-diff.githubusercontent.com/github
codeqlhttps://patch-diff.githubusercontent.com/github/codeql
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub%2Fcodeql
Fork 1.9k https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub%2Fcodeql
Star 9.1k https://patch-diff.githubusercontent.com/login?return_to=%2Fgithub%2Fcodeql
Code https://patch-diff.githubusercontent.com/github/codeql
Issues 919 https://patch-diff.githubusercontent.com/github/codeql/issues
Pull requests 367 https://patch-diff.githubusercontent.com/github/codeql/pulls
Discussions https://patch-diff.githubusercontent.com/github/codeql/discussions
Actions https://patch-diff.githubusercontent.com/github/codeql/actions
Projects 0 https://patch-diff.githubusercontent.com/github/codeql/projects
Models https://patch-diff.githubusercontent.com/github/codeql/models
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/github/codeql/security
Please reload this pagehttps://patch-diff.githubusercontent.com/github/codeql/issues/17393
Insights https://patch-diff.githubusercontent.com/github/codeql/pulse
Code https://patch-diff.githubusercontent.com/github/codeql
Issues https://patch-diff.githubusercontent.com/github/codeql/issues
Pull requests https://patch-diff.githubusercontent.com/github/codeql/pulls
Discussions https://patch-diff.githubusercontent.com/github/codeql/discussions
Actions https://patch-diff.githubusercontent.com/github/codeql/actions
Projects https://patch-diff.githubusercontent.com/github/codeql/projects
Models https://patch-diff.githubusercontent.com/github/codeql/models
Security https://patch-diff.githubusercontent.com/github/codeql/security
Insights https://patch-diff.githubusercontent.com/github/codeql/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/github/codeql/issues/17393
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/github/codeql/issues/17393
isSanitizerGuard works incorrectly when the function name startwith "isValid"https://patch-diff.githubusercontent.com/github/codeql/issues/17393#top
JShttps://github.com/github/codeql/issues?q=state%3Aopen%20label%3A%22JS%22
questionFurther information is requestedhttps://github.com/github/codeql/issues?q=state%3Aopen%20label%3A%22question%22
https://github.com/oicu0619
https://github.com/oicu0619
oicu0619https://github.com/oicu0619
on Sep 6, 2024https://github.com/github/codeql/issues/17393#issue-2509280043
https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/
JShttps://github.com/github/codeql/issues?q=state%3Aopen%20label%3A%22JS%22
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.