prevent data leakage when sending server.data
This commit is contained in:
parent
9cb9e4a062
commit
f6780e7a9b
@ -71,7 +71,7 @@ class App {
|
|||||||
graphDurationLabel: config.graphDurationLabel || (Math.floor(config.graphDuration / (60 * 60 * 1000)) + 'h'),
|
graphDurationLabel: config.graphDurationLabel || (Math.floor(config.graphDuration / (60 * 60 * 1000)) + 'h'),
|
||||||
graphMaxLength: TimeTracker.getMaxGraphDataLength(),
|
graphMaxLength: TimeTracker.getMaxGraphDataLength(),
|
||||||
serverGraphMaxLength: TimeTracker.getMaxServerGraphDataLength(),
|
serverGraphMaxLength: TimeTracker.getMaxServerGraphDataLength(),
|
||||||
servers: this.serverRegistrations.map(serverRegistration => serverRegistration.data),
|
servers: this.serverRegistrations.map(serverRegistration => serverRegistration.getPublicData()),
|
||||||
minecraftVersions: minecraftVersionNames,
|
minecraftVersions: minecraftVersionNames,
|
||||||
isGraphVisible: config.logToDatabase
|
isGraphVisible: config.logToDatabase
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,16 @@ class ServerRegistration {
|
|||||||
message: message
|
message: message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPublicData () {
|
||||||
|
// Return a custom object instead of data directly to avoid data leakage
|
||||||
|
return {
|
||||||
|
name: this.data.name,
|
||||||
|
ip: this.data.ip,
|
||||||
|
type: this.data.type,
|
||||||
|
color: this.data.color
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ServerRegistration
|
module.exports = ServerRegistration
|
||||||
|
Loading…
Reference in New Issue
Block a user