Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/java/until/the/eternity/config/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
Expand All @@ -25,6 +26,9 @@
@EnableCaching
public class RedisConfig implements CachingConfigurer {

@Value("${app.cache.redis-prefix:oab:v2}")
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for app.cache.redis-prefix is defined both here in @Value(...:oab:v2) and in application.yml. Keeping defaults in two places makes future version bumps easy to miss; consider defining the default only in configuration (and reference ${app.cache.redis-prefix} here without an inline default), or binding via @ConfigurationProperties for a single source of truth.

Suggested change
@Value("${app.cache.redis-prefix:oab:v2}")
@Value("${app.cache.redis-prefix}")

Copilot uses AI. Check for mistakes.
private String cacheKeyPrefix;

@Override
public CacheErrorHandler errorHandler() {
return new RedisCacheErrorHandler();
Expand All @@ -38,14 +42,15 @@ public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.activateDefaultTyping(
LaissezFaireSubTypeValidator.instance,
DefaultTyping.NON_FINAL,
DefaultTyping.EVERYTHING,
JsonTypeInfo.As.PROPERTY);
Comment on lines 43 to 46
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activateDefaultTyping with LaissezFaireSubTypeValidator is already permissive; switching to DefaultTyping.EVERYTHING further expands polymorphic type metadata to essentially all values, increasing the risk of unsafe deserialization gadgets and unexpected payload bloat. Prefer a narrower typing mode (e.g., NON_FINAL / OBJECT_AND_NON_CONCRETE) and a restrictive PolymorphicTypeValidator allowlisting only your DTO packages, or avoid global default typing entirely for cache serialization.

Copilot uses AI. Check for mistakes.
Comment on lines 43 to 46
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is titled around Redis cache prefix versioning, but this change also modifies the cache value serialization behavior (DefaultTyping) which can affect compatibility and security posture. If this is intentional, it should be called out in the PR description (or split into a separate PR) because it’s a behavior change independent of key prefixing.

Copilot uses AI. Check for mistakes.

GenericJackson2JsonRedisSerializer jsonSerializer =
new GenericJackson2JsonRedisSerializer(objectMapper);

RedisCacheConfiguration defaultConfig =
RedisCacheConfiguration.defaultCacheConfig()
.computePrefixWith(cacheName -> cacheKeyPrefix + ":" + cacheName + "::")
.entryTtl(Duration.ofMinutes(10))
.serializeKeysWith(
RedisSerializationContext.SerializationPair.fromSerializer(
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ elasticsearch:

app:
cache:
redis-prefix: ${APP_CACHE_REDIS_PREFIX:oab:v2} # 직렬화 방식 λ³€κ²½ μ‹œ 버전업 ν•„μš”
warmup:
enabled: ${APP_CACHE_WARMUP_ENABLED:true}
Comment on lines 147 to 151
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new app.cache.redis-prefix property was added here, but application-sample.yml still appears to have no corresponding entry (and still uses the old enable-logging: false value for p6spy). To avoid configuration drift for developers, please mirror this new property (and intended defaults) in application-sample.yml as well.

Copilot uses AI. Check for mistakes.
ranking-limit: ${APP_CACHE_WARMUP_RANKING_LIMIT:50}
Expand Down