- 입력 검증 강화 (로그인/체인 핸들러 전체) - boss raid 비관적 잠금으로 동시성 문제 해결 - SSAFY 사용자명 sanitize + 트랜잭션 처리 - constant-time API 키 비교, 보안 헤더, graceful shutdown - 안전하지 않은 기본값 경고 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,13 @@ func (r *Repository) Delete(id uint) error {
|
||||
return r.db.Delete(&User{}, id).Error
|
||||
}
|
||||
|
||||
// Transaction wraps a function in a database transaction.
|
||||
func (r *Repository) Transaction(fn func(txRepo *Repository) error) error {
|
||||
return r.db.Transaction(func(tx *gorm.DB) error {
|
||||
return fn(&Repository{db: tx})
|
||||
})
|
||||
}
|
||||
|
||||
func (r *Repository) FindBySsafyID(ssafyID string) (*User, error) {
|
||||
var user User
|
||||
if err := r.db.Where("ssafy_id = ?", ssafyID).First(&user).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user