Skip to content

Commit 1e02442

Browse files
[Github][Docs] Add best practice for top level read permissions (#131470)
This patch adds a section pointing out how permissions should be done within Github workflows. I believe all of our workflows are currently compliant with this, but it helps to have something to point to documenting the practice and especially the motivation.
1 parent 3fe914c commit 1e02442

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/docs/CIBestPractices.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,19 @@ image to a new version with potentially breaking changes, instead allowing us
9292
to explicitly opt-in to using the new image when we have done sufficient
9393
testing to ensure that our existing workflows work as expected in the new
9494
environment.
95+
96+
Top Level Read Permissions
97+
--------------------------
98+
99+
The top of every workflow should specify that the job only has read
100+
permissions:
101+
102+
.. code-block:: yaml
103+
104+
permissions:
105+
contents: read
106+
107+
If specific jobs within the workflow need additional permissions, those
108+
permissions should be added within the specific job. This practice locks down
109+
all permissions by default and only enables them when needed, better enforcing
110+
the principle of least privilege.

0 commit comments

Comments
 (0)