feat(EM-39): Implement Spring Security Foundation and Authentication Configuration#48
Open
devin-ai-integration[bot] wants to merge 1 commit intofeat/microservices-migration-v2from
Conversation
…configuration - Create libs/ftgo-security/ shared library module - Implement base SecurityFilterChain with REST API defaults (stateless sessions) - Configure CORS policy for cross-service communication (configurable) - Disable CSRF protection for stateless REST APIs (configurable) - Add Spring Boot auto-configuration for zero-config setup - Add spring-security-test and spring-boot-autoconfigure to version catalog - Add spring-boot-security bundle to version catalog - Include unit tests for security config, CORS, and security properties - Add README with configuration documentation Co-Authored-By: Alex Baker <alexandercommander453@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(EM-39): Implement Spring Security Foundation and Authentication Configuration
Summary
Adds
libs/ftgo-security/, a shared Spring Security configuration library providing consistent security defaults across FTGO microservices. The module is a standalone Gradle project (same pattern aslibs/ftgo-common/) that auto-configures aSecurityFilterChainwith:SessionCreationPolicy.STATELESS)ftgo.security.cors.*properties@ConditionalOnMissingBean(SecurityFilterChain.class)— services can override with their own beanAlso updates
gradle/libs.versions.tomlwithspring-security-test,spring-boot-autoconfigure, and aspring-boot-securitybundle.Review & Testing Checklist for Human
allowedOrigins = ["*"]withallowCredentials = falseis safe, but there's no runtime guard if a user configuresallow-credentials: truewith wildcard origins (Spring will throw at request time, not at startup). Consider whether a startup validation is needed.csrfIsDisabledForPostRequestsasserts POST returns 403, but that's due to missing auth, not CSRF. A more rigorous test would use@WithMockUserand POST without a CSRF token to confirm the request succeeds. Verify this gap is acceptable.@ConditionalOnMissingBeanback-off not tested: The auto-config claims to back off when a service defines its ownSecurityFilterChain, but no test covers this scenario. Verify the condition placement on the class (not the bean method) behaves as expected.build.gradle: Versions (3.2.5,6.2.4, etc.) are hardcoded rather than referencing the version catalog. This matchesftgo-common's pattern but creates potential for version drift. Confirm this is the intended convention for standalone lib modules.TestApplicationmaps/actuator/healthvia a@RestControllerrather than using Spring Boot Actuator. The test validates path matching but not real actuator behavior.Recommended test plan: Import
ftgo-securityas a dependency in one of the existing microservice stubs (e.g.,consumer-service) and verify: (1) actuator/swagger endpoints are accessible without auth, (2) other endpoints return 403, (3) overridingSecurityFilterChainin the service causes auto-config to back off.Notes
ftgo-common(not wired into rootsettings.gradleper task constraints)FtgoSecurityConfigurationTest, 5 inCorsPropertiesTest, 3 inSecurityPropertiesTest)Link to Devin run: https://app.devin.ai/sessions/aaee6ead0ad84cf09ce071f99423584b
Requested by: @abj453demo