Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert no. 59: Overly permissive file permissions #448

Closed
wants to merge 1 commit into from

Conversation

jordanpadams
Copy link
Member

Fixes https://github.com/NASA-PDS/doi-service/security/code-scanning/59

To fix the problem, we need to change the file permissions to be more restrictive, allowing only the owner to read and write the file. This can be achieved by modifying the os.chmod calls to set the file permissions to 0o0600, which grants read and write permissions only to the file owner.

Specifically, we need to update the os.chmod calls on lines 173 and 184 to use 0o0600 instead of 0o0664. This change ensures that the files are not world-readable and are only accessible by the owner.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@jordanpadams jordanpadams marked this pull request as ready for review November 14, 2024 01:42
Copy link
Member

@nutjob4life nutjob4life left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On main, pytest gives:

89 passed, 15 skipped, 151 warnings in 6.73s

On alert-autofix-59, though, pytest gives:

1 failed, 88 passed, 15 skipped, 151 warnings in 7.07s

I think we better just reject this. The test pds_doi_service.core.db.test.transaction_test.TransactionOnDiskTestCase explicitly looks for the file mode and does not like 0600.

@jordanpadams
Copy link
Member Author

Closing as wontfix.

@jordanpadams jordanpadams deleted the alert-autofix-59 branch December 2, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants