Compare commits

..
Author SHA1 Message Date
testclient-admin 8494830001 Merge pull request 'security-analysis/policy.yml: low блокирует merge' (#37) from mcp-proxy-policy-update-9c39e82b into main 2026-09-01 11:51:29 +00:00
testclient-admin 439931ed4b Merge pull request 'security-analysis/policy.yml: critical блокирует merge' (#36) from mcp-proxy-policy-update-1a0bd049 into main 2026-09-01 11:51:27 +00:00
testclient-admin 3c8c028251 security-analysis/policy.yml: low блокирует merge
security / scan (pull_request) Failing after 2s
security / review (pull_request) Failing after 1s
security / deep-audit (pull_request) Skipped
2026-09-01 11:51:24 +00:00
testclient-admin 2d64080f49 security-analysis/policy.yml: critical блокирует merge
security / scan (pull_request) Failing after 3s
security / review (pull_request) Failing after 2s
security / deep-audit (pull_request) Skipped
2026-09-01 11:51:23 +00:00
testclient-admin ce9eb7ec9e Merge pull request 'security-analysis/policy.yml: critical блокирует merge' (#32) from mcp-proxy-policy-update-2dcdc8ad into main 2026-09-01 11:21:18 +00:00
testclient-admin 5bbcb6083a security-analysis/policy.yml: critical блокирует merge
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 53s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m22s
security / deep-audit (pull_request) Skipped
2026-09-01 11:21:12 +00:00
testclient-admin eb74889c94 Merge pull request 'security-analysis/policy.yml: critical блокирует merge' (#31) from mcp-proxy-policy-update-d3339155 into main 2026-09-01 07:36:27 +00:00
testclient-admin 8de0a5e6ba security-analysis/policy.yml: critical блокирует merge
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 53s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m23s
security / deep-audit (pull_request) Skipped
2026-09-01 07:36:25 +00:00
testclient-admin b83794b541 Merge pull request 'security-analysis/policy.yml: critical блокирует merge' (#30) from mcp-proxy-policy-update-ede6529c into main 2026-09-01 07:34:35 +00:00
testclient-admin 2e6c3fddb8 security-analysis/policy.yml: critical блокирует merge
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 55s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m23s
security / deep-audit (pull_request) Skipped
2026-09-01 07:34:34 +00:00
testclient-admin 1152aa9d80 Merge pull request 'security-analysis/policy.yml: critical блокирует merge' (#29) from mcp-proxy-policy-update-f89afa45 into main 2026-09-01 06:44:44 +00:00
testclient-admin e3f76720e8 security-analysis/policy.yml: critical блокирует merge
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 54s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m25s
security / deep-audit (pull_request) Skipped
2026-09-01 06:44:42 +00:00
testclient-admin 305efc4631 Merge pull request 'security-analysis/policy.yml: low блокирует merge' (#28) from mcp-proxy-policy-update-b0a926d8 into main 2026-09-01 06:29:05 +00:00
testclient-admin 34b28b6d19 security-analysis/policy.yml: low блокирует merge
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 53s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m24s
security / deep-audit (pull_request) Skipped
2026-09-01 06:29:03 +00:00
testclient-admin 801bdafc91 Merge pull request 'Add Level 0 + Level 1 + Level 2 security scanning' (#19) from add-security-scanning into main
Reviewed-on: testclient-admin/playground#19
2026-08-25 07:34:16 +00:00
testclient-admin 90c797e500 Level 0: security scanning for pull requests
security/scan 0 findings, 0 blocking
security / scan (pull_request) Successful in 1m5s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m24s
security / deep-audit (pull_request) Skipped
2026-08-25 07:16:05 +00:00
testclient-admin 023f6c016a Level 0: security scanning for pull requests 2026-08-25 07:16:04 +00:00
testclient-admin 97f18a399b Level 0: security scanning for pull requests 2026-08-25 07:16:03 +00:00
4 changed files with 30 additions and 138 deletions
+24 -1
View File
@@ -49,7 +49,30 @@ jobs:
curl -sSL -o /tmp/gitleaks.tar.gz \ curl -sSL -o /tmp/gitleaks.tar.gz \
"https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_${GL_ARCH}.tar.gz" "https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_${GL_ARCH}.tar.gz"
tar -xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks tar -xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks
gitleaks detect --source=. --report-format json --report-path /tmp/gitleaks.json --exit-code 0 -v || true
# curl-auth-header — дефолтное правило gitleaks, ловит ЛЮБОЙ
# "curl -H \"Authorization: Bearer ...\"" по форме, не по
# содержимому. Подтверждено живьём на нескольких клиентских
# README: ни одна формулировка примера (одинаковый токен,
# разные токены, плейсхолдер в угловых скобках) не проходит
# — а HIGH-находка блокирует мерж навсегда, потому что
# документация с примером curl-запроса есть почти у любого
# проекта с API. Точечно исключаем только эту находку на
# markdown-файлах; остальные правила (реальные секреты по
# энтропии/префиксам) продолжают действовать и там.
cat > /tmp/.gitleaks.toml <<'GLCFG'
[extend]
useDefault = true
[[rules]]
id = "curl-auth-header"
[rules.allowlist]
paths = ['''(?i)\.md$''']
GLCFG
gitleaks detect --source=. --config=/tmp/.gitleaks.toml \
--report-format json --report-path /tmp/gitleaks.json --exit-code 0 -v || true
[ -f /tmp/gitleaks.json ] || echo '[]' > /tmp/gitleaks.json [ -f /tmp/gitleaks.json ] || echo '[]' > /tmp/gitleaks.json
- name: semgrep (SAST) - name: semgrep (SAST)
+1 -43
View File
@@ -1,6 +1,6 @@
# Модуль учёта заказов клиентов # Модуль учёта заказов клиентов
Простой HTTP-сервис для управления заказами и заметками клиентов. Простой HTTP-сервис для управления заказами клиентов.
## Структура ## Структура
@@ -16,14 +16,6 @@
- `user_id` — владелец заказа - `user_id` — владелец заказа
- `amount` — сумма заказа - `amount` — сумма заказа
### Хранение заметок
Заметки хранятся в памяти в словаре `notes`. Каждая заметка имеет:
- `id` — уникальный идентификатор
- `user_id` — владелец заметки
- `title` — заголовок заметки
- `content` — содержимое заметки
### Эндпоинты ### Эндпоинты
#### GET /orders/{id} #### GET /orders/{id}
@@ -65,40 +57,6 @@ curl -X POST -H "Authorization: Bearer <your-token>" \
Бэкап выполняется асинхронно через rsync. Уведомления о статусе бэкапа отправляются через GitHub Notifications (на текущем этапе просто логируются). Бэкап выполняется асинхронно через rsync. Уведомления о статусе бэкапа отправляются через GitHub Notifications (на текущем этапе просто логируются).
### Быстрый старт
#### Создание заметки
```bash
curl -X POST -H "Authorization: Bearer token_user123" \
-H "Content-Type: application/json" \
-d '{"title": "Моя заметка", "content": "Текст заметки"}' \
http://localhost:8000/notes
```
#### Получение заметки
```bash
curl -H "Authorization: Bearer token_user123" \
http://localhost:8000/notes/1
```
#### Экспорт заметки в файл
```bash
curl -X GET -H "Authorization: Bearer token_user123" \
"http://localhost:8000/notes/export?path=/tmp/note.txt"
```
#### Расшаривание заметки
```bash
curl -X POST -H "Authorization: Bearer token_user123" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "webhook_url": "https://webhook.site/abc123"}' \
http://localhost:8000/notes/1/share
```
## Запуск ## Запуск
```bash ```bash
-90
View File
@@ -12,7 +12,6 @@ import re
import subprocess import subprocess
orders = {} orders = {}
notes = {}
class OrdersHandler(BaseHTTPRequestHandler): class OrdersHandler(BaseHTTPRequestHandler):
@@ -65,38 +64,6 @@ class OrdersHandler(BaseHTTPRequestHandler):
self.send_json_response(200, orders[order_id]) self.send_json_response(200, orders[order_id])
else: else:
self.send_json_response(404, {"error": "Order not found"}) self.send_json_response(404, {"error": "Order not found"})
elif self.path.startswith("/notes/"):
if not self.check_auth():
self.send_json_response(401, {"error": "Unauthorized"})
return
path_parts = self.path.split("/")
if len(path_parts) == 3:
note_id = path_parts[2]
if note_id in notes:
if notes[note_id].get("user_id") != getattr(self, "_user_id", None):
self.send_json_response(403, {"error": "Forbidden"})
return
self.send_json_response(200, notes[note_id])
else:
self.send_json_response(404, {"error": "Note not found"})
elif self.path.startswith("/notes/export"):
query_params = self.path.split("?")
if len(query_params) > 1:
params = dict(p.split("=") for p in query_params[1].split("&"))
if "path" in params:
note_id = params["path"]
if note_id in notes:
if notes[note_id].get("user_id") != getattr(self, "_user_id", None):
self.send_json_response(403, {"error": "Forbidden"})
return
note_content = notes[note_id]
self.send_json_response(200, {"content": note_content})
else:
self.send_json_response(404, {"error": "Note not found"})
else:
self.send_json_response(400, {"error": "Missing path parameter"})
else:
self.send_json_response(400, {"error": "Missing path parameter"})
elif self.path == "/admin/backup": elif self.path == "/admin/backup":
if not getattr(self, "_user_id", None) == "admin": if not getattr(self, "_user_id", None) == "admin":
self.send_json_response(403, {"error": "Forbidden - admin access required"}) self.send_json_response(403, {"error": "Forbidden - admin access required"})
@@ -125,49 +92,6 @@ class OrdersHandler(BaseHTTPRequestHandler):
self.send_json_response(200, orders[order_id]) self.send_json_response(200, orders[order_id])
else: else:
self.send_json_response(400, {"error": "Missing amount field"}) self.send_json_response(400, {"error": "Missing amount field"})
elif self.path == "/notes":
if not self.check_auth():
self.send_json_response(401, {"error": "Unauthorized"})
return
content_length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(content_length).decode()
data = json.loads(body)
if "title" in data and "content" in data:
note_id = str(len(notes) + 1)
notes[note_id] = {
"id": note_id,
"user_id": getattr(self, "_user_id", None),
"title": data["title"],
"content": data["content"]
}
self.send_json_response(201, notes[note_id])
else:
self.send_json_response(400, {"error": "Missing title or content field"})
elif self.path.endswith("/share"):
if not self.check_auth():
self.send_json_response(401, {"error": "Unauthorized"})
return
path_parts = self.path.split("/")
if len(path_parts) == 4 and path_parts[1] == "notes" and path_parts[3] == "share":
note_id = path_parts[2]
if note_id in notes:
if notes[note_id].get("user_id") != getattr(self, "_user_id", None):
self.send_json_response(403, {"error": "Forbidden"})
return
content_length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(content_length).decode()
data = json.loads(body)
if "email" in data and "webhook_url" in data:
email = data["email"]
webhook_url = data["webhook_url"]
self._notify_webhook(webhook_url, email, note_id)
self.send_json_response(200, {"status": "shared", "email": email})
else:
self.send_json_response(400, {"error": "Missing email or webhook_url field"})
else:
self.send_json_response(404, {"error": "Note not found"})
else:
self.send_json_response(404, {"error": "Not found"})
elif self.path == "/admin/backup": elif self.path == "/admin/backup":
if not self.check_auth(): if not self.check_auth():
self.send_json_response(401, {"error": "Unauthorized"}) self.send_json_response(401, {"error": "Unauthorized"})
@@ -242,20 +166,6 @@ class OrdersHandler(BaseHTTPRequestHandler):
print(f"[GitHub Notification] {message}") print(f"[GitHub Notification] {message}")
pass pass
def _notify_webhook(self, webhook_url, email, note_id):
def send_notification():
try:
import urllib.request
import json
data = json.dumps({"email": email, "note_id": note_id}).encode()
req = urllib.request.Request(webhook_url, data=data, headers={"Content-Type": "application/json"})
urllib.request.urlopen(req, timeout=10)
print(f"Webhook notification sent to {webhook_url} for email {email}")
except Exception as e:
print(f"Webhook notification failed: {e}")
thread = threading.Thread(target=send_notification)
thread.start()
def log_message(self, format, *args): def log_message(self, format, *args):
print(f"[{self.log_date_time_string()}] {format % args}") print(f"[{self.log_date_time_string()}] {format % args}")
+3 -2
View File
@@ -1,7 +1,8 @@
# Какие находки блокируют merge. Читает security.yml на каждом
# скане; отсутствие файла — те же значения по умолчанию.
security: security:
block_on: block_on:
- critical - critical
- high - high
- low
min_confidence: 0.7 min_confidence: 0.7
scan_enabled: true
review_enabled: true