Skip to content

Fix Directory Permissions and Type Conversion Issues #327

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

noslav
Copy link
Member

@noslav noslav commented May 8, 2025

Fix Directory Permissions and Type Conversion Issues

Changes

  • Fixed G301 security issue by replacing os.ModePerm with more restrictive 0750 permissions in directory creation
  • Fixed type conversion panic in extractor2.go by properly handling fs.DirEntry to fs.FileInfo conversion
  • Added proper error handling for file operations
  • Improved test coverage for utility functions

Security Improvements

  • Directory permissions now follow principle of least privilege (0750)
  • File permissions set to 0600 for sensitive data
  • Added proper error handling for file operations

Code Quality

  • Added comprehensive test suite for utility functions
  • Fixed linting issues including:
    • Error checking for os.Setenv and os.RemoveAll
    • Package naming in test files
    • Variable naming conventions
    • Blank line formatting
  • Improved error handling and logging

Testing

  • Added unit tests for key utility functions
  • Improved test coverage for file operations
  • Added proper cleanup in tests

Impact

These changes improve security and reliability of the codebase while maintaining existing functionality. No breaking changes introduced.

Copy link

codecov bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 15.31%. Comparing base (0aa7afb) to head (44f6b3b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
scripts/replica/extractor2.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
- Coverage   15.32%   15.31%   -0.02%     
==========================================
  Files          52       52              
  Lines        6108     6112       +4     
==========================================
  Hits          936      936              
- Misses       5127     5131       +4     
  Partials       45       45              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Pranay Valson <[email protected]>
@noslav noslav force-pushed the fix/extractor-script branch from 638f564 to 44f6b3b Compare May 9, 2025 20:43
@noslav noslav merged commit 92aa5b7 into main May 9, 2025
7 of 10 checks passed
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.

1 participant