Skip to content

Commit 42d1cae

Browse files
Add a small note about security implications of using cibuildwheel in CI runners (#2711)
* Bump to actions/checkout v6 everywhere * Add a note about security * Not persisting credentials is still valuable * Fix bad indentation * Improve wording, remove link to PyPA guides Co-Authored-By: Joe Rickerby <1244307+joerick@users.noreply.github.com> --------- Co-authored-by: Joe Rickerby <1244307+joerick@users.noreply.github.com>
1 parent d31248f commit 42d1cae

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ jobs:
9292

9393
steps:
9494
- uses: actions/checkout@v6
95+
with:
96+
persist-credentials: false
9597

9698
# Used to host cibuildwheel
9799
- uses: actions/setup-python@v6
@@ -124,6 +126,11 @@ The following diagram summarises the steps that cibuildwheel takes on each platf
124126
125127
<sup>Explore an interactive version of this diagram [in the docs](https://cibuildwheel.pypa.io/en/stable/#how-it-works).</sup>
126128
129+
> [!WARNING]
130+
> Building and testing wheels executes arbitrary code from your project and its dependencies. Although cibuildwheel uses OCI containers and Pyodide for some builds, these provide no security guarantees - the code you're building and testing has full access to the environment that's invoking cibuildwheel.
131+
>
132+
> If you cannot trust all the code that's pulled in, maintain good security hygiene: keep the job that builds distributions separate from the job that uploads them to PyPI, handle secrets and credentials with care and rotate them regularly, and follow the principle of least privilege when granting permissions. Do not store sensitive data on CI runners.
133+
127134
128135
<!--[[[cog from readme_options_table import get_table; print(get_table()) ]]]-->
129136

docs/deliver-to-pypi.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ GitHub actions has pipx in all the runners as a supported package manager, as we
2929
name: Make SDist
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v5
32+
- uses: actions/checkout@v6
3333
with:
3434
fetch-depth: 0 # Optional, use if you use setuptools_scm
3535
submodules: true # Optional, use if you have submodules
36+
persist-credentials: false # Highly recommended as a good security practice to not store credentials in disk, unless you need this for your specific use case
3637

3738
- name: Build SDist
3839
run: pipx run build --sdist

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ This diagram summarises the steps that cibuildwheel takes on each platform to bu
2222
%}
2323

2424
This isn't exhaustive, for a full list of the things cibuildwheel can do, check the [options](options.md) page.
25+
26+
!!! warning "A note on security"
27+
Building and testing wheels executes arbitrary code from your project and its dependencies. Although cibuildwheel uses OCI containers and Pyodide for some builds, these provide no security guarantees - the code you're building and testing has full access to the environment that's invoking cibuildwheel.
28+
29+
If you cannot trust all the code that's pulled in, maintain good security hygiene: keep the job that builds distributions separate from the job that uploads them to PyPI, handle secrets and credentials with care and rotate them regularly, and follow the principle of least privilege when granting permissions. Do not store sensitive data on CI runners.

examples/github-deploy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ jobs:
4848
platform: pyodide
4949

5050
steps:
51-
- uses: actions/checkout@v5
51+
- uses: actions/checkout@v6
52+
with:
53+
persist-credentials: false
5254

5355
- name: Build wheels
5456
uses: pypa/cibuildwheel@v3.3.1
@@ -70,7 +72,9 @@ jobs:
7072
name: Build source distribution
7173
runs-on: ubuntu-latest
7274
steps:
73-
- uses: actions/checkout@v5
75+
- uses: actions/checkout@v6
76+
with:
77+
persist-credentials: false
7478

7579
- name: Build sdist
7680
run: pipx run build --sdist

examples/github-minimal.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-14]
1313

1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
16+
with:
17+
persist-credentials: false
1618

1719
- name: Build wheels
1820
uses: pypa/cibuildwheel@v3.3.1

examples/github-pipx.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-14]
1313

1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
16+
with:
17+
persist-credentials: false
1618

1719
- name: Build wheels
1820
run: pipx run cibuildwheel==3.3.1

examples/github-with-qemu.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-14]
1313

1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
16+
with:
17+
persist-credentials: false
1618

1719
- name: Set up QEMU
1820
if: runner.os == 'Linux' && runner.arch == 'X64'

0 commit comments

Comments
 (0)