postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.87k stars 841 forks source link

Non-persistent environment variables #13095

Open MalikKillian opened 3 months ago

MalikKillian commented 3 months ago

Is there an existing request for this feature?

Is your feature request related to a problem?

Switching between the Postman UI (desktop) and the CI runner (newman) behaviors have to change and are kind of at odds with each other. Local variables are excellent for use in a CI environment but they disappear at the end of a collection run or single request so they're more or less useless when running from the UI. Environment variables are the next best thing but unfortunately they can lead to "garbage" being exported into the environment file.

Describe the solution you'd like

My number 1 gripe with Postman, by a long-shot, is the lack of "non-persistent" or "session" variables. The problems I describe could be almost entirely alleviated if either a new "Session" scope was added (not my preference) or if environment variables had a "persist" option. If a variable is not marked with "persist" then it would not appear in an exported JSON file, or appear in a shared workspace, or appear after the app is closed and reopened.

This could allow users to manually execute requests just as they would be executed in a CI environment but without having to be mindful of adding "noise" into the environment or leaking credentials and tokens.

Describe alternatives you've considered

To mitigate this issue my team has implemented cleanup code that occurs at the end of a folder or collection. These help most of the time but rather than encouraging the behavior of manual cleanup we're encouraging the behavior of running the cleanup code which doesn't have a much better rate of success.

Additional context

No response

malik12-dev commented 3 months ago

Hi

skatikia commented 2 months ago

Hey @malik12-dev , I'm so sorry for the delayed reply. Albeit, I might be replying with some positive news!

We have rolled out Potman V11.14 that includes a bunch of changes to the variable experience including the ability to set temporary values for variables without adding them to collections, environments or global scope. These values are stored locally for as long as the request is open and serve as a prompt for you to fill them out before you hit Send.

unscoped-variable

However, I'm not exactly sure if this addresses your concern. So, I'll keep the issue open, wait for you to try the changes out and get back. Feel free to reach out to me on shobhit.katikia@postman.com or help me set up a meeting as per your convenience. I'd love it if you can walk me through the problems you're facing.

Check out the release note for V11.14

MalikKillian commented 6 days ago

Hmm, that depends on whether or not the temporary value can be set using Scripts and how long they last. The main feature I would like to see is values that are persistent for all intents and purposes EXCEPT they don't get pushed to exported JSON files. The goal here is to not create noise in environment files or potentially leak secrets that might be passed around during a test execution.