Skip to content

Commit db225fd

Browse files
authored
Merge pull request #7841 from ahardin-rh/accidental-access
Update the docs to highlight that -z can prevent typos that can cause unintentional access
2 parents 489b5df + b29be01 commit db225fd

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

admin_guide/manage_scc.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,14 @@ can use the `-z` flag and just specify the `<serviceaccount_name>`.
476476
$ oc adm policy add-scc-to-user <scc_name> -z <serviceaccount_name>
477477
----
478478

479+
[IMPORTANT]
480+
====
481+
Usage of the `-z` flag as described above is highly recommended, as it helps
482+
prevent typos and ensures that access is granted only to the specified service
483+
account. If not in the project, use the `-n` option to indicate the project
484+
namespace it applies to.
485+
====
486+
479487
To add an SCC to a group:
480488

481489
----

admin_guide/service_accounts.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ For example, to add the *view* role to the *robot* service account in the
4545
$ oc policy add-role-to-user view system:serviceaccount:top-secret:robot
4646
----
4747

48+
[IMPORTANT]
49+
====
50+
If you want to grant access to a specific service account in a project, you can
51+
use the `-z` flag. From the project to which the service account belongs, use
52+
the `-z` flag and specify the `<serviceaccount_name>`. This is highly
53+
recommended, as it helps prevent typos and ensures that access is granted only
54+
to the specified service account. For example:
55+
56+
----
57+
$ oc policy add-role-to-user <role_name> -z <serviceaccount_name>
58+
----
59+
60+
If not in the project, use the `-n` option to indicate the project namespace it
61+
applies to, as shown in the examples below.
62+
====
63+
4864
Every service account is also a member of two groups:
4965

5066
system:serviceaccounts:: Includes all service accounts in the system.
@@ -64,6 +80,7 @@ To allow all service accounts in the *managers* project to edit resources in the
6480
----
6581
$ oc policy add-role-to-group edit system:serviceaccounts:managers -n top-secret
6682
----
83+
6784
// end::sa-user-names-and-groups[]
6885

6986

0 commit comments

Comments
 (0)