launchiamenterprise / keyrunner

KeyRunner: A secure, codeless VS Code extension for API testing & Designing. Features include data encryption at rest, sensitive data masking, and the innovative Playground for chaining API requests without coding
https://keyrunner.app
MIT License
15 stars 1 forks source link

Thousands (12K+) of empty key/value environment variables generated automatically after running a request containing some pre-request scripting #70

Closed frank-duq closed 1 month ago

frank-duq commented 1 month ago

Describe the bug After running a request containing some pre-script scripting, which does try to store perhaps ~20 env vars to be used/injected into the same request body (and also to be used by other requests of the same collection), Keyrunning has became extremely SLOW and unstable.

After investigating what could be wrong (even trying a fresh re-install from current latest version, e.g. 1.0.67), I realized, after accessing my keyrunner environment, that thousands of empty key/value entries have been generated for me!! Clearly, that is the reason for keyrunner to be running extremely slow in about everything (navigating the macos desktop UI or issuing any request..).

I've no idea what caused this, but clearly it seems like some odd for-loop bug somewhere in the code creating all those thousands of empty env vars.

To Reproduce Like mentioned above, I've no idea how to reproduce this for now, but I'll dig to see if I can come back to this ticket and provide more details on how to reproduce.

I used to be able to run that same request containing the same pre-script js scripting code, but at some point, this current bug happened to me +- randomly (probably not so random, once we discover the bug behind it, nothing of those bugs are truly random;)) and now making the request unusable, the spinner spins forever, making the entire keyrunner app unresponsive, and then I literally have to kill the app.

Expected behavior No empty keyrunner env vars generated automatically.

Screenshots Screenshot 2024-10-15 at 12 28 00 PM

Desktop (please complete the following information):

launchiamenterprise commented 1 month ago

@frank-duq Thanks for reporting this. We encountered a similar issue with another user but couldn't reproduce it on our end. Could you please share the pre-script you used before the issue occurred?

frank-duq commented 1 month ago

@launchiamenterprise sure, I just re-ran the same request again, and it seems that I can always reproduce now, so there's definitely something wrong either with my script, or with keyrunner, but nevertheless, if my script is the problem, keyrunner should have a protection against this...

(since I could never get to the bottom of it and fix it, because of this current error, since when I run it, it just makes the entire keyrunner app to freeze and you'll have to kill it....probably because it's stuck in an infinite loop currently creating all those hundreds or thousands of empty env vars.....the more you wait the more you'll end up with..)

so I'll just take some time to sanitize some var names etc in the script before making it public, once ready I'll copy it here a little later today..

cheers

launchiamenterprise commented 1 month ago

@frank-duq sure, thank you . once we get the script we will work on it and have a fix ready soon. you can also email us the script to contact@keyrunner.app

frank-duq commented 1 month ago

@launchiamenterprise, both pre and post script sent at the above email address, with some more details regarding some more investigations that I've done in trying to isolate as much as I could the problem.

launchiamenterprise commented 1 month ago

@frank-duq thank you very much .We really appreciate your assistance in isolating the issue. We just received the email and will look into the root casue.

launchiamenterprise commented 1 month ago

@frank-duq Thanks for the script. We were able to reproduce the issue and fix it. The problem was related to an async operation. Since we encrypt the environment variables and the function itself isn't async, KeyRunner intercepted it incorrectly. We're now testing thoroughly and plan to release a minor version in the next 1-2 days.

frank-duq commented 1 month ago

That's awesome, thanks for the quick turn around, and the above feedback on this.

launchiamenterprise commented 1 month ago

@frank-duq This has been addressed with our latest release (V#1.0.69), Please update to latest version.