Skip to content

Add --apikey-file for trash and update all dependencies - #15

Merged
ptr727 merged 0 commit into
developfrom
feature/apikey-file-and-deps
Jul 23, 2026
Merged

Add --apikey-file for trash and update all dependencies#15
ptr727 merged 0 commit into
developfrom
feature/apikey-file-and-deps

Conversation

@ptr727

Copy link
Copy Markdown
Owner

Summary

  • Dependencies: update all NuGet packages to current versions - Microsoft.Data.Sqlite 9.0.4 -> 10.0.10, System.CommandLine 2.0.5 -> 2.0.10, ptr727.Utilities 4.0.7 -> 4.0.28, Serilog 4.3.1 -> 4.4.0, CliWrap -> 3.10.2, Microsoft.Extensions.Logging.Abstractions -> 10.0.10, plus test tooling (AwesomeAssertions 9.5.0, Microsoft.NET.Test.Sdk 18.8.1, coverlet.collector 10.0.1).
  • SQLite vulnerability (GHSA-2m69-gcr7-jv3q): the version bump alone does not fix it - Microsoft.Data.Sqlite 10.0.10 still resolves the vulnerable transitive SQLitePCLRaw.lib.e_sqlite3 2.1.11. Pinned SQLitePCLRaw.bundle_e_sqlite3 to 3.0.4 in the app and test projects, which clears all NU1903 warnings.
  • Feature --apikey-file: the trash command now accepts the Immich API key via either --apikey (inline) or --apikey-file (path). The two options are mutually exclusive and exactly one is required; --apikey-file must reference an existing, non-empty file, whose trimmed contents become the key (resolved at parse time by ResolveApiKey/ReadApiKeyFile). This keeps the secret out of shell history and process arguments, following the common FOO vs FOO_FILE convention.

Details

  • secrets/ added to .gitignore; .vscode/launch.json updated with an --apikey-file example.
  • Docs updated: README.md and .github/copilot-instructions.md.

Testing

  • 8 new tests in CommandLineTests.cs (file variant parses, non-existent file, both-specified, empty file, and key-resolution unit tests).
  • Full workflow green: CSharpier format, dotnet format style --verify-no-changes, build (0 errors; only 2 pre-existing benchmark warnings), dotnet test (323/323 pass), and dotnet husky run.

🤖 Generated with Claude Code

CopilotAI review requested due to automatic review settings July 23, 2026 14:21
@codecov

codecovBot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.21053% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.96%. Comparing base (6eaf1cb) to head (cfa2159).

Files with missing linesPatch %Lines
PhotoCleaner/CommandLine.cs88.88%4 Missing and 2 partials ⚠️
PhotoCleaner/TrashCommand.cs0.00%3 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## develop #15 +/- ##
===========================================
+ Coverage 44.39% 44.96% +0.56% 
===========================================
Files 25 25 Lines 3347 3398 +51 Branches 253 259 +6 ===========================================
+ Hits 1486 1528 +42 - Misses 1819 1824 +5 - Partials 42 46 +4 

☔ View full report in Codecov by Harness.
📢 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.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates PhotoCleaner’s dependencies (including pinning the native SQLite bundle to address NU1903/GHSA-2m69-gcr7-jv3q warnings) and adds a safer alternative for supplying the Immich API key to the trash command via --apikey-file.

Changes:

  • Add trash --apikey-file support (mutually exclusive with --apikey) plus CLI validation and tests.
  • Update NuGet dependencies across app/tests/benchmarks, and pin SQLitePCLRaw.bundle_e_sqlite3 to a non-vulnerable version.
  • Update documentation/examples (README.md, .github/copilot-instructions.md, VS Code launch config) and ignore local secrets/.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
README.mdDocuments --apikey-file usage and updates trash help/examples.
PhotoCleaner/CommandLine.csAdds --apikey-file option, validators, and API key resolution helpers.
PhotoCleaner/TrashCommand.csUpdates runtime error message to include --apikey-file.
PhotoCleaner/PhotoCleaner.csprojUpdates package versions and pins SQLitePCLRaw.bundle_e_sqlite3.
PhotoCleanerBenchmarks/PhotoCleanerBenchmarks.csprojUpdates CliWrap version used by benchmarks.
PhotoCleanerTests/PhotoCleanerTests.csprojUpdates test dependencies and pins SQLitePCLRaw.bundle_e_sqlite3.
PhotoCleanerTests/CommandLineTests.csAdds parsing/validation and key-resolution tests for --apikey-file.
.github/copilot-instructions.mdUpdates repo instructions/docs for the new API-key input mode.
.vscode/launch.jsonSwitches example config to use --apikey-file.
.gitignoreAdds secrets/ and reorganizes ignore entries.

Comment threadPhotoCleaner/CommandLine.cs Outdated
Comment thread.github/copilot-instructions.md Outdated

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged this pull request into developJul 23, 2026
6 checks passed
@ptr727
ptr727 deleted the feature/apikey-file-and-deps branch July 23, 2026 14:35
ptr727 added a commit that referenced this pull request Aug 3, 2026
* Add --apikey-file for trash and update all dependencies
Dependencies:
- Update all NuGet packages to current versions (Microsoft.Data.Sqlite
10.0.10, System.CommandLine 2.0.10, ptr727.Utilities 4.0.28, Serilog
4.4.0, CliWrap 3.10.2, and test tooling).
- Pin SQLitePCLRaw.bundle_e_sqlite3 to 3.0.4 in the app and test projects
to override the vulnerable transitive 2.1.11 (GHSA-2m69-gcr7-jv3q).
Feature (--apikey-file):
- The trash command now accepts the Immich API key via either --apikey
(inline) or --apikey-file (path); the two are mutually exclusive and
exactly one is required.
- --apikey-file must reference an existing, non-empty file; its trimmed
contents become the key, resolved at parse time by ResolveApiKey /
ReadApiKeyFile.
- Add secrets/ to .gitignore and a launch.json example.
- Add 8 tests and update README and copilot-instructions docs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Handle unreadable API key file as validation error, fix docs
- ReadApiKeyFile now catches IOException/UnauthorizedAccessException and
returns null, so an unreadable key file produces a validation error
instead of an unhandled exception during parsing.
- Fix copilot-instructions.md to match the implementation (option
validator, not AcceptExistingOnly).
- Add ReadApiKeyFile_UnreadableFile_ReturnsNull test (Unix, non-root).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto 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

@ptr727