Skip to content

Commit aa1f8d8

Browse files
authored
Merge pull request #290 from kmcquade/docs/add-minimization-library-to-docs
Update docs on minimization
2 parents 9883099 + 7199cb1 commit aa1f8d8

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Policy Minimization
2+
===================
3+
4+
The documentation on policy minimization is relevant to this library content. That documentation can be found [here](https://policy-sentry.readthedocs.io/en/latest/writing-policies/minimization/).
5+
6+
Note: The most relevant content from here is the `minimize_statement_actions` function.
7+
8+
Real-life usage of this function can be found in the `command.write_policy` module.
9+
10+
## writing.minimize
11+
12+
::: policy_sentry.writing.minimize
13+
rendering:
14+
show_source: true
15+

docs/writing-policies/minimization.md

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,52 +49,35 @@ wildcard-only:
4949
policy_sentry write-policy --input-file crud.yml --minimize 0
5050
```
5151

52-
The output has **749 characters** (not counting whitespaces) and will look like this:
52+
The output has **500 characters** (not counting whitespaces) and will look like this:
5353

5454
```json
5555
{
5656
"Version": "2012-10-17",
5757
"Statement": [
5858
{
59-
"Sid": "SsmReadParameter",
59+
"Sid": "SsmMultParametermyparameter",
6060
"Effect": "Allow",
6161
"Action": [
6262
"ssm:getpar*",
63-
"ssm:listt*"
64-
],
65-
"Resource": [
66-
"arn:aws:ssm:us-east-1:123456789012:parameter/myparameter"
67-
]
68-
},
69-
{
70-
"Sid": "SsmWriteParameter",
71-
"Effect": "Allow",
72-
"Action": [
7363
"ssm:deletepar*",
7464
"ssm:la*",
75-
"ssm:putp*"
65+
"ssm:putp*",
66+
"ssm:listt*"
7667
],
7768
"Resource": [
7869
"arn:aws:ssm:us-east-1:123456789012:parameter/myparameter"
7970
]
8071
},
8172
{
82-
"Sid": "SecretsmanagerPermissionsmanagementSecret",
83-
"Effect": "Allow",
84-
"Action": [
85-
"secretsmanager:deleter*",
86-
"secretsmanager:putr*"
87-
],
88-
"Resource": [
89-
"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret"
90-
]
91-
},
92-
{
93-
"Sid": "SecretsmanagerTaggingSecret",
73+
"Sid": "SecretsmanagerMultSecretmysecret",
9474
"Effect": "Allow",
9575
"Action": [
9676
"secretsmanager:t*",
97-
"secretsmanager:un*"
77+
"secretsmanager:un*",
78+
"secretsmanager:deleter*",
79+
"secretsmanager:putr*",
80+
"secretsmanager:v*"
9881
],
9982
"Resource": [
10083
"arn:aws:secretsmanager:us-east-1:123456789012:secret:mysecret"
@@ -115,7 +98,11 @@ policy_sentry write-policy --input-file crud.yml
11598

11699
* The output has **935 characters** and will look like this:
117100

118-
```json
101+
<details open>
102+
<summary>policy_sentry query action-table --service all</summary>
103+
<br>
104+
<pre>
105+
<code>
119106
{
120107
"Version": "2012-10-17",
121108
"Statement": [
@@ -170,7 +157,9 @@ policy_sentry write-policy --input-file crud.yml
170157
}
171158
]
172159
}
173-
```
160+
</code>
161+
</pre>
162+
</details>
174163

175164

176165
## Conclusion

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ nav:
5454
- "<b>Library Reference</b>":
5555
- Overview: 'library-usage/index.md'
5656
- "<b>Writing Policies</b>":
57-
- command.write_policy: 'library-usage/writing/write_policy.md'
58-
- writing.validate: 'library-usage/writing/validate.md'
57+
- writing.minimize: 'library-usage/writing/minimize.md'
5958
- writing.sid_group: 'library-usage/writing/sid_group.md'
59+
- writing.validate: 'library-usage/writing/validate.md'
60+
- command.write_policy: 'library-usage/writing/write_policy.md'
6061
- "<b>Querying the Database</b>":
6162
- querying.all: 'library-usage/querying/all.md'
6263
- querying.actions: 'library-usage/querying/actions.md'

0 commit comments

Comments
 (0)