Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unknown SAML providers #933

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into weboftrust-handle-unknown
jtyers committed Aug 31, 2022
commit c0501b637f26f273f150cd50c09bc5b01256bb48
26 changes: 20 additions & 6 deletions commands/weboftrust.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,14 @@
import pyjq
import urllib.parse

from shared.common import parse_arguments, make_list, query_aws, get_regions, get_saml_providers
from shared.common import (
parse_arguments,
make_list,
query_aws,
get_regions,
get_account_by_id,
get_saml_providers,
)

__description__ = "Create Web Of Trust diagram for accounts"

@@ -16,6 +23,7 @@
# - How IAM admins are identified (need to leverage code from find_admins better)
# - More services and their trust policies.


def get_regional_vpc_peerings(region):
vpc_peerings = query_aws(
region.account, "ec2-describe-vpc-peering-connections", region
@@ -204,18 +212,24 @@ def get_iam_trusts(account, nodes, connections, connections_to_get):

found = False
for p in get_saml_providers():
if p['name'] in saml_provider_arn.lower():
if p["name"] in saml_provider_arn.lower():
found = True
if p.get('node') != None:
node = Account(**p['node'])
if p.get("node") != None:
node = Account(**p["node"])

if p.get('assumed'):
if p.get("assumed"):
assume_role_nodes.add(node)

break

if not found:
node = Account( json_blob={"id": "unknown", "name": "saml-unknown", "type": "saml-unknown"})
node = Account(
json_blob={
"id": "unknown",
"name": "saml-unknown",
"type": "saml-unknown",
}
)
assume_role_nodes.add(node)

except (StopIteration, IndexError):
You are viewing a condensed version of this merge commit. You can view the full changes here.