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

2954 - Remove SESSION_TIMEOUT #3020

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Conversation

jtimpe
Copy link

@jtimpe jtimpe commented Jun 2, 2024

Summary of Changes

Pull request closes #2954

  • removes the old/irrelevant SESSION_TIMEOUT which hasn't controlled the session timeout since 2822 fix webinspect medium priority - persistent session #2911
  • extend SESSION_COOKIE_AGE to match the expiration of the jwt provided by login.gov - the expiration in the dev environment was only 15 minutes
  • Update the documentation to reflect the change in session management

How to Test

cd tdrs-backend && docker-compose up
cd tdrs-frontend && docker-compose up --build
  1. Open http://localhost:3000/ and sign in.

That's basically it, nothing changes about our signin workflow. The values set by SESSION_TIMEOUT were being overriden by SESSION_EXPIRE_AT_BROWSER_CLOSE's behavior of removing the Expires= from the cookie. You can run the tests from #2911 that verify the session cookie behavior.

Deliverables

More details on how deliverables herein are assessed included here.

Deliverable 1: Accepted Features

Checklist of ACs:

  • Identify session timeout/expiration for the jwt provided by login.gov
  • Parameterize environment variable value for SESSION_COOKIE_AGE (match or lower than login.gov jwt expiration)
  • Remove unused SESSION_TIMEOUT variable in common.py and usages throughout the authentication api
  • lfrohlich and/or adpennington confirmed that ACs are met.

Deliverable 2: Tested Code

  • Are all areas of code introduced in this PR meaningfully tested?
    • If this PR introduces backend code changes, are they meaningfully tested?
    • If this PR introduces frontend code changes, are they meaningfully tested?
  • Are code coverage minimums met?
    • Frontend coverage: [insert coverage %] (see CodeCov Report comment in PR)
    • Backend coverage: [insert coverage %] (see CodeCov Report comment in PR)

Deliverable 3: Properly Styled Code

  • Are backend code style checks passing on CircleCI?
  • Are frontend code style checks passing on CircleCI?
  • Are code maintainability principles being followed?

Deliverable 4: Accessible

  • Does this PR complete the epic?
  • Are links included to any other gov-approved PRs associated with epic?
  • Does PR include documentation for Raft's a11y review?
  • Did automated and manual testing with iamjolly and ttran-hub using Accessibility Insights reveal any errors introduced in this PR?

Deliverable 5: Deployed

  • Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

Deliverable 6: Documented

  • Does this PR provide background for why coding decisions were made?
  • If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces dependencies, are their licenses documented?
  • Can reviewer explain and take ownership of these elements presented in this code review?

Deliverable 7: Secure

  • Does the OWASP Scan pass on CircleCI?
  • Do manual code review and manual testing detect any new security issues?
  • If new issues detected, is investigation and/or remediation plan documented?

Deliverable 8: User Research

Research product(s) clearly articulate(s):

  • the purpose of the research
  • methods used to conduct the research
  • who participated in the research
  • what was tested and how
  • impact of research on TDP
  • (if applicable) final design mockups produced for TDP development

@jtimpe jtimpe self-assigned this Jun 2, 2024
Copy link

codecov bot commented Jun 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.14%. Comparing base (d8fcc54) to head (8350c88).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3020      +/-   ##
===========================================
- Coverage    93.15%   93.14%   -0.01%     
===========================================
  Files          276      276              
  Lines         7303     7295       -8     
  Branches       642      642              
===========================================
- Hits          6803     6795       -8     
  Misses         399      399              
  Partials       101      101              
Flag Coverage Δ
dev-backend 93.23% <100.00%> (-0.01%) ⬇️
dev-frontend 92.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
tdrs-backend/tdpservice/settings/common.py 99.30% <100.00%> (-0.01%) ⬇️
tdrs-backend/tdpservice/users/api/middleware.py 100.00% <100.00%> (ø)
tdrs-backend/tdpservice/users/api/utils.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 410ce8f...8350c88. Read the comment docs.

@jtimpe jtimpe added the raft review This issue is ready for raft review label Jun 3, 2024
@jtimpe jtimpe added a11y-review PR is ready for accessibility review and removed raft review This issue is ready for raft review a11y-review PR is ready for accessibility review labels Jun 3, 2024
@jtimpe jtimpe added the raft review This issue is ready for raft review label Jun 3, 2024

This is managed in `tdrs-backend/tdpservice/settings/common.py` with the following setting:
```python
SESSION_COOKIE_AGE = 15 * 60 # 30 minutes
Copy link

Choose a reason for hiding this comment

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

Small nit: should be # 15 minutes

Copy link

@elipe17 elipe17 left a comment

Choose a reason for hiding this comment

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

I would be curious to know if Alex knows that the timeout is going to be even shorter now? I know the 30 minute timeout was not something she liked. Otherwise, this all looks good!

SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_COOKIE_AGE = 30 * 60 # 30 minutes
SESSION_COOKIE_AGE = 15 * 60 # 15 minutes
Copy link
Author

Choose a reason for hiding this comment

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

find out what prod exp is

Choose a reason for hiding this comment

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

Nit: If @ADPennington want to have extended session cookie, then you should be able to set the session at login to a different value for admin users.

@jtimpe jtimpe requested a review from raftmsohani June 4, 2024 15:32
Copy link

@raftmsohani raftmsohani left a comment

Choose a reason for hiding this comment

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

LGTM!

@jtimpe jtimpe added QASP Review and removed raft review This issue is ready for raft review labels Jun 11, 2024
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.

Extend SESSION_COOKIE_AGE
3 participants