Skip to content

Commit 2221f4b

Browse files
author
khanh2906
committed
release 0.6.6
1 parent f02cdd2 commit 2221f4b

File tree

16 files changed

+92
-9
lines changed

16 files changed

+92
-9
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| Version | Supported |
66
| ------- | ------------------ |
77
| 0.5.3 | :white_check_mark: |
8-
| 0.5.5 | :white_check_mark: |
8+
| 0.6.6 | :white_check_mark: |
99

1010

1111
## Reporting a Vulnerability

lib/handlers/generateElements.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,18 @@ async function generateSQLConfig() {
388388

389389
const templatePath = path.join(__dirname, './../stubs/template');
390390
const sequelizeConfig = path.join(templatePath, '.sequelizerc')
391+
const migrationFolder = path.join(templatePath, './src/database/migrations')
392+
const dataAssociationFolder = path.join(templatePath, './src/app/ORMs/associations');
393+
const userOrmPath = path.join(elementPath, './ORM/sql/User.stub');
391394

392395
fs.copy(sequelizeConfig, path.join(process.cwd(), '.sequelizerc'))
396+
fs.copy(migrationFolder, path.join(process.cwd(), './src/database/migrations'))
397+
fs.copy(dataAssociationFolder, path.join(process.cwd(), './src/app/ORMs/associations'))
393398

399+
const userOrm = await fs.readFile(userOrmPath, 'utf8');
400+
const targetPath = path.join(process.cwd(), 'src/app/ORMs/User.js')
401+
await fs.writeFile(targetPath, userOrm);
402+
394403
const packageJsonPath = path.join(process.cwd(), 'package.json');
395404
const packageJson = require(packageJsonPath);
396405

lib/stubs/template/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img width="250"src="https://libs.knfs-tech.com/bamimi/img/bamimi-logo.png">
2+
<img width="250"src="https://bamimi.github.io/assets/img/bamimi-logo.png">
33
<br>
44
</p>
55

@@ -15,7 +15,7 @@ Bamimi is a web application framework with expressive, elegant syntax. We believ
1515

1616
## Learning Bamimi
1717

18-
Bamimi has the most extensive and thorough [documentation](https://libs.knfs-tech.com/bamimi) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
18+
Bamimi has the most extensive and thorough [documentation](https://bamimi.github.io) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
1919

2020
## Contributing
2121

lib/stubs/template/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "bamimi",
3-
"version": "0.5.5",
3+
"version": "0.6.6",
44
"description": "Power framework for nodejs",
55
"main": "src/server.js",
6+
"bamimiVersion": "0.6.6",
67
"bin": {
78
"bamimi-enjoy-": "./dist/routes/cli/index.js",
89
"bamimi-enjoy-dev": "./src/routes/cli/index.js"
@@ -65,6 +66,7 @@
6566
"express-session": "^1.18.0",
6667
"express-validator": "^6.14.2",
6768
"fs-extra": "^11.2.0",
69+
"helmet": "^8.0.0",
6870
"ioredis": "^5.3.2",
6971
"method-override": "^3.0.0",
7072
"morgan": "^1.10.0",
@@ -75,7 +77,8 @@
7577
"mongoose": "^8.8.2",
7678
"socket.io": "^4.7.5",
7779
"winston": "^3.13.0",
78-
"socket.io-client": "^4.6.1"
80+
"socket.io-client": "^4.6.1",
81+
"xss": "^1.0.15"
7982
},
8083
"devDependencies": {
8184
"@babel/cli": "^7.26.4",

lib/stubs/template/src/app/http/controllers/web/demo.controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"use strict";
22

3+
const { bamimiVersion } = require("./../../../../../package.json")
4+
35
module.exports = {
46
index: async function (req, res, next) {
57
try {
68
return await res.view({
79
view: "pages/home", data: {
8-
version: "v0.5.5"
10+
version: `v${bamimiVersion}`
911
}
1012
});
1113
} catch (error) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
const xss = require("@iUtils/xss")
3+
const securityConfig = require("@iConfigs/security");
4+
const helmet = require('helmet');
5+
6+
const sanitizeRequest = (req, res, next) => {
7+
if (!req.ignoreXss) {
8+
if (req.body) xss(req.body, securityConfig.xssConfig);
9+
if (req.query) xss(req.query, securityConfig.xssConfig);
10+
if (req.params) xss(req.params, securityConfig.xssConfig);
11+
}
12+
13+
next();
14+
};
15+
16+
module.exports = () => {
17+
return [
18+
sanitizeRequest,
19+
helmet(securityConfig.helmetConfig)
20+
]
21+
}

lib/stubs/template/src/app/http/requests/.gitkeep

Whitespace-only changes.

lib/stubs/template/src/app/http/responses/validationApi.res.js renamed to lib/stubs/template/src/app/http/requests/validationApi.res.js

File renamed without changes.

lib/stubs/template/src/app/http/responses/validationWeb.res.js renamed to lib/stubs/template/src/app/http/requests/validationWeb.res.js

File renamed without changes.

lib/stubs/template/src/app/http/responses/api.res.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22
const { handle } = require("@iKernel/interface/apis");
33
const interfaces = require("@iInterfaces/apis")
4+
const xss = require("@iUtils/xss")
45
/**
56
* API response
67
*
@@ -14,6 +15,9 @@ const interfaces = require("@iInterfaces/apis")
1415
module.exports = (req, res, next) => {
1516

1617
const format = (data = null) => {
18+
if (!req.ignoreXss) {
19+
xss(data)
20+
}
1721
const message = handle(res.statusCode, data);
1822
return message
1923
};

0 commit comments

Comments
 (0)