Skip to content

Commit eb10609

Browse files
author
Anupam Mediratta
authored
fix: multi_agent.cwe-306 security vulnerability (#461)
Automated security fix generated by OrbisAI Security
1 parent 862d4c7 commit eb10609

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎config/server.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ app.post("/login", function (req, res) {
9999
loginURI(req, res)
100100
})
101101

102+
function checkAuthentication(req, res) {
103+
if (hasEnabledAuthentication() && !getLastconnection()) {
104+
res.status(401).send("Authentication required")
105+
return false
106+
}
107+
return true
108+
}
109+
102110
app.get("/config", function (req, res) {
111+
if (!checkAuthentication(req, res)) return
103112
configURI(req, res)
104113
})
105114

@@ -109,6 +118,7 @@ const mockContext = {
109118
}
110119

111120
app.get("/command", function (req, res) {
121+
if (!checkAuthentication(req, res)) return
112122
const url = req.query.cmd != null ? req.query.cmd : req.originalUrl
113123
if (MOCK_VERBOSE) console.log(commandcolor(`[server]/command ${url}`))
114124
commandsQuery(req, res, SendWS, mockContext)

0 commit comments

Comments
 (0)