Title: Modernize and secure temp file creation by pixeebot[bot] · Pull Request #28 · Pixee-Bot-Java/flow · GitHub
Open Graph Title: Modernize and secure temp file creation by pixeebot[bot] · Pull Request #28 · Pixee-Bot-Java/flow
X Title: Modernize and secure temp file creation by pixeebot[bot] · Pull Request #28 · Pixee-Bot-Java/flow
Description: This change replaces the usage of java.io.File#createTempFile with java.nio.file.Files#createTempFile which has more secure attributes. The java.io.File#createTempFile() method creates a file that is world-readable and world-writeable, which is almost never necessary. Also, the file created is placed in a predictable directory (e.g., /tmp). Having predictable file names, locations, and will lead to many types of vulnerabilities. History has shown that this insecure pattern can lead to information leakage, privilege escalation and even code execution. Our changes look something like this: + import java.nio.file.Files; ... - File txtFile = File.createTempFile("acme", ".txt"); + File txtFile = Files.createTempFile("acme", ".txt").toFile(); More reading https://cwe.mitre.org/data/definitions/378.html https://docs.fluidattacks.com/criteria/vulnerabilities/160/ apache/druid#11130 https://owasp.org/www-community/vulnerabilities/Insecure_Temporary_File https://nvd.nist.gov/vuln/detail/CVE-2022-41954 https://www.cvedetails.com/vulnerability-list/cwe-378/vulnerabilities.html I have additional improvements ready for this repo! If you want to see them, leave the comment: @pixeebot next ... and I will open a new PR right away! 🧚🤖 Powered by Pixeebot Feedback | Community | Docs | Codemod ID: pixee:java/upgrade-tempfile-to-nio
Open Graph Description: This change replaces the usage of java.io.File#createTempFile with java.nio.file.Files#createTempFile which has more secure attributes. The java.io.File#createTempFile() method creates a file that ...
X Description: This change replaces the usage of java.io.File#createTempFile with java.nio.file.Files#createTempFile which has more secure attributes. The java.io.File#createTempFile() method creates a file that ...
Opengraph URL: https://github.com/Pixee-Bot-Java/flow/pull/28
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a07dd39a-668e-0baf-1aaa-7021b9548f36 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8F98:387F6B:289ACF:345F5C:6990185F |
| html-safe-nonce | bb1650b6fd44ba9d45355b9ed8a285f52dcdb4a5833979e7aca3f28a1224d61c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Rjk4OjM4N0Y2QjoyODlBQ0Y6MzQ1RjVDOjY5OTAxODVGIiwidmlzaXRvcl9pZCI6IjQxNjUyODY1MDY5MzQ1NzMxNTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9af372dbc117fd0cc03e6760f2f16b66306c77ad026088fec8836d3fb9afb22c |
| hovercard-subject-tag | pull_request:2510925600 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/Pixee-Bot-Java/flow/pull/28/files |
| twitter:image | https://avatars.githubusercontent.com/in/193111?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/193111?s=400&v=4 |
| og:image:alt | This change replaces the usage of java.io.File#createTempFile with java.nio.file.Files#createTempFile which has more secure attributes. The java.io.File#createTempFile() method creates a file that ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/Pixee-Bot-Java/flow git https://github.com/Pixee-Bot-Java/flow.git |
| octolytics-dimension-user_id | 143516492 |
| octolytics-dimension-user_login | Pixee-Bot-Java |
| octolytics-dimension-repository_id | 795756272 |
| octolytics-dimension-repository_nwo | Pixee-Bot-Java/flow |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 34809191 |
| octolytics-dimension-repository_parent_nwo | vaadin/flow |
| octolytics-dimension-repository_network_root_id | 34809191 |
| octolytics-dimension-repository_network_root_nwo | vaadin/flow |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width