Add policy minification?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- aws, javascript, python
Research direction
Start by reading the existing expand-policy functionality and the linked policyuniverse expander_minimizer example. Clarify whether the goal is a minimize-policy command, safer permission-aware minimization, policy splitting for AWS character limits, or all three; completion criteria are not defined in the issue.
Written by the indexing model from the issue text.
Description
As brought up https://github.com/Netflix-Skunkworks/policyuniverse/issues/38#issuecomment-868751613 ... it would be pretty handy if cloudsplaining could help with that by considering adding a minimize-policy to accompany the existing expand-policy (which I am happy to learn exists).
A few thoughts:
-
Like policyuniverse, I'd expect it to take the input policy into account in as much that it would determine the given actions/permissions and read/list/write/tag scope and stick with that? Meaning it wouldn't purely be doing pattern recognition wildcard replacement based on the given strings but take the related permissions potentially not included in the input policy into account; so there wouldn't be unintended permissions granted by mistake. That may be a given but I thought it should be said anyways.
-
Maybe kind of a feature request/enhancement to the existing
expand-policyfunctionality as well... it would be cool if the resulting policies could be auto split to work within the constraints of AWS's various policy character limits.
What originally sparked my curiosity in this area was to build a "Safer" ReadOnlyAccess policy. I believe @kmcquade you've thought about similar things at length. I'm curious about the best approaches. I understand this is off-topic to the OP/issue.
# Get the list of actions we want to remove into an array
ActionsToRemove=($(cloudsplaining scan-policy-file --input-file $Policy_Filename | grep Actions | sed 's/.*Actions.*: //Ig' | tr ' ' '\n' | tr -d ',' | sort | uniq))
# Remove each action determined to be a risk
for Action in "${ActionsToRemove[@]}"; do
sed -i "/\"$Action\".*/Id" $Policy_Filename
done
And some ugly attempts at minizing that using policyuniverse:
# Concatenate Service/Actions
tee "$PolicyUniverseMinification" > /dev/null <<EOF
from policyuniverse.expander_minimizer import minimize_policy
policy = $(cat $Policy_Filename)
minimized_policy = minimize_policy(policy=policy, minchars=None)
print(minimized_policy)
EOF
# Remove missing actions; Blackhole actions: meaning Policy Universe does not have information on them...
until python $PolicyUniverseMinification 2> stderr.txt; do
MissingAction=$(cat stderr.txt | grep "Exception: Desired action not found in master permission list." | cut -d. -f2 | sed 's/^[[:space:]]*//g')
echo "Removing Blackhole action: '$MissingAction'..."
sed -i "/\"$MissingAction\".*/Id" $PolicyUniverseMinification
done
vs. simply getting the output of cloudsplaining and adding it to a Deny statement I started questioning my approach.
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from salesforce/cloudsplaining
-
Data Exfiltration: flag snapshot, export and batch secret-read actionsPossibly taken @devteamaegis claimed this 26 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
salesforce/cloudsplaining#654 · 1 comment ·
-
include-actions in exclusions file has no effect on Data Exfiltration finding categoryPossibly taken @nitrocode claimed this 104 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 64/100
salesforce/cloudsplaining#624 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
salesforce/cloudsplaining#585 ·
-
Proposal: Implement Automated Logic Ingestion for IAM Privilege Escalation via Pathfinding.cloudOpen
Difficulty 4/5 3-5 days Newbie friendliness 45/100
salesforce/cloudsplaining#537 · 1 comment · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
salesforce/cloudsplaining#386 ·
All issues in salesforce/cloudsplaining
Similar issues
-
verified whatsapp
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 6 days
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
salesforce/sa11y#1022 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
githubnext/gh-aw-workshop#6379 ·
Maintainers usually reply within 1 day
-
FEATURE REQUEST
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
linuxmint/cinnamon-spices-applets#9386 ·
Maintainers usually reply within 1 day