Skip to content

Commit 80b6c53

Browse files
committed
Merge branch 'osa_proxy_52' into 'master'
changelog for osa-proxy-2025-52-0 See merge request CodeScoring/docs!569
2 parents 9efaa93 + e2af43d commit 80b6c53

11 files changed

Lines changed: 186 additions & 2 deletions

File tree

docs/changelog/proxy-changelog.en.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ hide:
55

66
# OSA Proxy Changelog
77

8+
### [2025.52.0] - 2025-12-23
9+
10+
#### Added
11+
12+
- Added caching of policy checking results in Redis with TTL and background refresh support. See [documentation](/osa-proxy/config-caching.en)
13+
- Added a proactive cache refresh mechanism based on a timer
14+
- Added Swagger UI for API documentation (`/api/swagger`)
15+
- Added REST API for cache management (`/api/cache`)
16+
- Added header updates (`Last-Modified`, `ETag`) for manifests. This ensures manifests stay up to date with the latest security policies
17+
18+
#### Changed
19+
20+
- Increased default value of `max-in-memory-size` config variable from 50MB to 150MB (for processing large manifests)
21+
- Optimized NPM manifest processing using a stream processor to increase processing speed for large files and reduce garbage collector load
22+
823
### [2025.48.3] - 2025-12-08
924

1025
#### Fixed

docs/changelog/proxy-changelog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ hide:
55

66
# OSA Proxy Changelog
77

8+
### [2025.52.0] - 2025-12
9+
10+
#### Добавлено
11+
12+
- Добавлено кэширование результатов проверки политик в Redis с поддержкой TTL и фонового обновления. Подробнее в [документации](/osa-proxy/config-caching)
13+
- Добавлен механизм проактивного обновления кэша по таймеру
14+
- Добавлен Swagger UI для документации API (`/api/swagger`)
15+
- Добавлен REST API для управления кэшем (`/api/cache`)
16+
- Добавлено обновление заголовков (`Last-Modified`, `ETag`) для манифестов. Это решает проблему "устаревших" манифестов, с точки зрения политик.
17+
18+
#### Изменено
19+
20+
- Увеличено значение по умолчанию для переменной конфигурации `max-in-memory-size` с 50MB до 150MB (для обработки больших манифестов)
21+
- Оптимизирована обработка манифестов NPM с использованием потокового процессора для повышения скорости обработки больших файлов и снижения нагрузки для сборщика мусора
22+
823
### [2025.48.3] - 2025-12-08
924

1025
#### Исправлено
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
hide:
3+
- footer
4+
---
5+
6+
# Redis and сaching сonfiguration
7+
8+
To improve performance and reduce load on the CodeScoring platform, caching of policy checking results ([Judge service](/on-premise/containers-description.en/)) is supported. Caching requires a Redis connection.
9+
10+
!!! example "Redis and Caching Settings"
11+
12+
```yaml
13+
spring:
14+
data:
15+
redis:
16+
host: localhost
17+
port: 6379
18+
database: 0 # Database number (optional)
19+
password: password # Optional
20+
timeout: 2000ms
21+
22+
cache:
23+
judge:
24+
enabled: true # Enable caching (default is false)
25+
ttl: 24h # Time-to-live for cache entries
26+
refresh-after: 30m # Time after which an entry is considered stale and needs refresh (but can still be served from cache)
27+
proactive-refresh-enabled: true # Enable proactive (background) cache refresh
28+
proactive-refresh-interval: 2h # Interval for background refresh task
29+
key-prefix: "cs:judge:" # Prefix for Redis keys
30+
```
31+
32+
!!! note "Cache TTL prolongation specifics"
33+
34+
Proactive refresh does not prolong the TTL (time-to-live) of a cache entry. The TTL is only extended when data is read from the cache by actual user requests. This ensures that only frequently requested components remain in the cache, while rarely used ones are automatically removed from Redis.
35+
36+
## Swagger UI
37+
38+
OSA Proxy provides Swagger UI for API documentation and cache management.
39+
40+
- **URL:** `http://<osa-proxy-host>:<port>/api/swagger`
41+
- **Available operations:**
42+
- Clear cache by PURL
43+
- Clear cache by package type

docs/osa-proxy/config-caching.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
hide:
3+
- footer
4+
---
5+
6+
# Настройка Redis и кэширования
7+
8+
Для повышения производительности и снижения нагрузки на платформу CodeScoring поддерживается кэширование результатов работы политик (вердиктов [сервиса Judge](/on-premise/containers-description/)). Для работы кэширования требуется подключение к Redis.
9+
10+
!!! example "Настройки Redis и кэширования"
11+
12+
```yaml
13+
spring:
14+
data:
15+
redis:
16+
host: localhost
17+
port: 6379
18+
database: 0 # Номер базы данных (опционально)
19+
password: password # Опционально
20+
timeout: 2000ms
21+
22+
cache:
23+
judge:
24+
enabled: true # Включение кэширования (по умолчанию false)
25+
ttl: 24h # Время жизни записи в кэше
26+
refresh-after: 30m # Время, после которого запись считается устаревшей и требует обновления (но все еще может быть отдана из кэша)
27+
proactive-refresh-enabled: true # Включение проактивного (фонового) обновления кэша
28+
proactive-refresh-interval: 2h # Интервал запуска фонового обновления
29+
key-prefix: "cs:judge:" # Префикс для ключей в Redis
30+
```
31+
32+
!!! note "Особенности продления времени жизни (TTL) в кэше"
33+
34+
Проактивное обновление не продлевает TTL (время жизни) записи в кэше. TTL продлевается только при чтении данных из кэша реальными запросами пользователей. Это позволяет автоматически удалять из Redis редко запрашиваемые пакеты и хранить только востребованные данные.
35+
36+
## Swagger UI
37+
38+
OSA Proxy предоставляет Swagger UI для просмотра документации API и управления кэшем.
39+
40+
- **URL:** `http://<osa-proxy-host>:<port>/api/swagger`
41+
- **Доступные операции:**
42+
- Очистка кэша по PURL
43+
- Очистка кэша по типу пакета

docs/osa-proxy/config.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Configuration of **OSA Proxy** is done via the `application.yml` file:
158158
spring:
159159
http:
160160
codecs:
161-
max-in-memory-size: 50MB (this is the default setting, already included in the application; increase it if you encounter very large manifests)
161+
max-in-memory-size: 150MB (this is the default setting, already included in the application; increase it if you encounter very large manifests)
162162
```
163163

164164
## Retry policies and circuit breaker for platform requests

docs/osa-proxy/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ hide:
162162
spring:
163163
http:
164164
codecs:
165-
max-in-memory-size: 50MB (это настройка по умолчанию, уже включенная в приложение, увеличьте ее, если вы столкнулись с очень большими манифестами)
165+
max-in-memory-size: 150MB (это настройка по умолчанию, уже включенная в приложение, увеличьте ее, если вы столкнулись с очень большими манифестами)
166166
```
167167

168168
## Политики повторных попыток и circuit breaker для запросов к платформе:

docs/osa-proxy/index.en.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ OSA Proxy automatically modifies responses from original repositories:
5151
- Removes blocked versions from metadata;
5252
- Recalculates checksums of modified manifests to maintain the correct format.
5353

54+
### Policy results caching
55+
56+
To speed up request processing and reduce platform load, policy validation results (verdicts from [Judge service](/on-premise/containers-description.en/)) are cached in Redis. Background updates of outdated records are supported.
57+
5458
## Work modes
5559

5660
Package scanning behavior is controlled by the `work-mode` parameter. Depending on the selected value, the scanning, waiting, and blocking logic changes. The following modes are supported:

docs/osa-proxy/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ OSA Proxy автоматически модифицирует ответы от
5151
- удаляет заблокированные версии из метаданных;
5252
- пересчитывает контрольные суммы изменённых манифестов, чтобы сохранить корректность формата.
5353

54+
### Кэширование результатов проверки политик
55+
56+
Для ускорения обработки запросов и снижения нагрузки на платформу поддерживается кэширование результатов проверки политик (вердиктов [сервиса Judge](/on-premise/containers-description/) в Redis. Поддерживается фоновое обновление устаревших записей.
57+
5458
## Режимы работы
5559

5660
Поведение сканирования пакетов регулируется параметром `work-mode`. В зависимости от выбранного значения меняется логика обработки сканирования, ожидания и блокировки. Поддерживаются следующие режимы:

docs/osa-proxy/protocols.en.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,28 @@ This section contains data formats and response modification rules for each supp
110110
]
111111
}
112112
```
113+
114+
## Go
115+
116+
### Processed files
117+
118+
- Version list (`/@v/list`)
119+
- `.zip` — module archives
120+
121+
### Version list modifications
122+
123+
- Blocked versions are removed from the version list
124+
125+
## Debian
126+
127+
### Processed files
128+
129+
- `.deb` — package files
130+
131+
!!! warning "Debian scanning specifics"
132+
133+
For Debian, only package scanning is supported. Modification of manifests (`Packages` files) is not performed.
134+
113135
## Behavior in case of complete package blocking
114136

115137
In a scenario where all available versions of a requested package are blocked by security policies, OSA Proxy returns a message indicating that all versions are blocked.
@@ -139,4 +161,10 @@ curl http://localhost:8080/codescoring-npm/package_name
139161
Although the NuGet client might display the reason for blocking all packages in the console, a direct `curl` request also allows for status confirmation:
140162
```bash
141163
curl http://localhost:8080/codescoring-nuget/nuget-api/v3/registration5-gz-semver2/newtonsoft.json/index.json
164+
```
165+
166+
### Go
167+
168+
```bash
169+
curl http://localhost:8080/codescoring-go/module_name/@v/list
142170
```

docs/osa-proxy/protocols.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,28 @@ hide:
111111
]
112112
}
113113
```
114+
115+
## Go
116+
117+
### Обрабатываемые файлы
118+
119+
- Список версий (`/@v/list`)
120+
- `.zip` — архивы модулей
121+
122+
### Модификация списка версий
123+
124+
- Из списка версий удаляются заблокированные версии.
125+
126+
## Debian
127+
128+
### Обрабатываемые файлы
129+
130+
- `.deb` — файлы пакетов
131+
132+
!!! warning "Особенности сканирования Debian"
133+
134+
Для Debian поддерживается только сканирование пакетов. Модификация манифестов (файлов `Packages`) не производится.
135+
114136
## Поведение при полной блокировке пакета
115137

116138
В случае, когда все доступные версии запрашиваемого пакета заблокированы политиками безопасности, OSA Proxy возвращает сообщение о блокировке всех версий.
@@ -141,3 +163,9 @@ curl http://localhost:8080/codescoring-npm/имя_пакета
141163
```bash
142164
curl http://localhost:8080/codescoring-nuget/nuget-api/v3/registration5-gz-semver2/newtonsoft.json/index.json
143165
```
166+
167+
### Go
168+
169+
```bash
170+
curl http://localhost:8080/codescoring-go/имя_модуля/@v/list
171+
```

0 commit comments

Comments
 (0)