Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add session expiry control flags#5976

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deansheather merged 7 commits intomainfromdean/session-expiry-flags
Feb 3, 2023

Conversation

deansheather
Copy link
Member

@deansheatherdeansheather commentedFeb 2, 2023
edited
Loading

Adds --session-duration which lets admins customize the default session expiration for browser sessions.

Adds --disable-session-expiry-refresh which allows admins to prevent session expiry from being automatically bumped upon the API key being used.

Closes#5988

cc@ElliotG

Adds --session-duration which lets admins customize the default sessionexpiration for browser sessions.Adds --disable-session-expiry-refresh which allows admins to preventsession expiry from being automatically bumped upon the API key beingused.
@mtojek
Copy link
Member

@deansheather is there any issue you can link with this pull request?

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

You're going to hate my response here, but can we check if this is how GitLab and Vault handle these too?

Adding more user knobs also makes it easy for users to get themselves in an insecure situation where it'd be easier for an attacker to be malicious. If we give the knobs, it's still our responsibility.

In the case these are standard, I'm good with it... just sketched out adding even more options.

@deansheather
Copy link
MemberAuthor

It's a finding from the penetration test, I don't believe there's an issue for it but I could make one if you want.

@deansheather
Copy link
MemberAuthor

GitLab does not seem to have a knob for max session duration, but Vault does. I'm also aware of other software that does it like Mattermost.

The second flag can't reduce security and can only increase it.

@deansheather
Copy link
MemberAuthor

@kylecarbs@mtojek ^

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

Left two questions but in general LGTM. I'm wondering if we should hide security-related flags under a commonsecurity umbrella.

dc.SessionDuration.Value = time.Second

userClient := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
time.Sleep(dc.SessionDuration.Value + time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Do you think that you can somehow mock the timer or refactor that part? We have enough of time-dependent tests.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Do you have any suggestions? Since we don't allow db access from tests I can't force the API key to have a specific "last used at" time and have to rely on sleep in this test.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's fine to just test it on the lower level where we can modify the timestamp? or create an "already expired" token

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I refactored the test to use the database to verify and force API key states.

@kylecarbs
Copy link
Member

I see this from the pen-test, but I wonder if this will make us focus on security less for session tokens or consider reducing the duration as a reliable method to reduce the attack surface.

From my perspective, it's security through obscurity. It makes the user-experience worse (especially if admins specify a really low duration).

Before merge I'd like@ammario's thoughts, because maybe I'm wrong.@ElliotG would you consider these options standard?

@deansheather
Copy link
MemberAuthor

Regardless of whether we think reducing the session expiry limit is security by obscurity or security theater, this will most likely be a customer requirement from some of our highly secure customers.

@mtojek
Copy link
Member

From my perspective, it's security through obscurity. It makes the user-experience worse (especially if admins specify a really low duration).

I would look at it from the other perspective. Users are as secure as their admins set the security level. Having a knob to control and fine-tune the timeout might be an option to pass any internal security certification processes, as some may have stricter rules than others.

What we definitely shouldn't do, and we don't intend to, is give the option to the end-user to create an infinite token.

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

Code changes LGTM, but I leave the product decision to Kyle.

dc.SessionDuration.Value = time.Second

userClient := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
time.Sleep(dc.SessionDuration.Value + time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's fine to just test it on the lower level where we can modify the timestamp? or create an "already expired" token

@ammario
Copy link
Member

@bpmct says this is a common request, e.g. for a Yubikey workflow where the admin wants to physically verify all access every X days. Thus, I begrudgingly accept this PR. There is a greater issue ofcoder server --help bloat making our software look more complex than it is, but that shouldn't hold up this PR.

Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments. Feel free to merge if the CI is happy.

@deansheatherdeansheatherenabled auto-merge (squash)February 3, 2023 16:59
@deansheatherdeansheather merged commitcf9abe3 intomainFeb 3, 2023
@deansheatherdeansheather deleted the dean/session-expiry-flags branchFebruary 3, 2023 17:38
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 3, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mtojekmtojekmtojek approved these changes

@kylecarbskylecarbsAwaiting requested review from kylecarbs

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

security: allow configurable session expiry
4 participants
@deansheather@mtojek@kylecarbs@ammario

[8]ページ先頭

©2009-2025 Movatter.jp