Skip to content

Commit dc397d6

Browse files
committed
fix(0.0.8.1): fixed security
1 parent 13b307c commit dc397d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

api/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ async function updateGuildInfo(guild, name, icon, members, callback) {
142142

143143
app.post('/post/:guild/', async (req, res) => {
144144
const { guild } = req.params;
145-
const { name, icon, members } = req.body;
145+
const { name, icon, members, auth } = req.body;
146+
147+
if (auth !== process.env.AUTH) {
148+
return res.status(403).json({ message: 'Access denied. Auth token is missing' });
149+
}
146150

147151
updateGuildInfo(guild, name, icon, members, (err, results) => {
148152
if (err) {

bot/utils/requestAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function updateGuildInfo(guild: string, name: string, icon: string,
4444
'Content-Type': 'application/json',
4545
},
4646
method: 'POST',
47-
body: JSON.stringify({ name, icon, members }),
47+
body: JSON.stringify({ name, icon, members, auth: process.env.AUTH }),
4848
}).then(res => {
4949
return res.json()
5050
}).then(data => {

0 commit comments

Comments
 (0)