Title: False positive: Mistaking Username as password if they are set in the same tuple · Issue #16976 · github/codeql · GitHub
Open Graph Title: False positive: Mistaking Username as password if they are set in the same tuple · Issue #16976 · github/codeql
X Title: False positive: Mistaking Username as password if they are set in the same tuple · Issue #16976 · github/codeql
Description: Description of the false positive Sometimes when a variable either stores a tuple containing a password and a username and then the username is logged into a file directly after the tuple is split, codeql assumes the username variable is...
Open Graph Description: Description of the false positive Sometimes when a variable either stores a tuple containing a password and a username and then the username is logged into a file directly after the tuple is split,...
X Description: Description of the false positive Sometimes when a variable either stores a tuple containing a password and a username and then the username is logged into a file directly after the tuple is split,...
Opengraph URL: https://github.com/github/codeql/issues/16976
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive: Mistaking Username as password if they are set in the same tuple","articleBody":"**Description of the false positive**\r\n\r\nSometimes when a variable either stores a tuple containing a password and a username and then the username is logged into a file directly after the tuple is split, codeql assumes the username variable is a password, thus reporting Clear-text storage of sensitive information\r\n\r\n**Code samples or links to source code**\r\n\r\n```text\r\nStep 1 ControlFlowNode for Subscript\r\nSource\r\n[DataBase.py:845](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L845-L845)\r\n\r\n api = config[\"api\"]\r\n username = config[\"username\"]\r\n password = config[\"password\"]\r\n exclusion_titles = config[\"exclusion_titles\"]\r\n return api, username, password, exclusion_titles\r\n except Exception as e:\r\nStep 2 ControlFlowNode for password\r\n[DataBase.py:845](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L845-L845)\r\n\r\n api = config[\"api\"]\r\n username = config[\"username\"]\r\n password = config[\"password\"]\r\n exclusion_titles = config[\"exclusion_titles\"]\r\n return api, username, password, exclusion_titles\r\n except Exception as e:\r\nStep 3 ControlFlowNode for Tuple\r\n[DataBase.py:847](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L847-L847)\r\n username = config[\"username\"]\r\n password = config[\"password\"]\r\n exclusion_titles = config[\"exclusion_titles\"]\r\n return api, username, password, exclusion_titles\r\n except Exception as e:\r\n return f\"ERROR {e} \u0026\u0026 520\"\r\n\r\nStep 4 ControlFlowNode for read_api()\r\n[DataBase.py:966](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L966-L966)\r\n - str: If the API is invalid, returns a formatted error message.\r\n \"\"\"\r\n # Initialize the UserManager and API values\r\n temp = read_api()\r\n if isinstance(temp, str):\r\n if check_ERROR(temp):\r\n return temp\r\nStep 5 ControlFlowNode for temp\r\n[DataBase.py:966](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L966-L966)\r\n - str: If the API is invalid, returns a formatted error message.\r\n \"\"\"\r\n # Initialize the UserManager and API values\r\n temp = read_api()\r\n if isinstance(temp, str):\r\n if check_ERROR(temp):\r\n return temp\r\nStep 6 ControlFlowNode for username\r\n[DataBase.py:971](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L971-L971)\r\n if check_ERROR(temp):\r\n return temp\r\n else:\r\n api, username, password, exclusion_titles = temp\r\n\r\n if api == \"REC\":\r\n log.info(\r\nStep 7 ControlFlowNode for Fstring\r\n[DataBase.py:975](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L975-L975)\r\n\r\n if api == \"REC\":\r\n log.info(\r\n f\"A request has been made to generate an exam by the user {username}\"\r\n )\r\n if um.verify_password(username, password):\r\n DATA = exam_generator(username)\r\nStep 8 ControlFlowNode for message\r\n[DataBase.py:504](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L504-L504)\r\n\r\n return time\r\n\r\n def info(self, message):\r\n \"\"\"\r\n Writes an informational message to the log file.\r\nStep 9 ControlFlowNode for Fstring\r\n\r\n[DataBase.py:515](https://github.com/DefinetlyNotAI/Test-generator/blob/813d517b26e7c3a25b0781d187d5ce3b42cad172/DataBase.py#L515-L515)\r\n None\r\n \"\"\"\r\n with open(self.filename, \"a\") as f:\r\n f.write(f\"INFO: {message} at {self.timestamp()}\\n\")\r\nThis expression stores as clear text.\r\n\r\n def error(self, message):\r\n \"\"\"\r\n```\r\n\r\n**URL to the alert on GitHub code scanning (optional)**\r\n\r\nhttps://github.com/DefinetlyNotAI/Test-generator/security/code-scanning/50","author":{"url":"https://github.com/DefinetlyNotAI","@type":"Person","name":"DefinetlyNotAI"},"datePublished":"2024-07-14T15:46:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/16976/codeql/issues/16976"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2570b57f-5dd3-5c44-3387-156ba4ae37c5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8122:6456C:141C63D:1BC22FC:6A4DE6C4 |
| html-safe-nonce | 3787b89315fc09111aa6d87f204282391d6859484a66db285c70849a09b8445f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTIyOjY0NTZDOjE0MUM2M0Q6MUJDMjJGQzo2QTRERTZDNCIsInZpc2l0b3JfaWQiOiI1MjQ1NjA0NzAzMjY2MjY4ODY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d0ad70b6c8427ded68f4c4f399f9f671f232711e02daf20c2ef4b9c5aff40874 |
| hovercard-subject-tag | issue:2407489224 |
| github-keyboard-shortcuts | repository,issues,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/issues/show/github/codeql/16976/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b4f70af858f0711e07aa3ed5b27c7625ab6abf0ab2045e92683fbdc358b2444d/github/codeql/issues/16976 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b4f70af858f0711e07aa3ed5b27c7625ab6abf0ab2045e92683fbdc358b2444d/github/codeql/issues/16976 |
| og:image:alt | Description of the false positive Sometimes when a variable either stores a tuple containing a password and a username and then the username is logged into a file directly after the tuple is split,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DefinetlyNotAI |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| 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 | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width