Skip to content

Commit b6545c1

Browse files
author
himaniraghav3
committed
validate input
1 parent ce64f22 commit b6545c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/server/services/recruitCRM.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ export default class RecruitCRMService {
188188
async getJob(req, res, next) {
189189
try {
190190
const sanitizedId = xss(req.params.id);
191+
192+
if (!/^[a-zA-Z0-9-_]{8,20}$/.test(sanitizedId)) {
193+
return res.status(400).json({ error: 'Invalid job ID format.' });
194+
}
191195
const response = await fetch(`${this.private.baseUrl}/v1/jobs/${sanitizedId}`, {
192196
method: 'GET',
193197
headers: {

0 commit comments

Comments
 (0)