-
Notifications
You must be signed in to change notification settings - Fork 0
Implement comprehensive edit task functionality with backend and frontend support to edit the added tasks. Kiro-Spec-Id: bdd640fb-0667-1ad1-1c80-317fa3b1799d #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Build artifacts | ||
| target/ | ||
| *.jar | ||
| *.war | ||
| *.ear | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.iml | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Use Maven with JDK 17 for building | ||
| FROM maven:3.9-eclipse-temurin-17 AS build | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy pom.xml and download dependencies (for layer caching) | ||
| COPY pom.xml . | ||
| RUN mvn dependency:go-offline -B | ||
|
|
||
| # Copy source code | ||
| COPY src ./src | ||
|
|
||
| # Build the application | ||
| RUN mvn clean package -DskipTests | ||
|
|
||
| # Use JDK 17 for runtime | ||
| FROM eclipse-temurin:17-jre | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy the built JAR from build stage | ||
| COPY --from=build /app/target/*.jar app.jar | ||
|
|
||
| # Expose the default Spring Boot port | ||
| EXPOSE 8080 | ||
|
|
||
| # Run the application | ||
| ENTRYPOINT ["java", "-jar", "app.jar"] | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||||||||||||||
| package com.example.taskmanager.config; | ||||||||||||||||||
|
|
||||||||||||||||||
| import org.springframework.context.annotation.Configuration; | ||||||||||||||||||
| import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||||||||||||||||||
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||||||||||||||||||
|
|
||||||||||||||||||
| @Configuration | ||||||||||||||||||
| public class WebConfig implements WebMvcConfigurer { | ||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
| public void addCorsMappings(CorsRegistry registry) { | ||||||||||||||||||
| registry.addMapping("/api/**") | ||||||||||||||||||
| .allowedOrigins("http://localhost:3000", "http://localhost:80") | ||||||||||||||||||
| .allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS") | ||||||||||||||||||
| .allowedHeaders("*") | ||||||||||||||||||
| .allowCredentials(true) | ||||||||||||||||||
|
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Security Vulnerability: CORS configuration allows overly permissive access that could enable cross-site attacks1. The wildcard for allowedHeaders combined with allowCredentials creates a security risk, and localhost:80 is an unusual configuration that may not work as expected.
Suggested change
Footnotes
|
||||||||||||||||||
| .maxAge(3600); | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||||||||||||||||||||||||||||||||||
| package com.example.taskmanager.exception; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import org.springframework.http.HttpStatus; | ||||||||||||||||||||||||||||||||||||||
| import org.springframework.http.ResponseEntity; | ||||||||||||||||||||||||||||||||||||||
| import org.springframework.validation.FieldError; | ||||||||||||||||||||||||||||||||||||||
| import org.springframework.web.bind.MethodArgumentNotValidException; | ||||||||||||||||||||||||||||||||||||||
| import org.springframework.web.bind.annotation.ExceptionHandler; | ||||||||||||||||||||||||||||||||||||||
| import org.springframework.web.bind.annotation.RestControllerAdvice; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||
| import java.util.HashMap; | ||||||||||||||||||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @RestControllerAdvice | ||||||||||||||||||||||||||||||||||||||
| public class GlobalExceptionHandler { | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @ExceptionHandler(MethodArgumentNotValidException.class) | ||||||||||||||||||||||||||||||||||||||
| public ResponseEntity<Map<String, Object>> handleValidationExceptions( | ||||||||||||||||||||||||||||||||||||||
| MethodArgumentNotValidException ex) { | ||||||||||||||||||||||||||||||||||||||
| Map<String, String> errors = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||||
| ex.getBindingResult().getAllErrors().forEach((error) -> { | ||||||||||||||||||||||||||||||||||||||
| String fieldName = ((FieldError) error).getField(); | ||||||||||||||||||||||||||||||||||||||
| String errorMessage = error.getDefaultMessage(); | ||||||||||||||||||||||||||||||||||||||
| errors.put(fieldName, errorMessage); | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Map<String, Object> response = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||||
| response.put("timestamp", LocalDateTime.now()); | ||||||||||||||||||||||||||||||||||||||
| response.put("status", HttpStatus.BAD_REQUEST.value()); | ||||||||||||||||||||||||||||||||||||||
| response.put("message", "Validation failed"); | ||||||||||||||||||||||||||||||||||||||
| response.put("errors", errors); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @ExceptionHandler(Exception.class) | ||||||||||||||||||||||||||||||||||||||
| public ResponseEntity<Map<String, Object>> handleGenericException(Exception ex) { | ||||||||||||||||||||||||||||||||||||||
| Map<String, Object> response = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||||
| response.put("timestamp", LocalDateTime.now()); | ||||||||||||||||||||||||||||||||||||||
| response.put("status", HttpStatus.INTERNAL_SERVER_ERROR.value()); | ||||||||||||||||||||||||||||||||||||||
| response.put("message", "An error occurred: " + ex.getMessage()); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Security Vulnerability: Generic exception handler exposes internal error details that could leak sensitive information to attackers1. The error message from
Suggested change
Footnotes
|
||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||
| version: '3.8' | ||||||
|
|
||||||
| services: | ||||||
| backend: | ||||||
| build: | ||||||
| context: ./backend | ||||||
| dockerfile: Dockerfile | ||||||
| container_name: taskmanager-backend | ||||||
| ports: | ||||||
| - "8080:8080" | ||||||
| environment: | ||||||
| - SPRING_PROFILES_ACTIVE=prod | ||||||
| networks: | ||||||
| - taskmanager-network | ||||||
| healthcheck: | ||||||
| test: ["CMD", "curl", "-f", "http://localhost:8080/api/tasks"] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Healthcheck command will fail because
Suggested change
|
||||||
| interval: 30s | ||||||
| timeout: 10s | ||||||
| retries: 3 | ||||||
| start_period: 40s | ||||||
|
|
||||||
| frontend: | ||||||
| build: | ||||||
| context: ./frontend | ||||||
| dockerfile: Dockerfile | ||||||
| container_name: taskmanager-frontend | ||||||
| ports: | ||||||
| - "3000:80" | ||||||
| depends_on: | ||||||
| - backend | ||||||
| networks: | ||||||
| - taskmanager-network | ||||||
|
|
||||||
| networks: | ||||||
| taskmanager-network: | ||||||
| driver: bridge | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker container runs as root user, which creates a security risk. Running applications as root violates the principle of least privilege and increases the attack surface if the container is compromised.