Skip to content

Commit 3f668cb

Browse files
authored
Merge pull request #135 from SAP/develop
Release v0.6.1
2 parents 64c290c + dd47ad5 commit 3f668cb

11 files changed

Lines changed: 506 additions & 778 deletions

File tree

.github/workflows/be-installation-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131
token: ${{ secrets.GITHUB_TOKEN }}
3232

3333
- name: Install uv
34-
uses: astral-sh/setup-uv@v6
34+
uses: astral-sh/setup-uv@v7
3535
with:
3636
version: "latest"
3737
enable-cache: true
38-
prune-cache: false
38+
prune-cache: true
3939

4040
- name: Install dependencies
4141
run: uv sync --locked --all-extras --dev --project backend-agent

.github/workflows/docker.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ jobs:
217217
with:
218218
version: 'latest'
219219

220+
- name: Set up kubelogin
221+
uses: azure/use-kubelogin@v1
222+
env:
223+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224+
with:
225+
kubelogin-version: 'latest'
226+
220227
- name: Configure kubectl for SAP BTP Kyma
221228
run: |
222229
mkdir -p ~/.kube
@@ -241,6 +248,13 @@ jobs:
241248
with:
242249
version: 'latest'
243250

251+
- name: Set up kubelogin
252+
uses: azure/use-kubelogin@v1
253+
env:
254+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255+
with:
256+
kubelogin-version: 'latest'
257+
244258
- name: Configure kubectl for SAP BTP Kyma
245259
run: |
246260
mkdir -p ~/.kube

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# Version: v0.6.1
2+
3+
* [#112](https://github.com/SAP/STARS/pull/112): Bump sentence-transformers from 5.1.0 to 5.1.1 in /backend-agent
4+
* [#118](https://github.com/SAP/STARS/pull/118): Bump pandas from 2.3.2 to 2.3.3 in /backend-agent
5+
* [#119](https://github.com/SAP/STARS/pull/119): Bump tensorflow from 2.19.1 to 2.20.0 in /backend-agent
6+
* [#120](https://github.com/SAP/STARS/pull/120): Bump sentence-transformers from 5.1.0 to 5.1.1 in /backend-agent
7+
* [#121](https://github.com/SAP/STARS/pull/121): Bump langchain-community from 0.3.29 to 0.3.30 in /backend-agent
8+
* [#123](https://github.com/SAP/STARS/pull/123): [chore] Optimize k8s steps in GHA
9+
* [#124](https://github.com/SAP/STARS/pull/124): Update models with note 26-09-25
10+
* [#130](https://github.com/SAP/STARS/pull/130): Bump astral-sh/setup-uv from 6 to 7
11+
* [#131](https://github.com/SAP/STARS/pull/131): Bump langchain-core from 0.3.76 to 0.3.79 in /backend-agent
12+
* [#132](https://github.com/SAP/STARS/pull/132): Bump langchain-community from 0.3.30 to 0.3.31 in /backend-agent
13+
* [#133](https://github.com/SAP/STARS/pull/133): Bump sap-ai-sdk-gen[all] from 5.6.3 to 5.7.5 in /backend-agent
14+
* [#134](https://github.com/SAP/STARS/pull/134): Bump the js-dependencies group across 1 directory with 24 updates
15+
16+
117
# Version: v0.6.0
218

319
* [#93](https://github.com/SAP/STARS/pull/93): Add 2 PyRIT orchestrators ((Crescendo, PAIR)) and re-strucutre PyRIT code.

backend-agent/Dockerfile

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
FROM astral/uv:python3.11-trixie-slim AS builder
22

3-
# Install build dependencies including Rust for packages that need it
4-
RUN apt-get update && apt-get install -y \
3+
# Install build dependencies with minimal footprint
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
55
build-essential \
66
git \
77
curl \
88
pkg-config \
99
libssl-dev \
10-
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
&& apt-get autoremove -y
12+
13+
# Install Rust with minimal profile and immediate cleanup
14+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal \
1115
&& . ~/.cargo/env \
12-
&& rm -rf /var/lib/apt/lists/*
16+
&& rustup component add rustfmt
1317

1418
# Add Rust to PATH
1519
ENV PATH="/root/.cargo/bin:${PATH}"
@@ -23,24 +27,50 @@ COPY pyproject.toml uv.lock ./
2327
ENV UV_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cpu"
2428
ENV TORCH_INDEX_URL="https://download.pytorch.org/whl/cpu"
2529

26-
# Install dependencies using uv with proper build environment
30+
# Install dependencies with aggressive progressive cleanup
2731
RUN . ~/.cargo/env && \
28-
uv sync --frozen --no-dev --no-cache && \
29-
# Clean up any temporary files to reduce layer size
30-
rm -rf /root/.cache/uv /tmp/* /var/tmp/* && \
31-
# Remove Rust toolchain after build to reduce image size
32-
rustup self uninstall -y
32+
# Install dependencies with bytecode compilation for better performance
33+
uv sync --frozen --no-dev --no-cache --compile-bytecode && \
34+
# Immediate cleanup of build artifacts during installation
35+
find /app/.venv -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true && \
36+
find /app/.venv -name "*.pyc" -delete 2>/dev/null || true && \
37+
find /app/.venv -name "*.pyo" -delete 2>/dev/null || true && \
38+
# Remove test files and documentation from packages (keeping runtime libs)
39+
find /app/.venv -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true && \
40+
find /app/.venv -type d -name "test" -exec rm -rf {} + 2>/dev/null || true && \
41+
find /app/.venv -type d -name "docs" -exec rm -rf {} + 2>/dev/null || true && \
42+
# Strip debug symbols from shared libraries to reduce size
43+
find /app/.venv -name "*.so" -exec strip {} + 2>/dev/null || true && \
44+
# Aggressive cache and temporary file cleanup
45+
rm -rf /root/.cache/uv \
46+
/root/.cache/pip \
47+
/root/.cache/* \
48+
/tmp/* \
49+
/var/tmp/* \
50+
/root/.cargo/registry \
51+
/root/.cargo/git \
52+
/app/.venv/share \
53+
&& \
54+
# Remove Rust toolchain completely after build
55+
rustup self uninstall -y && \
56+
# Final build tools cleanup to free space
57+
apt-get autoremove -y build-essential git curl pkg-config && \
58+
apt-get autoclean
3359

3460
# ----------------------------------------
3561

3662
FROM python:3.11-slim-trixie AS runtime
3763

38-
# Install only runtime dependencies
39-
RUN apt-get update && apt-get install -y \
64+
# Install minimal runtime dependencies
65+
RUN apt-get update && apt-get install -y --no-install-recommends \
4066
libssl3 \
4167
libffi8 \
68+
# Add required libraries for ML packages
69+
libgomp1 \
70+
libglib2.0-0 \
4271
&& rm -rf /var/lib/apt/lists/* \
43-
&& apt-get clean
72+
&& apt-get autoremove -y \
73+
&& apt-get autoclean
4474

4575
WORKDIR /app
4676

@@ -50,7 +80,7 @@ COPY --from=builder /app/.venv /app/.venv
5080
# Copy dependency files
5181
COPY pyproject.toml uv.lock ./
5282

53-
# Copy the rest of the application
83+
# Copy the application
5484
COPY . .
5585

5686
# Make sure we use the virtual environment

backend-agent/data/all/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
{
6969
"attack": "gptfuzz",
7070
"target-model": "<target>",
71+
"attack-model": "gpt-4o-mini",
7172
"parameters": {
7273
"max_query_count": 300
7374
}

backend-agent/llm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'aicore-mistralai':
3131
[
3232
'mistralai--mistral-large-instruct',
33+
'mistralai--mistral-medium-instruct',
3334
'mistralai--mistral-small-instruct',
3435
],
3536
'aicore-opensource':
@@ -43,7 +44,6 @@
4344
'amazon--nova-pro',
4445
'amazon--nova-premier',
4546
'anthropic--claude-3-haiku',
46-
'anthropic--claude-3-sonnet',
4747
'anthropic--claude-3-opus',
4848
'anthropic--claude-3.5-sonnet',
4949
'anthropic--claude-3.7-sonnet',

backend-agent/pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'stars'
3-
version = '0.6.0'
3+
version = '0.6.1'
44
description = 'Smart Threat AI Reporting Scanner (STARS)'
55
readme = 'README.md'
66
license = {text = 'Apache-2.0'}
@@ -13,7 +13,7 @@ maintainers = [
1313
]
1414
requires-python = '>=3.10,<3.13'
1515
dependencies = [
16-
'sap-ai-sdk-gen[all]==5.6.3',
16+
'sap-ai-sdk-gen[all]==5.7.5',
1717
'python-dotenv==1.1.1',
1818
'faiss-cpu==1.12.0',
1919
'Flask==3.1.2',
@@ -28,20 +28,20 @@ dependencies = [
2828
'requests==2.32.5',
2929
'unstructured==0.18.15',
3030
'art==6.5',
31-
'pandas==2.3.2',
31+
'pandas==2.3.3',
3232
'ollama==0.6.0',
3333
'weasyprint==66.0',
3434
'pyrit==0.9.0',
3535
'codeattack @ git+https://github.com/marcorosa/CodeAttack',
3636
'gptfuzzer @ git+https://github.com/marcorosa/GPTFuzz@no-vllm',
3737
'garak==0.11.0',
38-
'sentence-transformers==5.1.0',
38+
'sentence-transformers==5.1.1',
3939
]
4040

4141
[project.optional-dependencies]
4242
nlp = [
4343
'textattack==0.3.10',
44-
'tensorflow==2.19.1',
44+
'tensorflow==2.20.0',
4545
'tensorflow-hub==0.16.1',
4646
]
4747

backend-agent/status.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def trace_llm(self,
178178
'prompt': prompt,
179179
'response': response.to_dict()
180180
}
181-
self.trace['llm_messages'].append(message)
181+
# Only trace if there's an active trace context
182+
if hasattr(self, 'trace') and self.trace:
183+
self.trace['llm_messages'].append(message)
182184

183185
def finish_trace(self, completed: bool, output: str):
184186
"""

0 commit comments

Comments
 (0)