Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Signing the Pode Module for Enhanced Security #1230

Open
mdaneri opened this issue Jan 9, 2024 · 0 comments
Open

Request for Signing the Pode Module for Enhanced Security #1230

mdaneri opened this issue Jan 9, 2024 · 0 comments

Comments

@mdaneri
Copy link
Contributor

mdaneri commented Jan 9, 2024

Describe the Change

Signing the PowerShell module would enhance its security by ensuring its authenticity and integrity. This is especially important given the widespread use of Pode in various production environments where security is paramount.

Key Benefits:

  • Authenticity: Users can verify that the module comes from a trusted source.
  • Integrity: Ensures that the module has not been tampered with since it was signed.
  • Confidence: Increases user confidence in using Pode, especially in security-sensitive environments.

To sign the code, the cheapest solution I found is provided by https://Certum.eu
Euro 69 for the first year and Euro 20 per year
https://shop.certum.eu/open-source-code-signing.html

####Change to pode.build.ps1 to support signing

Task Sign{
 # Define the base directory where your scripts are located
    $path = './pkg'

    if ($Version){

        if (! (Test-Path $path)) {
            Invoke-Build Pack -Version $Version
        }
        #$cert = New-SelfSignedCertificate -DnsName yourname -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigning

        # Get the code signing certificate
        $cert = @(Get-ChildItem cert:\CurrentUser\My -CodeSigningCert)[0]

        # Check if a code signing certificate is available
        if ($null -eq $cert ) {
            Write-Error 'No code signing certificate found.'
            exit
        }

        # Recursively find all .ps1 and .psd1 files and sign them
        Get-ChildItem -Path $path -Recurse -Include *.ps1, *.psd1 | ForEach-Object {
            write-host "Signing $($_.FullName)"
            Set-AuthenticodeSignature -FilePath $_.FullName -Certificate $cert
        }
    }else{
        Write-Error "Parameter -Version is required"
    }


}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant