Skip to content

Update webapi/sessions route#19892

Merged
avatus merged 10 commits intomasterfrom
michaelmyers/fix_web_sessions
Jan 5, 2023
Merged

Update webapi/sessions route#19892
avatus merged 10 commits intomasterfrom
michaelmyers/fix_web_sessions

Conversation

@avatus
Copy link
Copy Markdown
Contributor

@avatus avatus commented Jan 4, 2023

Update the webapi routes to include /web to better clarify they are for web sessions only
webapps buddy: gravitational/webapps#1486

Comment thread lib/web/apiserver.go Outdated

// Web sessions
h.POST("/webapi/sessions/web", httplib.WithCSRFProtection(h.WithLimiterHandlerFunc(h.createWebSession)))
h.DELETE("/webapi/sessions/web", h.WithAuth(h.deleteSession))
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.

nit: let's call these deleteWebSession and renewWebSession for clarity/consistency.

Comment thread lib/web/apiserver.go
h.POST("/webapi/sessions/web", httplib.WithCSRFProtection(h.WithLimiterHandlerFunc(h.createWebSession)))
// App sessions
h.POST("/webapi/sessions/app", h.WithAuth(h.createAppSession))
h.DELETE("/webapi/sessions", h.WithAuth(h.deleteSession))
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.

I wonder if we should keep the old routes around for a while to avoid breakages. Are these only ever used by the Web UI?

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.

I only see them being used by the Web UI. Although maybe there's some compatibility guarantee we make towards 3rd party clients?

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.

I'm ok with adding a "DELETE IN 12.0" as long as we don't finally get to deleting in 17.1 😂

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.

Added a deprecated session for the older routes. Didn't know when to put a "DELETE" but left a comment to this PR to give context.

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.

I think the compatibility guarantee is more in terms of binary versions than APIs, but this is more to play it safe.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's put DELETE IN 13 and let's go back and do this as soon as we cut the v12 branch next week so we don't forget again.

Comment thread lib/web/apiserver.go Outdated
h.DELETE("/webapi/sessions", h.WithAuth(h.deleteSession))
h.POST("/webapi/sessions/renew", h.WithAuth(h.renewSession))

// Deprecated web sessions routes
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.

Suggestion:

Suggested change
// Deprecated web sessions routes
// DELETE IN 13, deprecated/unused web sessions routes (avatus)

We do grep for those (at least I do), so it's a useful mark. Username added for context, although it also makes it easy to find your own cleanups ;)

Comment thread lib/web/apiserver.go
h.POST("/webapi/sessions/web", httplib.WithCSRFProtection(h.WithLimiterHandlerFunc(h.createWebSession)))
// App sessions
h.POST("/webapi/sessions/app", h.WithAuth(h.createAppSession))
h.DELETE("/webapi/sessions", h.WithAuth(h.deleteSession))
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.

I think the compatibility guarantee is more in terms of binary versions than APIs, but this is more to play it safe.

@avatus avatus merged commit 7d78090 into master Jan 5, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 5, 2023

@avatus See the table below for backport results.

Branch Result
branch/v10 Failed
branch/v11 Failed

@avatus
Copy link
Copy Markdown
Contributor Author

avatus commented Jan 5, 2023

This PR was backported in the following PRs here
v10
v11

Thank you @sfreiberg !!

sfreiberg pushed a commit that referenced this pull request Jan 6, 2023
sfreiberg added a commit that referenced this pull request Jan 6, 2023
* Remove deprecated router and add rate limiting

* Update test

* Fix more tests

* Fix rate limiting bug

* Update webapi/sessions route (#19892)

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Co-authored-by: Michael <michael.myers@goteleport.com>
sfreiberg pushed a commit that referenced this pull request Jan 6, 2023
sfreiberg added a commit that referenced this pull request Jan 6, 2023
* Add rate limiting

* Fix rate limiting bug

* Update webapi/sessions route (#19892)

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Co-authored-by: Michael <michael.myers@goteleport.com>
@avatus avatus deleted the michaelmyers/fix_web_sessions branch August 21, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants