Unable to detect the password and API key in the index.js file #1786
Unanswered
mightysai1997
asked this question in
Q&A
Replies: 1 comment
-
Could anyone please help me? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
//index.js
// Sensitive Information
const DB = {
host: 'localhost',
user: 'root',
password: 'password123!@#', // Plaintext password
database: 'testdb'
};
const API_KEY = '12345-SECRET-API-KEY!@'; // Example of an API key
// Example function to simulate using these credentials
function connectToDatabase() {
console.log(
Connecting to database ${DB.database} on ${DB.host} as ${DB.user}
);console.log(
Password: ${DB.password}
); // Example of exposing the password, which is a bad practice!}
function callExternalAPI() {
console.log(
Calling API with key: ${API_KEY}
);}
connectToDatabase();
callExternalAPI();
``
Beta Was this translation helpful? Give feedback.
All reactions