Conversation
I´m added a Mask using 0x5A for have a mask in the Critic Variables. e.g:
I´m create a Variable using let named "secret_key" with attribute "secret_password". This Variable is in the RAM, and a Malware-Plugin installed have access this Variable and modify. And, e.g: The Variable loggedInUser have a Critic Properties ("email", "github", "website") and this Malware-Plugin access and view this Variable.
|
| if (typeof secured[prop] === "string") { | ||
| secured[prop] = maskCredential(secured[prop]); | ||
| } | ||
| }); | ||
|
|
||
| return secured; |
There was a problem hiding this comment.
Undefined Variable Breaks Login
secureUserObject reads and returns secured, but only user is defined. Every successful /login response with a user object therefore throws a ReferenceError before the user can be cached or returned. Without an existing cache, authenticated-user initialization fails; with a cache, callers receive stale user data.
| if (typeof secured[prop] === "string") { | ||
| secured[prop] = maskCredential(secured[prop]); | ||
| } |
There was a problem hiding this comment.
This masking changes string fields such as name, email, github, and avatar_url into number arrays, but no caller converts them back before use. Once the preceding secured error is corrected, existing consumers will receive arrays; for example, the sidebar eventually calls .split(" ") on user.name, causing profile rendering to fail, while avatar and profile URLs become invalid.
| const MASK_KEY = 0x5A; | ||
|
|
||
| // The function to he apply a Mask | ||
| export function maskCredential(secretString) { | ||
| if (!secretString) return []; | ||
|
|
||
| // Transforms the String in a Numbers Array (bytes) maskareds | ||
| return Array.from(secretString).map(char => char.charCodeAt(0) ^ MASK_KEY); |
There was a problem hiding this comment.
The fixed XOR constant does not protect these values from the malicious-plugin threat described by this change. Plugins execute as scripts in the application's JavaScript context, so they can reverse the transformation themselves, especially because the inverse operation is exported alongside it. This adds a new credential representation and integration burden without providing confidentiality or integrity; protecting this data requires an isolation or access-control boundary rather than an in-process reversible mask.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Hey @RohitKushvaha01, the masking issue pointed out by the Greptile bot has already been fixed in my latest commit (hash 2263642). I implemented a getter helper function called |
XOR is not a encryption, it makes no difference in security also the things you are trying to make safe are not that sensitive, only sensitive thing worth securing is the access token which is already properly secured |
I´m added a Mask using 0x5A for have a mask in the Critic Variables. e.g: I´m create a Variable using let named "secret_key" with attribute "secret_password". This Variable is in the RAM, and a Malware-Plugin installed have access this Variable and modify. And, e.g: The Variable loggedInUser have a Critic Properties ("email", "github", "website") and this Malware-Plugin access and view this Variable.