diff --git a/.github/workflows/backstage-catalog-helper.yml b/.github/workflows/backstage-catalog-helper.yml index 951f286d6..d8192522e 100644 --- a/.github/workflows/backstage-catalog-helper.yml +++ b/.github/workflows/backstage-catalog-helper.yml @@ -10,6 +10,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 0 + persist-credentials: false - name: Run Backstage Catalog Info Helper uses: cds-snc/backstage-catalog-info-helper-action@cc75afc29a0ade6c41400132ff9e1222f8916ba6 # v0.3.1 with: diff --git a/.github/workflows/export_github_data.yml b/.github/workflows/export_github_data.yml index 49ff02ecc..a9d3c3222 100644 --- a/.github/workflows/export_github_data.yml +++ b/.github/workflows/export_github_data.yml @@ -4,6 +4,13 @@ on: schedule: - cron: "20 7 * * *" +permissions: + id-token: write + contents: read + issues: read + pull-requests: read + security-events: read + jobs: export-data: runs-on: ubuntu-latest @@ -15,11 +22,19 @@ jobs: DNS_PROXY_LOGANALYTICSWORKSPACEID: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }} DNS_PROXY_LOGANALYTICSSHAREDKEY: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }} - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Configure AWS credentials using OIDC + uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1 + with: + role-to-assume: arn:aws:iam::739275439843:role/data-lake-github-data-export + role-session-name: GithubDataExport + aws-region: ca-central-1 - name: Export Data - uses: cds-snc/github-repository-metadata-exporter@7f8f3eccaf3e15675fc70611e913ec1458510540 + uses: cds-snc/github-repository-metadata-exporter@ccde2e2cc2d351bbc6fcd4146d2193d8da2b7a95 with: github-app-id: ${{ secrets.SRE_BOT_RO_APP_ID }} github-app-installation-id: ${{ secrets.SRE_BOT_RO_INSTALLATION_ID }} github-app-private-key: ${{ secrets.SRE_BOT_RO_PRIVATE_KEY }} log-analytics-workspace-id: ${{ secrets.LOG_ANALYTICS_WORKSPACE_ID }} log-analytics-workspace-key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }} + s3-bucket: ${{ secrets.DATA_LAKE_GITHUB_METADATA_EXPORT_S3_BUCKET }} + aws-region: ${{ secrets.DATA_LAKE_GITHUB_METADATA_EXPORT_AWS_REGION }} \ No newline at end of file diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index d499cc531..caaf1e9f0 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -8,15 +8,17 @@ on: branches: - main -permissions: read-all +permissions: + contents: read + issues: read + pull-requests: read + checks: read + actions: read jobs: analysis: name: Scorecards analysis runs-on: ubuntu-latest - permissions: - actions: read - contents: read steps: - name: "Checkout code" diff --git a/.github/workflows/s3-backup.yml b/.github/workflows/s3-backup.yml index 09801b113..a61edc6f5 100644 --- a/.github/workflows/s3-backup.yml +++ b/.github/workflows/s3-backup.yml @@ -4,6 +4,10 @@ on: schedule: - cron: "0 6 * * *" +permissions: + id-token: write + contents: read + jobs: s3-backup: runs-on: ubuntu-latest @@ -13,24 +17,20 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 # retrieve all history + persist-credentials: false - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0 + uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0 with: - aws-access-key-id: ${{ secrets.AWS_S3_BACKUP_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_S3_BACKUP_SECRET_ACCESS_KEY }} + role-to-assume: ${{ secrets.AWS_S3_BACKUP_IAM_ROLE_ARN }} + role-session-name: S3Backup aws-region: ca-central-1 - - name: Create ZIP bundle + - name: Upload zip to S3 bucket run: | ZIP_FILE=`basename ${{ github.repository }}`-`date '+%Y-%m-%d'`.zip zip -rq "${ZIP_FILE}" . - mkdir -p ${{ github.repository }} - mv "${ZIP_FILE}" ${{ github.repository }} - - - name: Upload to S3 bucket - run: | - aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*' + aws s3 cp "${ZIP_FILE}" s3://${{ secrets.AWS_S3_BACKUP_BUCKET }}/${{ github.repository }}/"${ZIP_FILE}" - name: Notify Slack channel if this job failed if: ${{ failure() }}