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

[VI-866] Audit Log - User Login #20582

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

bramleyjl
Copy link
Contributor

@bramleyjl bramleyjl commented Feb 3, 2025

Summary

  • Integrates UserAuditLogger logging into SiS & SSOe successful login auth flows
    • SiS: TokenResponseGenerator service calls UserAuditLogger after session creation.
    • SSOe: At end of saml_callback process UserAuditLogger is called after user is redirected.
    • Both flows generate a new UserActionEvent immediately prior to calling the audit logging SLO. Details: [SiS|SSOe] User logged in.

Related issue(s)

Testing done

  • [] New code is covered by unit tests
  • Success testing can be confirmed by looking up the UserActionEvent & UserAction in a rails console following authentication.
  • Failure testing can be performed by artificially modifying the UserAuditLogger invocation in the SiS or SSOe flow:
   UserAuditLogger.new(user_action_event:,
                          acting_user_verification: validated_credential.user_verification,
                          # subject_user_verification: validated_credential.user_verification,
                          subject_user_verification: nil,
                          # status: 'success',
                          status: nil,
                          acting_ip_address: cookies.request.remote_ip,
                          acting_user_agent: cookies.request.user_agent).perform

Testing - SiS

  • perform a SiS authentication, you should see the following logs
    - success: [SignInService] [SignIn::TokenResponseGenerator] user audit log created -- { :user_action_event_id => 26 }
    - error: [SignInService] [V0::SignInController] token error -- { :errors => "UserAuditLogger error - Status must be present" }

Testing - SSOe

  • perform a SSOe authentication, you should see the following logs
    - success: [SSOe] login - user audit log created -- { :user_action_event_id => 29 }
    - error: LOGIN_STATUS_FAILURE, tags: ["type:idme_verified", "version:v1", "client_id:vaweb", "operation:authorize", "error:007"], message: UserAuditLogger error - Status must be present

What areas of the site does it impact?

SSOe & SiS PKCE authentication

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected

Copy link

github-actions bot commented Feb 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/services/user_audit_logger_service.rb

Copy link

github-actions bot commented Feb 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: app/services/user_audit_logger_service.rb

Copy link

github-actions bot commented Feb 3, 2025

Error: A file (or its parent directories) does not have a CODEOWNERS entry. Please update the .github/CODEOWNERS file and add the entry for the Offending file: spec/services/user_audit_logger_service_spec.rb

@va-vfs-bot va-vfs-bot temporarily deployed to VI-866_user_login_action/main/main February 4, 2025 00:21 Inactive
@bramleyjl bramleyjl changed the title [VI-866] UserAuditLogger [VI-866] Audit Log - User Login Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants