diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index af18c5ffe6f..417a83573c0 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/powershell/test-deps:ubuntu-18.04 +FROM mcr.microsoft.com/powershell/test-deps:ubuntu-18.04@sha256:20154a16708d4a92ebe81393361f27c7567e6553869e89dd6abdd198cc8ba309 # Avoid warnings by switching to noninteractive ENV DEBIAN_FRONTEND=noninteractive diff --git a/.devcontainer/fedora30/Dockerfile b/.devcontainer/fedora30/Dockerfile index ae8d15ebd54..f13fb087805 100644 --- a/.devcontainer/fedora30/Dockerfile +++ b/.devcontainer/fedora30/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -FROM mcr.microsoft.com/powershell:preview-fedora-30 +FROM mcr.microsoft.com/powershell:preview-fedora-30@sha256:f405d4d60f8d196532da75038c76c052084ef02121f8e2d3852080ff4a230a5a # Configure apt and install packages RUN dnf install -y git procps wget findutils \ diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 37c0fc6ca7c..7996891b5f7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -58,3 +58,10 @@ updates: interval: "daily" labels: - "CL-BuildPackaging" + + - package-ecosystem: docker + directory: / + schedule: + interval: daily + labels: + - "CL-BuildPackaging" diff --git a/.github/workflows/AssignPrs.yml b/.github/workflows/AssignPrs.yml index b2a7610d60c..419d704ce1d 100644 --- a/.github/workflows/AssignPrs.yml +++ b/.github/workflows/AssignPrs.yml @@ -2,6 +2,9 @@ name: Auto Assign PR Maintainer on: pull_request: types: [opened, edited] +permissions: + contents: read + jobs: run: runs-on: ubuntu-latest @@ -9,7 +12,7 @@ jobs: issues: write pull-requests: write steps: - - uses: wow-actions/auto-assign@v3 + - uses: wow-actions/auto-assign@67fafa03df61d7e5f201734a2fa60d1ab111880d # v3.0.2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # using the `org/team_slug` or `/team_slug` syntax to add git team as reviewers diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a18163af84d..fadb01d2f0f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,13 +37,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: '0' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,4 +66,4 @@ jobs: name: Build - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0 diff --git a/.github/workflows/createReminders.yml b/.github/workflows/createReminders.yml index 290141703d7..4bd5e1a7b69 100644 --- a/.github/workflows/createReminders.yml +++ b/.github/workflows/createReminders.yml @@ -16,4 +16,4 @@ jobs: steps: - name: check for reminder - uses: agrc/create-reminder-action@v1 + uses: agrc/create-reminder-action@922893a5705067719c4c4751843962f56aabf5eb # v1.1.13 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000000..a52521621b3 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,22 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/markdownLink.yml b/.github/workflows/markdownLink.yml index 9f66988fe95..8f56f27998a 100644 --- a/.github/workflows/markdownLink.yml +++ b/.github/workflows/markdownLink.yml @@ -12,8 +12,8 @@ jobs: markdown-link-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1 with: use-quiet-mode: 'yes' use-verbose-mode: 'yes' @@ -26,13 +26,13 @@ jobs: statuses: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: # Full git history is needed to get a proper # list of changed files within `super-linter` fetch-depth: 0 - name: Lint Markdown - uses: super-linter/super-linter@v5 + uses: super-linter/super-linter@a8150b40c89574adb5f68bf9502b890a236a06b3 # v5.7.2 env: VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: master diff --git a/.github/workflows/markdownLinkDaily.yml b/.github/workflows/markdownLinkDaily.yml index 557b801273d..48643e8a6ba 100644 --- a/.github/workflows/markdownLinkDaily.yml +++ b/.github/workflows/markdownLinkDaily.yml @@ -18,15 +18,15 @@ jobs: if: github.repository == 'PowerShell/PowerShell' steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Check Links - uses: gaurav-nelson/github-action-markdown-link-check@v1 + uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1 with: use-quiet-mode: 'yes' use-verbose-mode: 'yes' config-file: .github/workflows/markdown-link/config.json - name: Microsoft Teams Notifier - uses: skitionek/notify-microsoft-teams@master + uses: skitionek/notify-microsoft-teams@77cc88b484449e2318245a54c115c5dca0eae4ef # master if: failure() with: webhook_url: ${{ secrets.PS_BUILD_TEAMS_CHANNEL }} diff --git a/.github/workflows/processReminders.yml b/.github/workflows/processReminders.yml index c660788a620..ddee7f2be0e 100644 --- a/.github/workflows/processReminders.yml +++ b/.github/workflows/processReminders.yml @@ -17,4 +17,4 @@ jobs: steps: - name: check reminders and notify - uses: agrc/reminder-action@v1 + uses: agrc/reminder-action@e59091b4e9705a6108120cb50823108df35b5392 # v1.0.12 diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index faf5ddda535..7e5e41058bf 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -18,11 +18,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v4 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: fetch-depth: 0 - name: Post rebase started comment to pull request - uses: actions/github-script@v6 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 continue-on-error: true with: script: | @@ -34,6 +34,6 @@ jobs: body: backport_start_body }); - name: Automatic Rebase - uses: cirrus-actions/rebase@1.8 + uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 00000000000..95ee238ca60 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,71 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '20 7 * * 2' + push: + branches: ["master"] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + contents: read + actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@f72882a05ba58122a44b17f2fce8fb50e5c79a59 # v2.25.0 + with: + sarif_file: results.sarif diff --git a/test/docker/networktest/Dockerfile b/test/docker/networktest/Dockerfile index cac78654c86..d558b139246 100644 --- a/test/docker/networktest/Dockerfile +++ b/test/docker/networktest/Dockerfile @@ -1,5 +1,5 @@ # escape=` -FROM mcr.microsoft.com/windows/servercore:ltsc2022 +FROM mcr.microsoft.com/windows/servercore:ltsc2022@sha256:5d09ffa90d91a46e2fe7652b0a37cbf5217f34a819c3d71cbe635dae8226061b SHELL ["pwsh.exe","-command"] diff --git a/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile deleted file mode 100644 index e0a3946c3c4..00000000000 --- a/tools/releaseBuild/Images/microsoft_powershell_centos7/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# Docker image file that describes an Centos7 image with PowerShell installed from Microsoft YUM Repo - -FROM mcr.microsoft.com/powershell:centos-7 -LABEL maintainer="PowerShell Team " - -# Install dependencies and clean up -RUN yum install -y \ - glibc \ - libcurl \ - ca-certificates \ - libgcc \ - libicu \ - openssl \ - libstdc++ \ - ncurses-base \ - libunwind \ - uuid \ - zlib \ - which \ - curl \ - git \ - wget \ - && yum clean all - -COPY PowerShellPackage.ps1 / - -ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - -# Use PowerShell as the default shell -ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile deleted file mode 100644 index 401af92128a..00000000000 --- a/tools/releaseBuild/Images/microsoft_powershell_ubuntu16.04/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# Docker image file that describes an Ubuntu16.04 image with PowerShell installed from Microsoft APT Repo - -FROM mcr.microsoft.com/powershell:ubuntu-16.04 -LABEL maintainer="PowerShell Team " - -# Install dependencies and clean up -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - apt-utils \ - libc6 \ - libcurl3 \ - ca-certificates \ - libgcc1 \ - libicu55 \ - libssl1.0.0 \ - libstdc++6 \ - libtinfo5 \ - libunwind8 \ - libuuid1 \ - libcroco3 \ - libgraphite2-3 \ - zlib1g \ - curl \ - git \ - apt-transport-https \ - locales \ - wget \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -COPY PowerShellPackage.ps1 / - -ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - -# Use PowerShell as the default shell -ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_ubuntu18.04/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_ubuntu18.04/Dockerfile deleted file mode 100644 index f8049e9de1c..00000000000 --- a/tools/releaseBuild/Images/microsoft_powershell_ubuntu18.04/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -# Docker image file that describes an Ubuntu16.04 image with PowerShell installed from Microsoft APT Repo - -FROM mcr.microsoft.com/powershell:ubuntu-18.04 -LABEL maintainer="PowerShell Team " - -# Install dependencies and clean up -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - apt-utils \ - apt-utils \ - libc6 \ - libcurl4 \ - ca-certificates \ - libgcc1 \ - libicu60 \ - libssl1.0.0 \ - libstdc++6 \ - libtinfo5 \ - libunwind8 \ - libuuid1 \ - libcroco3 \ - libgraphite2-3 \ - zlib1g \ - curl \ - git \ - apt-transport-https \ - locales \ - wget \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -COPY PowerShellPackage.ps1 / - -ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - -# Use PowerShell as the default shell -ENTRYPOINT [ "pwsh" ] diff --git a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/Dockerfile b/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/Dockerfile deleted file mode 100644 index ef24e3aa7e9..00000000000 --- a/tools/releaseBuild/Images/microsoft_powershell_windowsservercore/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# escape=` -#0.3.6 (no powershell 6) -FROM mcr.microsoft.com/powershell:windowsservercore -LABEL maintainer='PowerShell Team ' -LABEL description="This Dockerfile for Windows Server Core with git installed via chocolatey." - -SHELL ["C:\\Program Files\\PowerShell\\latest\\pwsh.exe", "-command"] -# Install Git, and NuGet -# Git installs to C:\Program Files\Git -# nuget installs to C:\ProgramData\chocolatey\bin\NuGet.exe -COPY dockerInstall.psm1 containerFiles/dockerInstall.psm1 -RUN Import-Module ./containerFiles/dockerInstall.psm1; ` - Install-ChocolateyPackage -PackageName git -Executable git.exe; ` - Install-ChocolateyPackage -PackageName nuget.commandline -Executable nuget.exe -Cleanup - -# Install WIX -ADD https://github.com/wixtoolset/wix3/releases/download/wix311rtm/wix311-binaries.zip /wix.zip -COPY wix.psm1 containerFiles/wix.psm1 -RUN Import-Module ./containerFiles/wix.psm1; ` - Install-WixZip -zipPath \wix.Zip - -# Install makeappx and makepri -ADD https://pscoretestdata.blob.core.windows.net/build-files/makeappx/makeappx.zip?sp=r&st=2019-04-05T18:02:52Z&se=2020-04-06T02:02:52Z&spr=https&sv=2018-03-28&sig=t07uC1K3uFLtINQsmorHobgPh%2B%2BBgjFnmHEJGNZT6Hk%3D&sr=b /makeappx.zip -RUN Expand-Archive /makeappx.zip - -COPY PowerShellPackage.ps1 / - -ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - -ENTRYPOINT ["C:\\Program Files\\PowerShell\\latest\\pwsh.exe", "-command"]