mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Prevent http git urls from including username/pword
This commit is contained in:
@@ -501,6 +501,10 @@ module.exports = {
|
||||
// Add a remote
|
||||
app.post("/:id/remotes", needsPermission("projects.write"), function(req,res) {
|
||||
var projectName = req.params.id;
|
||||
if (/^https?:\/\/[^/]+@/i.test(req.body.url)) {
|
||||
res.status(400).json({error:"unexpected_error", message:"Git http url must not include username/password"});
|
||||
return;
|
||||
}
|
||||
runtime.storage.projects.addRemote(req.user, projectName, req.body).then(function() {
|
||||
res.redirect(303,req.baseUrl+"/"+projectName+"/remotes");
|
||||
}).catch(function(err) {
|
||||
|
Reference in New Issue
Block a user