Skip to content

Release 2.7.1: Token refresh and secret management fixes#85

Merged
homotechsual merged 3 commits into
mainfrom
develop
Jun 22, 2026
Merged

Release 2.7.1: Token refresh and secret management fixes#85
homotechsual merged 3 commits into
mainfrom
develop

Conversation

@homotechsual

Copy link
Copy Markdown
Owner

Release 2.7.1

This release includes critical fixes for token refresh and secret management, as well as workflow improvements.

Fixes

Changes

  • Updated version to 2.7.1 in module manifest and changelog
  • Added regression tests for secret management token refresh scenarios

After this PR is merged into main, release tag v2.7.1 will be created.

- Fix token refresh to gracefully handle missing secret vault configuration
- Preserve secret prefix during token refresh for correct vault lookups
- Add regression tests for secret management token refresh scenarios
- Fix workflow issue matching to use exact title filtering instead of fuzzy first-match
Copilot AI review requested due to automatic review settings June 22, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 prepares the NinjaOne PowerShell module Release 2.7.1, focusing on improving token refresh behavior when SecretManagement is in use (or misconfigured), preserving secret-prefix behavior across re-authentication, and tightening the monthly endpoint drift workflow’s issue update logic.

Changes:

  • Adjust secret-vault read/write flows to preserve SecretPrefix and avoid passing secret management params during refresh when vault config is missing.
  • Add regression tests for token refresh + secret management scenarios, including secret prefix preservation.
  • Bump module version to 2.7.1, update changelog, and refine the monthly capability check workflow’s issue matching/update behavior.

Reviewed changes

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

Show a summary per file
File Description
Tests/NinjaOne.Private.Tests.ps1 Adds regression tests for token refresh behavior and secret-prefix preservation.
Source/Public/PSModule/Connect/Connect-NinjaOne.ps1 Passes -secretPrefix when reading connection/auth data from the secret vault.
Source/Private/Update-NinjaOneToken.ps1 Refactors refresh reauth splat params; adds conditional secret-management handling and secret prefix propagation.
Source/Private/Set-NinjaOneSecrets.ps1 Adds explicit validation for missing/blank vault name.
Source/Private/Get-NinjaOneSecrets.ps1 Persists SecretPrefix into connection info after retrieving secrets.
Source/NinjaOne.psd1 Updates module version to 2.7.1.
CHANGELOG.md Adds 2.7.1 release entry (dated 2026-06-22).
.github/workflows/monthly-instance-capability-check.yml Uses exact-title filtering and edits issue body (instead of commenting) when updating an existing issue.

Comment on lines +49 to +61
if ($Script:NRAPIConnectionInformation.UseSecretManagement) {
if ([String]::IsNullOrWhiteSpace($Script:NRAPIConnectionInformation.VaultName)) {
Write-Verbose 'Secret management is enabled, but no secret vault name is configured. Refreshing without secret vault updates.'
} else {
$ReauthParams.UseSecretManagement = $True
$ReauthParams.VaultName = $Script:NRAPIConnectionInformation.VaultName
$ReauthParams.WriteToSecretVault = $Script:NRAPIConnectionInformation.WriteToSecretVault
$ReauthParams.ReadFromSecretVault = $Script:NRAPIConnectionInformation.ReadFromSecretVault
if (-not [String]::IsNullOrWhiteSpace($Script:NRAPIConnectionInformation.SecretPrefix)) {
$ReauthParams.SecretPrefix = $Script:NRAPIConnectionInformation.SecretPrefix
}
}
}
Comment on lines +2433 to +2436
{ Update-NinjaOneToken -ErrorAction SilentlyContinue } | Should -Not -Throw
$script:CapturedReauthParams.SecretPrefix | Should -Be 'Custom'
$script:CapturedReauthParams.ReadFromSecretVault | Should -BeTrue
}
@codecov-commenter

codecov-commenter commented Jun 22, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.04%. Comparing base (fa29aee) to head (f2af2bd).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Source/Private/Set-NinjaOneSecrets.ps1 33.33% 2 Missing ⚠️
...ource/Public/PSModule/Connect/Connect-NinjaOne.ps1 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
- Coverage   18.16%   18.04%   -0.13%     
==========================================
  Files         313      313              
  Lines        4260     4256       -4     
==========================================
- Hits          774      768       -6     
- Misses       3486     3488       +2     
Flag Coverage Δ
core 3.50% <0.00%> (+<0.01%) ⬆️
docs 0.00% <0.00%> (ø)
private 83.48% <86.66%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

- Remove secret management parameters from token refresh call to Connect-NinjaOne
- Token refresh should only use auth method (OAuth/ClientCreds) parameters
- Secret management operations (read/write) don't apply during token refresh
- Fixes parameter set resolution error in Update-NinjaOneToken
- Update test to verify refresh succeeds without secret management params
@homotechsual
homotechsual merged commit 463e72f into main Jun 22, 2026
5 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.

[Issue] Cannot bind argument to parameter 'vaultName' because it is an empty string.

3 participants