Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/MsrcSecurityUpdates/MsrcSecurityUpdates.psd1
Binary file not shown.
17 changes: 17 additions & 0 deletions src/MsrcSecurityUpdates/MsrcSecurityUpdates.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ $Error.Clear()
Get-Module -Name MsrcSecurityUpdates | Remove-Module -Force -Verbose:$false
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath 'MsrcSecurityUpdates.psd1') -Verbose:$false -Force

Describe 'MSAL Authentication Migration' {
It 'Set-MSRCMsalAccessToken function should be available' {
Get-Command Set-MSRCMsalAccessToken -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty
}

It 'Module should not have legacy authentication DLL requirements' {
$manifest = Import-PowerShellDataFile (Join-Path -Path $PSScriptRoot -ChildPath 'MsrcSecurityUpdates.psd1')
$manifest.RequiredAssemblies | Where-Object { $_ -like '*ActiveDirectory*' } | Should BeNullOrEmpty
}

It 'Module should require MSAL.PS module' {
$manifest = Import-PowerShellDataFile (Join-Path -Path $PSScriptRoot -ChildPath 'MsrcSecurityUpdates.psd1')
$msalRequired = $manifest.RequiredModules | Where-Object { $_.ModuleName -eq 'MSAL.PS' }
$msalRequired | Should Not BeNullOrEmpty
}
}

Describe 'API version after module loading' {
It '$msrcApiUrl = https://api.msrc.microsoft.com/cvrf/v3.0' {
$msrcApiUrl -eq 'https://api.msrc.microsoft.com/cvrf/v3.0' | Should Be $true
Expand Down
6 changes: 3 additions & 3 deletions src/MsrcSecurityUpdates/Private/Get-CVRFID.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Process {

$RestMethod.Add('ProxyCredential',$global:msrcProxyCredential)

} elseif ($global:MSRCAdalAccessToken) {

$RestMethod.Headers.Add('Authorization',$($global:MSRCAdalAccessToken.CreateAuthorizationHeader()))
} elseif ($script:MSRCMsalAccessToken) {

$RestMethod.Headers.Add('Authorization',"Bearer $($script:MSRCMsalAccessToken.AccessToken)")

}

try {
Expand Down
58 changes: 29 additions & 29 deletions src/MsrcSecurityUpdates/Public/Get-KBDownloadUrl.ps1
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Function Get-KBDownloadUrl {
<#
.SYNOPSIS
Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document.

.DESCRIPTION
Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document.

.PARAMETER KBArticleObject
The KB Article object that contains the id, url, and subtype.

.EXAMPLE
[PSCustomObject]@{ID="kb123456"; URL="microsoft.com"; SubType="Required"} | Get-KBDownloadUrl
#>
[CmdletBinding()]
[OutputType([System.String])]
Param (
[Parameter(Mandatory,ValueFromPipeline)]
[PSCustomObject]$KBArticleObject
)
Begin {
$HTML_TO_RETURN = @()
}
Process {
Function Get-KBDownloadUrl {
<#
.SYNOPSIS
Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document.
.DESCRIPTION
Takes the kb output from Get-MsrcCvrfAffectedSoftware and builds the html to insert into a document.
.PARAMETER KBArticleObject
The KB Article object that contains the id, url, and subtype.
.EXAMPLE
[PSCustomObject]@{ID="kb123456"; URL="microsoft.com"; SubType="Required"} | Get-KBDownloadUrl
#>
[CmdletBinding()]
[OutputType([System.String])]
Param (
[Parameter(Mandatory,ValueFromPipeline)]
[PSCustomObject]$KBArticleObject
)
Begin {
$HTML_TO_RETURN = @()
}
Process {
if (-not($KBArticleObject)){
'None'
} else {
Expand All @@ -36,9 +36,9 @@ Process {
$HTML_TO_RETURN += $('<a href="{0}" >{1}' -f $kb.URL, $kb.ID)
}
}
}
}
End {
$HTML_TO_RETURN -join '<br />'
}
}
}
End {
$HTML_TO_RETURN -join '<br />'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Process {
Where-Object {$_.Type -eq $ThreatsImpactType } |
Where-Object { $_.ProductID -contains $id }
).Description.Value
);
);
Weakness = $v.CWE.Value ;
'Customer Action Required' = if ($customerActionNotes = $v.Notes | Where-Object { $_.Title -eq "Customer Action Required" }) {
$customerActionNotes.Value
Expand Down
6 changes: 3 additions & 3 deletions src/MsrcSecurityUpdates/Public/Get-MsrcCvrfDocument.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ Process {

}

if ($global:MSRCAdalAccessToken) {

$RestMethod.Headers.Add('Authorization', $global:MSRCAdalAccessToken.CreateAuthorizationHeader())
if ($script:MSRCMsalAccessToken) {
$RestMethod.Headers.Add('Authorization', "Bearer $($script:MSRCMsalAccessToken.AccessToken)")

}

Expand Down
5 changes: 2 additions & 3 deletions src/MsrcSecurityUpdates/Public/Get-MsrcSecurityUpdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ Process {
if ($global:msrcProxyCredential){
$RestMethod.Add('ProxyCredential' , $global:msrcProxyCredential)
}
if ($global:MSRCAdalAccessToken)
{
$RestMethod.Headers.Add('Authorization' , $global:MSRCAdalAccessToken.CreateAuthorizationHeader())
if ($script:MSRCMsalAccessToken){
$RestMethod.Headers.Add('Authorization' , "Bearer $($script:MSRCMsalAccessToken.AccessToken)")
}

try {
Expand Down
Loading