fix: use allow-list for getConnectedApps to prevent data leaking#29243
Draft
jaydeep-pipaliya wants to merge 1 commit intocalcom:mainfrom
Draft
fix: use allow-list for getConnectedApps to prevent data leaking#29243jaydeep-pipaliya wants to merge 1 commit intocalcom:mainfrom
jaydeep-pipaliya wants to merge 1 commit intocalcom:mainfrom
Conversation
Replace the unsafe spread pattern that could leak new internal fields
with an explicit allow-list of safe properties. The deny-list approach
({ credentials: _, key: _2, ...app }) silently exposes any new fields
added to the app metadata in the future.
Fixes calcom#28923
Contributor
|
Welcome to Cal.diy, @jaydeep-pipaliya! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getConnectedAppswith an explicit allow-listTODOcomment in the codeWhat was wrong
The current code uses destructuring to exclude known sensitive fields, then spreads the rest:
This silently exposes any new fields added to the app metadata or database schema. If a field like
internalConfigorsecretTokenwere added, it would immediately leak to the frontend without anyone noticing.Fix
Replaced with an explicit allow-list that picks only the fields defined in the
Appinterface that are safe for frontend consumption (matching the existingAppFrontendPayloadtype). Sensitive fields (key,credentials,credential,__template) are now excluded by omission rather than explicit exclusion.Test plan
keyorcredentialsfields appear in the API responseFixes #28923