<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.atmosphere</groupId>
        <artifactId>atmosphere-project</artifactId>
        <version>4.0.77</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>atmosphere-spring-ai-alibaba</artifactId>
    <packaging>jar</packaging>
    <name>atmosphere-spring-ai-alibaba</name>
    <description>Spring AI Alibaba (Alibaba Cloud AI) AgentRuntime adapter for Atmosphere Framework</description>
    <url>https://github.com/Atmosphere/atmosphere</url>

    <properties>
        <atmosphere.module.name>org.atmosphere.spring.ai.alibaba</atmosphere.module.name>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Pin Spring AI 1.1.x transitives to 1.1.6 to close:
                 CVE-2026-22729 (vector-store path traversal, < 1.1.3),
                 SpEL injection in FilterExpression key (< 1.1.4),
                 FilterExpression Converter injection (< 1.1.5).
                 spring-ai-alibaba-agent-framework 1.1.2.2 hard-pins Spring AI
                 1.1.2; we override the vulnerable sub-artifacts directly. -->
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-vector-store</artifactId>
                <version>${spring-ai-alibaba-spring-ai.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-commons</artifactId>
                <version>${spring-ai-alibaba-spring-ai.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ai</groupId>
                <artifactId>spring-ai-rag</artifactId>
                <version>${spring-ai-alibaba-spring-ai.version}</version>
            </dependency>
            <!-- Pin Spring Framework to 7.0.9. Spring AI 1.1.x declares 6.2.x
                 (1.1.8 -> 6.2.19, the Alibaba framework's 1.1.2 -> 6.2.14), and
                 6.2.19 is the last OSS 6.2 release: spring-webflux
                 GHSA-j9f9-w8pj-32f8 (CVE-2026-47890, SSE stream corruption) and
                 GHSA-9qf2-26p9-2q2q (CVE-2026-47892, functional-endpoint header
                 predicate bypass) affect 6.2.0-6.2.19 and are fixed on 6.2 only
                 in the Enterprise Support Only 6.2.20; the OSS fix is 7.0.9.
                 This module already compiles against spring-boot-autoconfigure
                 ${spring-boot.version} (Boot 4 / Spring 7), and every Spring
                 artifact here is provided-scope, so the pin aligns Atmosphere's
                 own build and tests with Spring 7 without reaching consumers:
                 an application running Spring AI Alibaba 1.1.x on Boot 3.5
                 still brings its own Spring 6.2.x. -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>7.0.9</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- spring-retry <= 2.0.12 is GHSA-2827-2mxx-j8pv; pulled
                 transitively via spring-ai-retry. -->
            <dependency>
                <groupId>org.springframework.retry</groupId>
                <artifactId>spring-retry</artifactId>
                <version>2.0.13</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-ai</artifactId>
        </dependency>

        <dependency>
            <groupId>com.alibaba.cloud.ai</groupId>
            <artifactId>spring-ai-alibaba-agent-framework</artifactId>
            <version>${spring-ai-alibaba.version}</version>
            <scope>provided</scope>
            <!-- fastjson 1.x carries an unpatched critical RCE
                 (GHSA-crf3-v9rr-v7hj, vulnerable >= 1.2.68 <= 1.2.83). The
                 framework drags in 1.2.83, which is the HIGHEST 1.x that
                 exists — the line is end-of-life and the successor is the
                 separate com.alibaba.fastjson2:fastjson2 artifact, so no
                 version bump can close this.

                 Excluding is safe here and not a papering-over: no Atmosphere
                 source references com.alibaba.fastjson (verified by grep over
                 modules/spring-ai-alibaba/src/main), and the framework itself
                 is provided-scope, so we never propagated fastjson to
                 consumers in the first place. An application that supplies the
                 Alibaba framework at runtime still brings whatever fastjson
                 that framework needs; this exclusion only removes an unused,
                 unpatchable artifact from Atmosphere's own build graph. -->
            <exclusions>
                <exclusion>
                    <groupId>com.alibaba</groupId>
                    <artifactId>fastjson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Compile against the same Spring AI line the Alibaba agent
             framework hard-pins (1.1.x, managed up to 1.1.8 above) instead of
             ${spring-ai.version} (2.0.x). Mixing spring-ai-model 2.0 with the
             1.1.x commons the framework needs breaks its tool machinery at
             runtime (FunctionToolCallback 2.0 requires the 2.0-only
             JsonHelper), and a real Spring AI Alibaba app always runs the
             consistent 1.1.x stack. -->
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-client-chat</artifactId>
            <version>${spring-ai-alibaba-spring-ai.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>${spring-boot.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- The OpenAI ChatModel Spring AI 1.x's auto-configuration builds, so
             the startup line naming its endpoint is tested against the real class. -->
        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-openai</artifactId>
            <version>${spring-ai-alibaba-spring-ai.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-ai-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>${jakarta-servlet-api.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback-version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
