diff --git a/.azure-pipelines/1es-entra-powershell-ci-build.yml b/.azure-pipelines/1es-entra-powershell-ci-build.yml index 20001ad6ab..d43b9004ae 100644 --- a/.azure-pipelines/1es-entra-powershell-ci-build.yml +++ b/.azure-pipelines/1es-entra-powershell-ci-build.yml @@ -32,6 +32,14 @@ extends: name: MSSecurity-1ES-Build-Agents-Pool image: MSSecurity-1ES-Windows-2022 os: windows + credscan: + suppressionsFile: $(Build.SourcesDirectory)\.config\CredScanSuppressions.json + outputFormat: pre + debugMode: false + batchSize: 16 + psscriptanalyzer: + break: false + enabled: true stages: - stage: build jobs: diff --git a/.config/CredScanSuppressions.json b/.config/CredScanSuppressions.json new file mode 100644 index 0000000000..9ce47d809b --- /dev/null +++ b/.config/CredScanSuppressions.json @@ -0,0 +1,45 @@ +{ + "tool": "Credential Scanner", + "suppressions": [ + { + "file": "test\\module\\Entra\\Update-EntraSignedInUserPassword.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "test\\module\\Entra\\Update-EntraUserFromFederated.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "test\\module\\EntraBeta\\Update-EntraBetaSignedInUserPassword.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "test\\module\\EntraBeta\\Update-EntraBetaUserFromFederated.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "testVNext\\Entra\\Users\\Update-EntraSignedInUserPassword.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "testVNext\\Entra\\Users\\Update-EntraUserFromFederated.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "testVNext\\EntraBeta\\Users\\Update-EntraBetaSignedInUserPassword.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "testVNext\\EntraBeta\\Users\\Update-EntraBetaUserFromFederated.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "test\\module\\Entra\\New-EntraUser.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + }, + { + "file": "testVNext\\Entra\\Users\\New-EntraUser.Tests.ps1", + "_justification": "Unit test file has a sample Password used in mocking." + } + ] +} \ No newline at end of file diff --git a/.configCredScanSuppressions.json b/.configCredScanSuppressions.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/build/ValidateAuthenticodeSignature.ps1 b/build/ValidateAuthenticodeSignature.ps1 index 3904e0c5e6..a75010abd9 100644 --- a/build/ValidateAuthenticodeSignature.ps1 +++ b/build/ValidateAuthenticodeSignature.ps1 @@ -1,8 +1,8 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ -# [cmdletbinding()] -# param ( -# [string]$Module = "Entra" -# ) +Set-StrictMode -Version 5 . "$psscriptroot/common-functions.ps1" diff --git a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/New-EntraUser.ps1 b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/New-EntraUser.ps1 index 1a9dd81a22..68616d017c 100644 --- a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/New-EntraUser.ps1 +++ b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/New-EntraUser.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraUser { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( diff --git a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Set-EntraUser.ps1 b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Set-EntraUser.ps1 index b14221cd9d..accbb1423b 100644 --- a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Set-EntraUser.ps1 +++ b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Set-EntraUser.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraUser { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( diff --git a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Update-EntraUserFromFederated.ps1 b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Update-EntraUserFromFederated.ps1 index b5e4230487..873e5ef61b 100644 --- a/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Update-EntraUserFromFederated.ps1 +++ b/moduleVNext/Entra/Microsoft.Graph.Entra/Users/Update-EntraUserFromFederated.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Update-EntraUserFromFederated { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String] $UserPrincipalName, diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaUser.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaUser.ps1 index b9a46bc8d8..af5a8529c1 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaUser.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaUser.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function New-EntraBetaUser { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Set-EntraBetaUser.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Set-EntraBetaUser.ps1 index 83a0491f5b..71a65d71fe 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Set-EntraBetaUser.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Set-EntraBetaUser.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Set-EntraBetaUser { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'InvokeByDynamicParameters')] param ( diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Update-EntraBetaUserFromFederated.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Update-EntraBetaUserFromFederated.ps1 index 38cf3dee80..a2c4544441 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Update-EntraBetaUserFromFederated.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/Update-EntraBetaUserFromFederated.ps1 @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ function Update-EntraBetaUserFromFederated { + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingUserNameAndPassWordParams", "", Scope="Function", Target="*")] [CmdletBinding(DefaultParameterSetName = 'GetQuery')] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)][System.String] $UserPrincipalName, diff --git a/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 index e3f259d7c1..c52dbb7607 100644 --- a/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 @@ -1,6 +1,10 @@ # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ + +[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param() + BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Users diff --git a/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 b/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 index f1d0495279..711ec74034 100644 --- a/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 +++ b/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 @@ -2,6 +2,9 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ +[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param() + BeforeAll{ if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Users diff --git a/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 b/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 index ba378a9889..f25a87c45d 100644 --- a/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 @@ -2,6 +2,9 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ +[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param() + BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users