Can people see my API keys on a web app using F12 (Web Inspect) or other tools?

Can people see my API keys on a web app using F12 (Web Inspect) or other tools?

avatar

I made a web app, and I am planning on sharing it with other people but I am afraid that they will be able to access my API keys. Is that a thing?

The web app contains a couple of API keys under the headers.

Product: PowerShell Universal
Version: 1.4.6


avatar

Recommended Answer

I see. So, if you go to Platform, then Variables, you can create a new variable that is Secret (rather than Simple). Secret variables are only accessible by PSU itself and are encrypted. Your script could simply be modified to reference the variable for those lines. This would then allow you to avoid having sensitive information stored within the script directly (as well as being able to reuse the variable in other scripts if needed).

For example, it would change to something like $headers2.Add("X-Cisco-Meraki-API-Key", $($Secret:apikeyvariable))

All Comments (7)

avatar

Please clarify. Are you sending API keys to the client from the web app? If you’re talking about keys being sent from the client TO the web app, I’m not sure what your fear is when they would already have/know the key being sent (since they’re the one sending it).

avatar

I made a web app that searches devices assigned to a user.

When someone types a name on the search field, it sends a request to our database using an API key that is included on the script that runs in the backend.

My fear is that people can access the script running in the backend of the webapp and look/grab my API keys.

Not sure if that makes sense.

5390fd864d04a81e27713b97931c910835061fde

5390fd864d04a81e27713b97931c910835061fde.png

avatar

Is the API key stored inside of a Secret variable that’s just being referenced from inside of your script that gets triggered when a user submits the query on that web app?

avatar

It is being referenced from the inside of the script and it is triggered when a user submits the query.

I am new to this stuff so I have no idea how to store the API key inside of a secret variable. I am using the free version of PSU.



86f783cce1d1bb3fa0c5a74c86657c43a4494d61

86f783cce1d1bb3fa0c5a74c86657c43a4494d61.png

avatar

I see. So, if you go to Platform, then Variables, you can create a new variable that is Secret (rather than Simple). Secret variables are only accessible by PSU itself and are encrypted. Your script could simply be modified to reference the variable for those lines. This would then allow you to avoid having sensitive information stored within the script directly (as well as being able to reuse the variable in other scripts if needed).

For example, it would change to something like $headers2.Add("X-Cisco-Meraki-API-Key", $($Secret:apikeyvariable))

avatar

It worked!!! You are the best. This makes me feel much more comfortable when I share this with other techs.

avatar

Great. Glad it solved your concern.