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

[PM-15126] Second attempt: Remove reliance on secrets in build pipelines #12387

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

coroiu
Copy link
Contributor

@coroiu coroiu commented Dec 13, 2024

🎟️ Tracking

📔 Objective

This PR reintroduces #12243 with one important tweak:

  • Bots will no longer be able to run build workflows

This is because bots have access to secrets and so we don't want to give them unsupervised access

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

coroiu and others added 3 commits December 13, 2024 10:51
…ance on secrets (#12243)

* feat: create copy of desktop build for PR target

* chore: add temporary file to trigger ci

* fix: remove check-run from regular desktop build

* feat: change browser build to not use pr target

* fix: skip build-safari if secret is not available

* feat: skip safari build if secrets are not available

* feat: let windows desktop build without secrets

* fix: has_secrets not being output correctly

* feat: let macos desktop build without secrets

* feat: don't build browser as part of desktop

* feat: change CLI to pull_request

* feat: let web build without secrets

* feat: tweak lint to run on PR and not just push

* feat: add PR target workflows

* fix: remove wip files

* fix: lint on hotfix-rc branches

* feat: add new workflows to CODEOWNERS

(cherry picked from commit f8c33ea)
Comment on lines +58 to 65
# Enforce permissions _if_ the workflow has access to secrets to avoid
# bots having unsupervised access to secrets.
check-run:
name: Check PR run
needs:
- check-secrets
if: ${{ needs.check-secrets.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
Copy link
Contributor Author

@coroiu coroiu Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point-of-interest: Unfortunately simply referring to bitwarden/gh-actions/../check-run.yml causes all of these jobs to fail in forked repositories (example: https://github.com/coroiu/clients/actions/runs/12313774955/workflow#L57). I think this can be fixed in check-run.yml by using job-specific permissions (jobs.<job_id>.permissions) instead of as a top-level key.

Working builds in workflows was never a requirement for this ticket so we can fix this later

Copy link
Contributor

github-actions bot commented Dec 13, 2024

Logo
Checkmarx One – Scan Summary & Details93dc4b74-d298-4126-b1e6-d46ee1390b72

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Client_JQuery_Deprecated_Symbols /apps/cli/src/service-container/service-container.ts: 878 Attack Vector
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 334 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 154 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 364 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 143 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 399 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 365 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1417 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1071 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 498 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 254 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 299 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1160 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 379 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 413 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 210 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 488 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 910 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1517 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1566 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 203 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 454 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 717 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/background/runtime.background.ts: 355
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 227
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 357
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 191
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 132
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1012
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 478
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 665
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 465
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1101
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 306
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1505
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 337
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1456
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 853
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 121
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 184
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 434
LOW Unpinned Actions Full Length Commit SHA /build-web.yml: 385
LOW Unpinned Actions Full Length Commit SHA /build-browser.yml: 379
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 1356
LOW Unpinned Actions Full Length Commit SHA /build-cli.yml: 276
LOW Unpinned Actions Full Length Commit SHA /build-desktop.yml: 342

@coroiu coroiu changed the title [PM-15126] Second attempt [PM-15126] Second attempt: Remove reliance on secrets in build pipelines Dec 13, 2024
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.45%. Comparing base (31be6a7) to head (e72ab16).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12387      +/-   ##
==========================================
- Coverage   33.46%   33.45%   -0.01%     
==========================================
  Files        2908     2908              
  Lines       91057    91057              
  Branches    17336    17336              
==========================================
- Hits        30474    30467       -7     
- Misses      58177    58184       +7     
  Partials     2406     2406              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coroiu coroiu marked this pull request as ready for review December 13, 2024 10:45
@coroiu coroiu requested a review from a team as a code owner December 13, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant