-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
🐛 Fixes for OpenID with the new config #4530
🐛 Fixes for OpenID with the new config #4530
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller
Unchanged No assets were unchanged |
WalkthroughThe changes update the OpenID configuration across several modules. In the desktop client’s OpenIdForm component, the key provided to the Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (4)
packages/desktop-client/src/components/manager/subscribe/OpenIdForm.tsx (1)
136-138
: Update field name in UI to match property name in APIThe property name in the API has changed from
issuer
todiscoveryURL
, but the UI still refers to this field as "issuer" (state, input field ID, labels, etc.). This disconnect between UI terminology and API property names could cause confusion for developers maintaining the code.Consider either:
- Renaming the UI elements to match the API:
- const [issuer, setIssuer] = useState(''); + const [discoveryURL, setDiscoveryURL] = useState(''); // And update all relevant references to use discoveryURL instead of issuer
- Or add a comment explaining the mapping between the UI field and the API property:
await onSetOpenId({ selectedProvider: providerName, + // Map the issuer field from UI to discoveryURL expected by the API discoveryURL: issuer ?? '', client_id: clientId ?? '',
packages/loot-core/src/types/models/openid.d.ts (1)
2-7
: Add documentation for OpenID propertiesThe addition of
discoveryURL
alongside the optionalissuer
field is a significant change to the API structure, but there's no JSDoc comment explaining the purpose of each field and the relationship between them.Consider adding documentation to clarify the usage of these fields:
export type OpenIdConfig = { + /** + * The OpenID provider selected by the user + */ selectedProvider: string; + /** + * Optional issuer identifier (legacy field, prefer using discoveryURL) + * @deprecated Use discoveryURL instead + */ issuer?: string; + /** + * Client ID generated by the OpenID provider + */ client_id: string; + /** + * Client secret associated with the client ID + */ client_secret: string; + /** + * Hostname of the server + */ server_hostname: string; + /** + * The URL used for OpenID Connect discovery + */ discoveryURL: string; };packages/sync-server/src/accounts/openid.js (2)
27-32
: Use property assignment instead of delete operatorUsing the
delete
operator can impact performance as noted by the static analysis. Additionally, since this is for backward compatibility, it would be clearer to document the purpose of this logic.//FOR BACKWARD COMPATIBLITY: //If we don't put discoverURL into the issuer, it will break already enabled openid instances if (configParameter.discoveryURL) { configParameter.issuer = configParameter.discoveryURL; - delete configParameter.discoveryURL; + configParameter.discoveryURL = undefined; // Use undefined assignment instead of delete }🧰 Tools
🪛 Biome (1.9.4)
[error] 31-31: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
12-26
: Add validation for discoveryURL formatNow that
discoveryURL
is a primary field for OpenID configuration, it should be validated to ensure it's a valid URL format to prevent downstream errors during discovery.Add validation for the discoveryURL format:
export async function bootstrapOpenId(configParameter) { if (!('issuer' in configParameter) && !('discoveryURL' in configParameter)) { return { error: 'missing-issuer-or-discoveryURL' }; } + if ('discoveryURL' in configParameter) { + try { + new URL(configParameter.discoveryURL); + } catch (e) { + return { error: 'invalid-discoveryURL-format' }; + } + } if (!('client_id' in configParameter)) { return { error: 'missing-client-id' }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
upcoming-release-notes/4530.md
is excluded by!**/*.md
📒 Files selected for processing (4)
packages/desktop-client/src/components/manager/subscribe/OpenIdForm.tsx
(1 hunks)packages/loot-core/src/server/main.ts
(0 hunks)packages/loot-core/src/types/models/openid.d.ts
(1 hunks)packages/sync-server/src/accounts/openid.js
(3 hunks)
💤 Files with no reviewable changes (1)
- packages/loot-core/src/server/main.ts
🧰 Additional context used
🪛 Biome (1.9.4)
packages/sync-server/src/accounts/openid.js
[error] 31-31: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build (macos-latest)
- GitHub Check: Wait for Netlify build to finish
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Analyze
- GitHub Check: Build Docker image (alpine)
- GitHub Check: Build Docker image (ubuntu)
I had to introduce a new env var to make this work, its not working properly. this fixes the new variable usage