mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-28 02:23:37 +01:00
refactor(signserver): replace raw SQL with repository interfaces
Extract all direct database access into three repository interfaces (SignUserRepo, SignCharacterRepo, SignSessionRepo) matching the pattern established in channelserver. This surfaces 9 previously silenced errors that are now logged with structured context, and makes the sign server testable with mock repos instead of go-sqlmock. Security fix: GetFriends now uses parameterized ANY($1) queries instead of string-concatenated WHERE clauses (SQL injection vector).
This commit is contained in:
@@ -333,8 +333,10 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
|
||||
bf.WriteBytes(filters.Data())
|
||||
|
||||
if s.client == VITA || s.client == PS3 || s.client == PS4 {
|
||||
var psnUser string
|
||||
_ = s.server.db.QueryRow("SELECT psn_id FROM users WHERE id = $1", uid).Scan(&psnUser)
|
||||
psnUser, err := s.server.userRepo.GetPSNIDForUser(uid)
|
||||
if err != nil {
|
||||
s.logger.Warn("Failed to get PSN ID for user", zap.Uint32("uid", uid), zap.Error(err))
|
||||
}
|
||||
bf.WriteBytes(stringsupport.PaddedString(psnUser, 20, true))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user