feat: add session duration management to user preferences#494
feat: add session duration management to user preferences#494
Conversation
- Introduced SessionDurationContent component for configuring session duration. - Updated B3DynamicModal to include session duration option. - Enhanced SettingsContent to navigate to session duration settings. - Implemented session duration utility functions for managing preferences. - Refactored authentication logic to utilize dynamic session duration from user preferences.
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 introduces a new feature allowing users to customize their session duration, enhancing both convenience and security. By providing options to control how long they remain signed in, users gain more flexibility over their account access. The changes involve new UI components, updated modal logic, and modifications to the core authentication process to respect these new user preferences. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @vasinl124's task in 1m 27s —— View job Code Review
Overall the implementation is clean and well-structured. A few issues worth addressing: Bug: Missing
|
There was a problem hiding this comment.
Code Review
This pull request introduces session duration management for user preferences, a valuable feature implemented with new UI components, utility functions, and authentication flow updates. However, a critical security vulnerability was identified: the authentication cookie is set without the Secure flag, which could expose it to interception over unencrypted connections. Additionally, the review suggests improvements for code safety, maintainability, and clarity, including addressing an unsafe type cast, handling potential errors when saving preferences, removing duplicated constants, and cleaning up an unused prop.
packages/sdk/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx
Outdated
Show resolved
Hide resolved
packages/sdk/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx
Outdated
Show resolved
Hide resolved
packages/sdk/src/global-account/react/components/ManageAccount/SessionDurationContent.tsx
Outdated
Show resolved
Hide resolved
packages/sdk/src/global-account/react/components/ManageAccount/SettingsContent.tsx
Outdated
Show resolved
Hide resolved
…S and remove hardcoded labels - Modified B3DynamicModal to pass partnerId to SessionDurationContent. - Updated SessionDurationContent to utilize SESSION_DURATION_LABELS for consistency. - Removed hardcoded duration labels from SettingsContent, now using SESSION_DURATION_LABELS. - Added SESSION_DURATION_LABELS to session-duration utility for better maintainability.
|
Claude finished @vasinl124's task in 1m 44s —— View job Code Review
Overall the implementation is solid — the code is well-structured, the Bug: Missing
|
…Content - Added type="button" to buttons in SessionDurationContent and SettingsContent for better accessibility and to prevent unintended form submissions. - Updated handleBack prop in ModalHeader for consistency in SessionDurationContent.
…anagement - Updated cookie settings in authenticate function to include secure and sameSite attributes for improved security. - Refined error handling in SessionDurationContent to log errors when saving session duration preferences fails, ensuring better debugging and user feedback.
|
Claude finished @vasinl124's task in 2m 8s —— View job Code Review
The previous review iterations caught several bugs (missing Storage adapter doesn't apply cookie security attributes
setItem: (key: string, value: string) => {
Cookies.set(key, value); // ← no secure/sameSite
},So on every
|
…gement - Enhanced readability by formatting object properties in the authenticate function and SessionDurationContent component. - Ensured consistent code style for better maintainability.
|
Claude finished @vasinl124's task in 2m 10s —— View job Code Review
The previous review iterations caught several issues (missing Security: Storage adapter sets cookie without security flags
setItem: (key: string, value: string) => {
Cookies.set(key, value); // ← no secure/sameSite
},On every // Fix
setItem: (key: string, value: string) => {
Cookies.set(key, value, { secure: true, sameSite: "Lax" });
},Privacy: localStorage preference persists across user sessions on shared devices
Consider clearing the localStorage key on logout, or keying it by Behavioral change note (for QA)
|
- Updated the way user preferences are accessed in SessionDurationContent to ensure proper type handling and prevent potential runtime errors. - Enhanced code clarity by refining the object destructuring for partnerId preferences.
|
Claude finished @vasinl124's task in 1m 46s —— View job Code Review
Previous review iterations addressed most issues (missing Bug: Storage adapter cookie written without security attributes
setItem: (key: string, value: string) => {
Cookies.set(key, value); // ← no secure/sameSite
},The // Fix
setItem: (key: string, value: string) => {
Cookies.set(key, value, { secure: true, sameSite: "Lax" });
},UX: No visual feedback while saving
At minimum, a visual cue (e.g. Note:
|
[LINEAR_ISSUE_ID_HERE]
Description
Write a description.
Test Plan
Screenshots
For BE, include snippets, response payloads and/or curl commands to test endpoints
[FE] Before
[FE] After
[BE] Snippets/Response/Curl
automerge=false