-
Notifications
You must be signed in to change notification settings - Fork 166
Create a report of integrations using deprecated LOA ACR values #10562
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ def as_tables | |
| overview_table, | ||
| protocols_table, | ||
| saml_signature_issues_table, | ||
| loa_acr_requests_table, | ||
| ] | ||
| end | ||
|
|
||
|
|
@@ -66,6 +67,10 @@ def as_emailable_reports | |
| title: 'SAML Signature Issues', | ||
| table: saml_signature_issues_table, | ||
| ), | ||
| Reporting::EmailableReport.new( | ||
| title: 'LOA ACR Requests', | ||
| table: loa_acr_requests_table, | ||
| ), | ||
| ] | ||
| end | ||
|
|
||
|
|
@@ -210,6 +215,48 @@ def saml_signature_issues_table | |
| ] | ||
| end | ||
|
|
||
| def loa_acr_requests_table | ||
| [ | ||
| ['Count of integrations using LOA', 'List of issuers with the issue'], | ||
| [ | ||
| loa_issuers_data.length, | ||
| loa_issuers_data.join(', '), | ||
| ], | ||
| ] | ||
| end | ||
|
|
||
| def loa_issuers_data | ||
| @loa_issuers_data ||= begin | ||
| cloudwatch_client.fetch( | ||
| query: loa_issuers_query, | ||
| from: time_range.begin, | ||
| to: time_range.end, | ||
| ). | ||
| map { |slice| slice['issuer'] }. | ||
| uniq | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [question] since you're running dedup in the query, is this necessary?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is needed because the same issuer may be present in different time slices; the |
||
| end | ||
| end | ||
|
|
||
| def loa_issuers_query | ||
| params = { | ||
| event: quote([SAML_AUTH_EVENT, OIDC_AUTH_EVENT]), | ||
| } | ||
|
|
||
| format(<<~QUERY, params) | ||
| fields | ||
| coalesce(properties.event_properties.service_provider, properties.event_properties.client_id) as issuer, | ||
| properties.event_properties.acr_values as acr | ||
| | parse @message '"authn_context":[*]' as authn | ||
| | filter | ||
| name IN %{event} | ||
| AND (authn like /ns\\/assurance\\/loa/ OR acr like /ns\\/assurance\\/loa/) | ||
| AND properties.event_properties.success= 1 | ||
| | display issuer | ||
| | sort issuer | ||
| | dedup issuer | ||
| QUERY | ||
| end | ||
|
|
||
| def to_percent(numerator, denominator) | ||
| (100.0 * numerator / denominator).round(2) | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to fix this in this PR, but i have been having a hard time with the word
slicein this context (and other places it's used in maps) especially since we have a differentslicevar on the instance. we should probably go back and change the references to something that make more sense in the local context, but it's not blocking.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I inherited the naming from
mfa_report.rb. The fetched results from CloudWatch are row slices, ie they could be a full row from the original query (if the time slice and the period coincided) or they could be a row split into time slices. We could useroworrow_slice. I don't likerowas it hides the fact that it could have been split up. I would preferrow_slice, or leaving it asslice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i understand why
slicewas used. i still think reusing the variableslicecan be confusing at a glance.