Skip to content
This repository was archived by the owner on Oct 1, 2026. It is now read-only.

Add camera profile credential security tests - #44

Merged
elkampu merged 3 commits into
KalyteraSystems:mainfrom
iibaranov-IG:test/camera-profile-security
Sep 9, 2026
Merged

elkampu merged 3 commits into
KalyteraSystems:mainfrom
iibaranov-IG:test/camera-profile-security

Conversation

@iibaranov-IG

Copy link
Copy Markdown
Contributor

Summary

  • cover camera profile create/read/update/delete across a service restart using a persistent temporary Data Protection key ring
  • prove plaintext passwords never reach camera-profiles.json and password-preserve/clear semantics stay intact
  • protect the immutable demo profile against mutation through both read APIs
  • reject malformed explicit IDs, ignore malformed persisted IDs, and verify undecryptable secrets fail closed without leaking into warnings
  • clean all isolated camera data and keys after each test

Verification

  • dotnet test IPCamLapse.sln -c Release: 110 tests pass (63 IPCamLapse + 47 OpenCamInterop)
  • dotnet format IPCamLapse.sln --verify-no-changes --no-restore: pass
  • git diff --check: pass
  • signed commit: 5b564ac

Closes #28.

@elkampu elkampu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The suite is strong overall, but one security acceptance case is not fully exercised.

At IPCamLapse.Tests/CameraProfileServiceTests.cs:194-208, RecordingLogger discards the Exception argument. The assertions at lines 149-151 therefore prove only that the message template omits the stored value, not that the complete warning a provider emits omits it. Please capture/assert the full rendered record, including exception text. While touching this test, an explicit non-null profile assertion after clearing the secret would make the clear-vs-delete result unambiguous.

@iibaranov-IG

Copy link
Copy Markdown
Contributor Author

Good catch — agreed. The exception cannot be allowed to enter through the side door while the message template passes inspection. I’ll update the recording logger to retain the complete rendered record, assert that the stored secret is absent from exception text as well, and add the explicit non-null profile assertion after clearing the secret.

@elkampu elkampu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed at exact head 7097f29 after the normal base update. The recording logger now retains the complete emitted record and exception, the undecryptable-secret case asserts both paths, and the clear-secret test proves the profile remains present. Independent validation passed locked restore, Release build with zero warnings/errors, all 119 combined tests (72 IPCamLapse + 47 embedded OpenCamInterop), formatting, dependency audit, and diff checks. All five current GitHub checks pass.

@elkampu
elkampu merged commit bfa6a2f into KalyteraSystems:main Sep 9, 2026
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add security-focused tests for camera profile persistence

2 participants