feat: enhance security with IP banning, ownership checks, and SSRF protection
Add comprehensive security improvements across the application: - **IP-based login protection**: Implement IP ban system tracking login failures, auto-banning after threshold exceeded - **Ownership verification**: Add userID parameter to Delete/Update operations for posts and comments to prevent unauthorized modifications - **SSRF protection**: Add URL and resolved host validation for image URLs in chat and OpenAI client - **SQL injection prevention**: Add EscapeLikeWildcard utility to escape special characters in LIKE queries - **HTTP security**: Configure server timeouts and add security headers middleware - **Rate limiting**: Refactor to support configurable duration and per-endpoint rate limits for auth routes - **Error handling**: Standardize error responses using HandleError and proper error types
This commit is contained in:
@@ -115,7 +115,10 @@ func (s *scheduleSyncService) convertCourses(data *pb.ScheduleResultData) []*mod
|
||||
for _, c := range data.Courses {
|
||||
for _, st := range c.Schedule {
|
||||
dayOfWeek := 0
|
||||
fmt.Sscanf(st.Day, "%d", &dayOfWeek)
|
||||
if _, err := fmt.Sscanf(st.Day, "%d", &dayOfWeek); err != nil {
|
||||
zap.L().Warn("invalid day format in schedule sync", zap.String("day", st.Day), zap.Error(err))
|
||||
dayOfWeek = 0
|
||||
}
|
||||
|
||||
startSection := 1
|
||||
endSection := 1
|
||||
|
||||
Reference in New Issue
Block a user