Skip to content

[Bug]: DataFixerRegistry.register() is not atomic (check-then-put race) #216

@Splatcrafter

Description

@Splatcrafter

AI REVIEWED

Module: spring-boot-starter
File: spring/autoconfigure/DataFixerRegistry.java (~line 154-160)
Severity: Medium

Summary

register() uses containsKey() followed by put() on a ConcurrentHashMap. Between these two calls, another thread could register the same domain.

if (this.fixers.containsKey(domain)) {
    throw new IllegalArgumentException("already registered");
}
this.fixers.put(domain, fixer); // race window

Suggested Fix

AetherDataFixer existing = this.fixers.putIfAbsent(domain, fixer);
if (existing != null) {
    throw new IllegalArgumentException("DataFixer already registered for domain: " + domain);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions