Access token expiration#7893
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the security posture of the application by introducing token expiration functionality across all access token types. It provides users with granular control over token lifetimes, reducing the risk associated with long-lived credentials. The changes span database schema updates, GraphQL API enhancements, and corresponding user interface modifications for a seamless experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces token expiration, a valuable security enhancement. My review has identified a critical caching issue that could lead to expired tokens being treated as valid, a regression in one of the GraphQL resolvers that breaks existing behavior, and a minor bug in a UI helper function. I've also noted an inconsistency in the GraphQL schema where a new field is added but not implemented. Please address these points to ensure the feature is robust and correct.
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tag: |
| await pool.end(); | ||
| expect(result.rowCount).toBe(tokenIds.length); | ||
| for (const id of tokenIds) { | ||
| await purgeOrganizationAccessTokenById(id); |
There was a problem hiding this comment.
must purge cache after setting expiration else the old expiratin value will remain
| """ | ||
| Set this in order to automatically expire this token after a period of time. | ||
| """ | ||
| expirationPeriod: TokenExpirationPeriod = NEVER |
There was a problem hiding this comment.
I initially had this as non-nullable because it has a default, but our generated types still think it's nullable and i got a linting error about adding non-nullable arguments. I didn't want to tackle this issue so I made this nullable for now.
| ? 'text-neutral-12 bg-neutral-5 hover:bg-neutral-5 dark:bg-neutral-3 dark:hover:bg-neutral-3' | ||
| : 'text-neutral-11 hover:bg-transparent hover:underline', | ||
| 'justify-start', | ||
| 'h-auto justify-start text-left', |
There was a problem hiding this comment.
Fixes some spacing issues when the page width is small.
|
|
||
| return ( | ||
| <Sheet.SheetContent className="flex max-h-screen min-w-[700px] flex-col overflow-y-scroll"> | ||
| <Sheet.SheetContent className="max-w-screen flex max-h-screen w-[700px] min-w-[60%] flex-col overflow-y-scroll"> |
There was a problem hiding this comment.
prevents overflowing on small page width
| <tr key={permission.permission.id}> | ||
| <td>{permission.permission.title}</td> | ||
| <td className="ml-2 text-right"> | ||
| <td className="pl-2">{permission.permission.title}</td> |
There was a problem hiding this comment.
adds some indent to make the permission look correctly nested under the permission group
| </Tooltip.TooltipProvider> | ||
| ) : ( | ||
| <Badge variant="success">Allowed</Badge> | ||
| <Badge className="w-[69px] justify-center" variant="success"> |
There was a problem hiding this comment.
makes the badges the same width and centers the text
| variants: { | ||
| variant: { | ||
| horizontal: 'flex-row items-center justify-between', | ||
| horizontal: 'flex-row items-center justify-between flex-wrap', |
There was a problem hiding this comment.
allow the stepper items (the 1, 2, 3, 4 steps) to wrap. This prevents them from overflowing on small width pages.
|
Only suggestion here would be to highlight expired tokens. Perhaps the "expired" text should be |
Background
Tokens require manual deletion at present. For security purposes, often it's preferred to automatically expire tokens.
Relates to #7242
Description
This adds token expiration to all token types and slightly improves the spacing on the tokens UI for readability/UX.
Checklist