
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
dpape-node-service
Advanced tools
Nodejs for server-side development integration
npm install dpape-node-service -S
# OR
yarn add dpape-node-service -S
import { init } from "dpape-node-service";
import { join } from "path";
init({
// mysql config items
mysql: {
user: "root",
password: "**********",
database: "databaseName",
},
// mysql mapper xml path
mapperBasePath: join(__dirname, "./mapper"),
// Save log address
logs: join(__dirname, "./logs"),
// mongodb config items
mongodb: {
user: "mongo",
password: "*********",
database: "databaseName",
authDatabase: "admin",
},
});
// index.js
import service, { app } from "dpape-node-service";
import { join } from "path";
const userApi = app();
// Last access path `/api/user/info`
userApi.get("/info", (req, res) => {
res.send({
statusCode: 200,
data: {
name: "admin",
age: 25,
},
});
});
const apis = [
{
path: "/user",
app: userApi,
},
];
service({
staticConfig: {
url: "/",
address: join(__dirname, "./static"),
},
apiPrefix: "/api",
apis: apis,
port: 8080,
});
- node index.js
- Service app listening at http://localhost:8080
<?xml version="1.0" encoding="UTF-8"?>
<mapper>
<item key="product_name" as="productName"></item>
<item key="product_intro" as="productIntro"></item>
<item key="id" as="productId"></item>
<sql type="select" name="getProductInfo">
select product_name,product_intro from product where id = #{id}
</sql>
</mapper>
import { sqlMapper } from "dpape-node-service";
async () => {
try {
const result = await sqlMapper("xxx.xml", "getProductInfo");
return result;
} catch (err) {
return Promise.reject(err);
}
};
Read on for more practical tips nodejs-mysql-mapper
import { mongo } from "dpape-node-service";
//Query
async () => {
try {
const result = await mongo.querys("collectionName");
return result;
} catch (err) {
return Promise.reject(err);
}
};
//Insert
async () => {
try {
const result = await mongo.inserts("collectionName", {
name: "test name",
id: 1,
});
return result;
} catch (err) {
return Promise.reject(err);
}
};
//Update
async () => {
try {
const result = await mongo.updates(
"collectionName",
{ id: 1 },
{
name: "update - test name",
}
);
return result;
} catch (err) {
return Promise.reject(err);
}
};
import { log } from "dpape-node-service";
// info logs
log.info("This is an info log");
// error logs
log.info("This is an error log");
# error.log
[2021-05-26T15:31:41.276] [ERROR] error - This is an error log
# info.log
[2021-05-26T15:31:41.274] [INFO] info - This is an info log
Name | Describe | Default Value | Required |
---|---|---|---|
mysql | MySQL config info | -- | false |
mapperBasePath | mysql mapper xml path | -- | false |
mongodb | mysql mongodb config items | -- | false |
logs | Save log address | -- | false |
Name | Describe | Default Value | Required |
---|---|---|---|
port | Service port | -- | true |
apis | Web Service List for express app | -- | false |
apiPrefix | api prefix config | /api | false |
cross | Support cross-domain | false | false |
staticConfig | Static resource address. Supports one or more configuration items | -- | false |
headers | Custom request header information | -- | false |
Q: Connect MySQL Error
ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server;
A: Please execute the following command in MySQL
ALTER USER '[username]'@'[ip]' IDENTIFIED WITH mysql_native_password BY '[password]';
FAQs
Nodejs for server-side development integration
We found that dpape-node-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.