-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
[feature] Allow using of the complex attribute names for encryptedNative
and protectedNative
#3032
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR introduces changes to support complex attribute names for the encrypted and protected native configuration properties by updating how attributes are accessed, set, and deleted. Key changes include replacing direct property access with helper functions (getObjectAttribute, setObjectAttribute, deleteObjectAttribute) and updating tests to verify that complex attributes (such as "complex.password") are handled correctly.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/adapter/src/lib/adapter/utils.ts | Updated helper functions to support complex attribute names by adding wrapper functions for get, set, and delete operations. |
packages/adapter/src/lib/adapter/adapter.ts | Revised usage of attribute access in encryption/decryption flows and protected native deletion to use the new helper functions. |
packages/controller/test/lib/testObjectsFunctions.ts packages/controller/test/lib/testAdapterHelpers.ts |
Updated tests to include complex attribute scenarios for encryption and protection. |
const attrParts = attr.split('.'); | ||
for (let j = 0; j < attrParts.length; j++) { | ||
if (j === attrParts.length - 1) { | ||
obj[attrParts[j]] = value; |
Check warning
Code scanning / CodeQL
Prototype-polluting function Medium
here
obj
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 23 days ago
To fix the problem, we need to ensure that the setObjectAttribute
function does not allow setting properties like __proto__
or constructor
that can lead to prototype pollution. We can achieve this by adding checks to skip these properties during the assignment process.
- Modify the
setObjectAttribute
function to include checks that prevent setting__proto__
andconstructor
properties. - Ensure that these checks are applied both for direct assignments and for nested assignments within the loop.
-
Copy modified lines R189-R191
@@ -188,2 +188,5 @@ | ||
for (let j = 0; j < attrParts.length; j++) { | ||
if (attrParts[j] === '__proto__' || attrParts[j] === 'constructor') { | ||
return; | ||
} | ||
if (j === attrParts.length - 1) { |
This PR looks like a solution to #846 (or at least as related to that issue). @GermanBluefox please confirm and check that this issue is covered by the PR changes. Especially encryption of array related elements liek table fileds should be implemented too when changes are made to this area. |
This solves only second part of requirement |
Some adapters, like "email" have complex attribute paths, like
transportOptions.auth.pass
it is not possible to useprotectedNative
andencryptedNative
for that.For Features:
Tests
Documentation
No documentation required