Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion lib/reporting/protocols_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,18 @@ def aal3_issuers_query
end

def facial_match_issuers_query
format(<<~QUERY)
params = {
events: quote([SAML_AUTH_EVENT, OIDC_AUTH_EVENT]),
}
# OIDC_AUTH_EVENT and SAML_AUTH_EVENTs are fired before the initiating
# session is stored.
# We are omitting those events to prevent false positives
format(<<~QUERY, params)
fields
coalesce(properties.event_properties.service_provider,
properties.event_properties.client_id,
properties.service_provider) as issuer
| filter name NOT IN %{events}
| filter properties.sp_request.facial_match
| display issuer
| sort issuer
Expand Down
32 changes: 32 additions & 0 deletions spec/lib/reporting/protocols_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,38 @@
it 'generates the tabular csv data' do
expect(report.as_tables).to eq expected_tables
end

describe 'queries' do
let(:client) { report.cloudwatch_client }
let(:time_query) do
{
from: report.time_range.begin,
to: report.time_range.end,
}
end
before do
allow(client).to receive(:fetch).and_call_original
end
Comment on lines +125 to +127
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this do anything?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, it sets up the spy!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, I misread the setup below as expect(client).to receive, thinking that made this allow redundant.


it 'calls the cloudwatch client with the expected queries' do
report.as_tables

%i[
aal3_issuers_query
saml_signature_query
facial_match_issuers_query
id_token_hint_query
loa_issuers_query
protocol_query
saml_signature_query
].each do |query|
expect(client).to have_received(:fetch).with(
query: report.public_send(query),
**time_query,
)
end
end
end
end

describe '#as_emailable_reports' do
Expand Down