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

dev: Optimize encryption and decryption module #305

Merged
merged 4 commits into from
Jan 27, 2024
Merged

dev: Optimize encryption and decryption module #305

merged 4 commits into from
Jan 27, 2024

Conversation

moonD4rk
Copy link
Owner

@moonD4rk moonD4rk commented Jan 27, 2024

Proposed changes

Optimized the logic for obtaining Firefox keys and added more unit tests for encryption and decryption.

Ref Issuse:

Ref PR:

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit, build tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

* docs: Remove unnecessary file.

* docs: Refine CONTRIBUTING.md contribution guidelines.
…ons. (#300)

* refactor: Simplify Firefox master key retrieval and decryption functions.

- Simplify variable names and functions in browsingdata/password/password.go
- Modify Decrypt function for each PBE type to have only one parameter named globalSalt in crypto/crypto.go
- Implement functions to retrieve master key from Firefox's key4.db file and query metadata and private NSS data in browser/firefox/firefox.go

* chore: Add dependencies and tests to Firefox package.

- Add go-sqlmock and github.com/kisielk/sqlstruct dependencies
- Add tests for Firefox package metadata and nssPrivate query
- Add test for Firefox's processMasterKey function (currently commented out)

* refactor: Refactor Firefox test functions, remove unused code

- Remove unused test function in firefox_test.go file
- Clean up code by removing unnecessary changes
- Simplify file structure for easier maintenance and readability
…handling (#302)

* feat: Refactor crypto decryption functions for consistency and error handling

- Close #301
- Refactored and renamed decryption functions across multiple files for consistency
- Updated cookie sorting method to sort in descending order
- Added new encryption functions for AES in CBC and GCM modes and DES in CBC mode
- Added error handling to decryption functions and created new error variables for invalid ciphertext length and decode failures
- Test cases added for encryption and decryption functions
- Removed unused code and imports.

* chore: Add new words to .typos.toml dictionary

- Add new terms to `.typos.toml` dictionary
- Improve code formatting and readability
- Refactor functions for better performance
- Update comments and documentation
- Resolve minor bugs and errors

* refactor: Refactor crypto package for better structure and readability

- Refactored and cleaned up crypto package code for better readability
- Renamed `ToByteArray` method to `bytes` for consistency
- Modified `DecryptWithDPAPI` method to use `outBlob.bytes()` for efficiency
- Added comments and removed unused methods in `loginPBE`
- Refactored `nssPBE` and `metaPBE` Decrypt methods to use `deriveKeyAndIV` helper method
- Improved overall maintainability and organization of codebase

* refactor: Refactor firefox password encryption and decryption.

- Implement ASN1PBE interface with various PBE struct types and encryption/decryption methods
- Fix naming and remove unused variables in browsingdata and crypto files
- Add tests for ASN1PBE implementation using external assertion package
- Refactor and improve error handling in firefox file functions related to master key retrieval
- Add input validation and AES-GCM encryption function to crypto file
* ci: Upgrade GitHub Actions to v4 for greater stability

- Close #303
- Upgrade GitHub Actions to v4 in all workflows
- Fix zipping and uploading of Linux arm64 assets in release workflow
- Simplify and remove unnecessary steps in build workflow
Copy link
Contributor

Pull Request Test Coverage Report for Build 7679458114

  • -85 of 237 (64.14%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+8.1%) to 41.926%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crypto/asn1pbe.go 78 79 98.73%
crypto/crypto_linux.go 0 5 0.0%
crypto/crypto.go 64 90 71.11%
browser/firefox/firefox.go 10 63 15.87%
Totals Coverage Status
Change from base Build 7580892114: 8.1%
Covered Lines: 283
Relevant Lines: 675

💛 - Coveralls

@moonD4rk moonD4rk merged commit 700b981 into main Jan 27, 2024
6 checks passed
@moonD4rk moonD4rk deleted the dev branch January 27, 2024 15:45
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