Commit Graph

17 Commits

Author SHA1 Message Date
Roger 2c4e871e59 fix: strip host_key prefix from Chrome 130+ cookie values (#526)
* fix: strip SHA256(host_key) prefix from Chrome 130+ cookie values

Chrome 130 (Cookie DB schema v24) prepends SHA256(domain) to cookie
values before encryption to prevent cross-domain replay attacks.
After decryption, this 32-byte hash must be verified and stripped.

Changes:
- Add stripCookieHash() that verifies SHA256(host_key) and strips
  the prefix only when it matches (auto-compatible with older Chrome)
- Fix edge case: cookies with empty values (exactly 32 bytes = hash only)
- Add decrypt_test.go with v10 round-trip encryption/decryption test
- Add stripCookieHash test cases for v24+, older Chrome, empty values,
  short values, and host mismatch scenarios

Closes #524

* fix: strip SHA256(host_key) prefix from Chrome 130+ cookie values

Chrome 130 (Cookie DB schema v24) prepends SHA256(domain) to cookie
values before encryption to prevent cross-domain replay attacks.
After decryption, this 32-byte hash must be verified and stripped.

Changes:
- Add stripCookieHash() that verifies SHA256(host_key) and strips
  the prefix only when it matches (auto-compatible with older Chrome)
- Fix edge case: cookies with empty values (exactly 32 bytes = hash only)
- Add table-driven decrypt tests for v10/v20/DPAPI per platform
- Add Windows-specific DPAPI round-trip test using CryptProtectData
- Add shared testAESKey constant in testutil_test.go
- Add stripCookieHash tests for v24+, older Chrome, empty values,
  short values, and host mismatch scenarios
- Extend lint CI to run on ubuntu, windows, and macos

Closes #524

* fix: remove DPAPI test from darwin/linux (returns nil on Linux)

DecryptWithDPAPI returns nil error on Linux (silent no-op) but error
on macOS, causing the test to fail on Ubuntu CI. DPAPI round-trip
testing is properly covered in decrypt_windows_test.go.

* fix: resolve Windows CI lint errors exposed by multi-platform lint

- Add _ = before windows.CloseHandle calls to satisfy errcheck
- Add build tag to params.go (only used on macOS/Linux, not Windows)

* fix: add .gitattributes to force LF and refactor cookie tests

- Add .gitattributes with `* text=auto eol=lf` to prevent CRLF
  conversion on Windows CI causing gofumpt false positives
- Add .gitattributes to .gitignore whitelist
- Refactor stripCookieHash tests into table-driven style

* fix: address Copilot review on decrypt tests

- Assert error on wrong key instead of ignoring it (AES-CBC returns
  padding error, not silent empty result)
- Guard empty plaintext in encryptWithDPAPI to prevent nil pointer panic
- Convert uint32 to int for make/copy slice bounds in Windows test

* fix: assert specific error message in wrong key decrypt test
2026-04-04 01:41:01 +08:00
Roger d0971ca098 chore: update CI, golangci-lint, and CLAUDE.md (#511)
* chore: update CI, golangci-lint, and CLAUDE.md
* fix: resolve CI failures on Windows test and lint
* fix: resolve Windows test path and main.go line length lint issues
* fix: auto-format log/ with gofumpt, exclude pre-refactoring lint issues
* fix: resolve remaining lint issues, remove unnecessary exclusions
* fix: remove invalid G117 gosec rule, use text exclusion for secret pattern
* fix: align CI golangci-lint version with local (v2.4 -> v2.10)
2026-03-23 01:40:59 +08:00
Roger d101da627d fix: upgrade golangci-lint to v2 and modernize configuration (#487)
* fix: upgrade golangci-lint to v2 and modernize configuration

- Migrate from golangci-lint v1 to v2 configuration format
- Update GitHub Actions workflow to use golangci-lint-action@v8
- Set golangci-lint version to v2.2.0 for stability
- Add comprehensive linter configuration with Go 1.20 compatibility
- Temporarily disable strict linting rules to unblock development
- Configure formatters (gofmt, goimports, gci) separately per v2 requirements
- Add extensive exclusion rules for gradual rule enforcement

This change establishes a modern linting baseline that can be progressively
enhanced as code quality improves. All major linting issues have been
configured as non-blocking to allow incremental improvements.

* chore: update golangci-lint to v2.4.0 for compatibility

- Update golangci-lint version from v2.2.0 to v2.4.0 in GitHub Actions
- Aligns CI environment with local development version
- Resolves configuration validation errors

* fix: update golangci-lint config to v2.4.0 compatible format

- Remove deprecated v1 fields (skip-dirs, skip-files from run section)
- Move exclusions to linters.exclusions section
- Fix goimports.local-prefixes to be array format
- Remove gci.skip-generated and custom-order (not supported)
- Replace disable-all with default: standard
- Remove deprecated issues section, use linters.exclusions instead
- Fix output format from colored-line-number to text with colors
- Remove unsupported fields from linter settings

This ensures the config passes 'golangci-lint config verify' validation
2025-09-02 23:18:27 +08:00
ᴍᴏᴏɴD4ʀᴋ ad020cf135 chore: downgrade golang version to 1.20, support Windows 7. (#435)
* chore: downgrade golang version to 1.20, support windows 7

* chore: Update dependencies for Go project.

- Update dependencies in go.sum
- Improvements and optimizations in various files
- Bug fixes and error handling enhancements

* chore: Update modernc.org/sqlite library versions in go.mod and go.sum files

- Update version of `modernc.org/sqlite` to `v1.31.1` in `go.mod` and `go.sum` files
- Update module hash in `go.sum` file for `modernc.org/sqlite`
- Ensure consistency between `go.mod` and `go.sum` files in relation to `modernc.org/sqlite` version

* chore: replace log/slog with standard logger (#436)

* chore: replace log/slog with standard logger

* chore: Update Go dependencies and versions

- Update Go version from `1.22.5` to `1.20` and other dependencies
- Update critical dependencies to latest versions
- Ensure compatibility with new versions of dependencies

* chore: Optimize dependency management in workflows

- Update build and lint workflows to use `go mod tidy` for getting dependencies
- Change modules download mode to `'mod'` in linters configuration
- Add step to get dependencies in lint workflow

* refactor: Update dependencies and refactor Chromium key deletion logic

- Update `modernc.org/sqlite` to `v1.31.1` in `go.mod` and `go.sum`
- Increase version number to `0.5.0` in `cmd/hack-browser-data/main.go`
- Refactor and update logic for filtering and copying items in `browser/chromium/chromium.go`

* Improve logging functionality and data type conversion

- Add `String()` method to `DataType` enum in types.go
- Update log level to Debug in logger_test.go
- Set log level to Debug in `TestLoggerDebug` and `TestLoggerDebugf` functions
2024-10-22 13:01:13 +08:00
dependabot[bot] 940e960932 chore(deps): bump golangci/golangci-lint-action from 4 to 6
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-15 22:47:11 +08:00
dependabot[bot] c296da4de2 chore(deps): bump golangci/golangci-lint-action from 3 to 4
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 20:05:34 +08:00
ᴍᴏᴏɴD4ʀᴋ 06fc064418 refactor/dependence: Upgrade Golang version and dependencies. (#322)
* chore: Set up automated package updates with dependabot.
2024-04-12 20:01:29 +08:00
moonD4rk c31cf602ed ci: Improve GitHub Actions workflow for linting. 2024-04-12 20:01:29 +08:00
ᴍᴏᴏɴD4ʀᴋ 7bd5a06875 ci: Improve Golang code quality with updated lint configuration file (#307)
* refactor: Optimize code logic and reduce nesting.

* ci: Improve Golang code quality with updated configuration file

* chore: Update GitHub actions setup-go to version 5 and optimize caching.
2024-04-12 20:01:29 +08:00
ᴍᴏᴏɴD4ʀᴋ 700b981e5d feat: Upgrade GitHub Actions to v4 for greater stability (#304)
* 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
2024-01-27 23:15:05 +08:00
ᴍᴏᴏɴD4ʀᴋ baa0e09ad2 dev: Remove CGO go-sqlite3 with pure go driver (#292)
* chore: Resize logo and update browser support in READMEs (#284)

* chore: Resize logo and update browser support in READMEs

* docs: Update Coverage Status badge URL

* chore: add typos check linter in github actions (#285)

* refactor: Disable JSON handling in logger/logger.go.

* chore: Standardize spelling and add typos check workflows.

* refactor: Update SQLite driver import for browsing data package.

* refactor: Refactor browsing data package to use SQLite driver instead of SQLite3.

* docs: Add contribution guidelines to README file (#289)

* chore: Refactor file and directory names for improved organization and consistency
2024-01-19 15:45:24 +08:00
ᴍᴏᴏɴD4ʀᴋ cd2b1964c4 chore: add typos check linter in github actions (#285)
* refactor: Disable JSON handling in logger/logger.go.

* chore: Standardize spelling and add typos check workflows.

- Update GitHub Action name to 'unit tests'
- Add spell-check step with custom config to lint workflow
- Use latest version of golangci/lint-action in lint workflow
- Rename variable 'crypted' to 'encrypted' in crypto_windows.go
- Fix typos in comments and error/log messages throughout the codebase
- Update .gitignore to exclude typos.toml file
2024-01-17 13:52:59 +08:00
ᴍᴏᴏɴD4ʀᴋ 23037e16fd Chore: Add CONTRIBUTING.md guidelines and standardized templates (#279)
* chore: Improve GitHub workflows, issue template, and gitignore entries

- Add support for manual triggering of build and lint workflows.
- Improve bug report template by clarifying prompts and adding checklist and tips for better explanation of issues.
- Ignore `.md` files in `.github` and `.github/ISSUE_TEMPLATE` folders.
- Add badges for test running and coverage status in README.md.

* chore: Add standardized templates to repository

- Add pull request and feature request templates to the `.github` folder

* docs: Add CONTRIBUTING.md guidelines and update .gitignore.

- Update .gitignore to remove exclusions for browsing history files
- Add an exclusion for CONTRIBUTING.md in the Community section in .gitignore
- Create CONTRIBUTING.md with guidelines for contributors.
2024-01-13 18:08:35 +08:00
ᴍᴏᴏɴD4ʀᴋ eed1d12282 dev: refactor items and update repo deploy (#278)
* refactor: Refactor file paths and use map to store item names

- Refactored file paths for various browsing data types to use a consistent method of generating temporary file names
- Modified parsing functions in many browsing data types to use the new temporary file naming scheme
- Renamed `FileName` to `Filename` for consistency in the `item` package
- Removed unnecessary code and comments throughout various files
- Made minor improvements to some Item methods such as `TempFilename` and `FileName`

* ci: Optimize GitHub actions and update Go versions. (#274)

* ci: Optimize GitHub actions and update Go versions.

- Add GitHub actions for unit testing, linting, building, and releasing
- Use a matrix strategy to test on different versions and platforms
- Update setup-go and go-version options for compatibility
- Format code and build zip files for different operating systems
- Upload releases to GitHub with specific asset names and types

* fix: Refactor item file naming convention

- Update `filename()` function to return `UnsupportedItem` in specific cases
- Replace `UnknownItem` with `UnsupportedItem` in `Filename` method of `Item` struct
- Refactor code for clarity and consistency

* ci: Update GitHub workflow with latest setup-go version

- Update setup-go action to v3 in lint.yml GitHub workflow
- Omits some big changes in file diff summary
- Improve overall workflow reliability and efficiency

* ci: Improve GitHub actions across platforms

- Improve Windows compatibility in build workflow
- Optimize unit testing for pull requests
- Upgrade Coveralls GitHub action to v2 for improved coverage tracking

* build: Optimize build process for consistency and efficiency

- Ensure consistency of line endings by disabling Git's automatic conversion
- Add format check for Windows systems
- Update Go version in strategy matrix to `1.21.x`
- Remove unused dependencies from build process
- Include all packages in repository in build command

* ci: Refactor GitHub workflow configuration

- Remove unnecessary checks for `windows-latest` in github workflow
- Change `gofmt` check to `diff` for formatting
- Remove unneeded Git configuration for encoding of line endings
- Close #273

* ci: Update default branch references in GitHub Actions workflows (#277)

- Update Github Actions workflows to use `main` branch instead of `master`.
- Rename `master` branch to `main` in `lint.yml` and `build.yml` files.
- Change default branch to `main` in `contributors.yml` workflow file.
2024-01-13 15:58:53 +08:00
moonD4rk 83fc248195 chore: update Go version and dependencies for builds
- Update Go version from `1.20` to `1.21` in go.mod, .github/workflows/build.yml, and .github/workflows/lint.yml
2023-10-02 22:37:42 +08:00
moonD4rk 60772a47f4 chore: update actions go version to 1.20 2023-03-11 21:22:22 +08:00
ᴍᴏᴏɴD4ʀᴋ a2bfdeb130 chore: add golangci-lint action config file 2022-08-14 22:55:00 +08:00