Maker Pro
Maker Pro

Do not pass on Wifi credentials accidentally

Harald Kapp

Moderator
Moderator
When programming for WIFI access, many (if not most) code examples will have these 2 lines (or equivalent ones) at the beginning of the code:
Code:
const char* ssid = "yourNetworkName";
const char* password = "yourNetworkPassword";
You replace "yourNetworkName" and "yourNetworkPassword" by the network credentials of the Wifi network where the device is going to be used, usually your own Wifi network.
That is all good as long as the code doesn't leave your PC. However, you may happen to publish your code, be it on Github or simply as part of a request e.g. on this forum. If you forget to reset the Wifi credentials to a neutral value as in the above example, your network is compromised.

I suggest to replace the 2 lines by an include:
Code:
#include "/localdirectory/myWifiCredentials.h";
or the equivalent if using another programming language.
This local file contains the above 2 lines with your credentials only. When you publish your code, the include will not work on anybody else's computer until he/she creates his/her own local credential file. Your own credentials never leave your computer.

Cheers,
Harald Kapp
 
Top