feat(request): add service accounts and unified authorization

This commit is contained in:
2026-08-11 11:16:38 +03:00
parent 51f01300c3
commit 4e7dc451ac
22 changed files with 4947 additions and 19 deletions
@@ -0,0 +1,691 @@
# TT-008 — Service Accounts Architecture Decision
# TT-008 — Архитектурное решение: Service Accounts
**Status / Статус:** APPROVED ARCHITECTURE / АРХИТЕКТУРА СОГЛАСОВАНА
**Version / Версия:** 1.0
**Date / Дата:** 2026-08-10
---
# РУССКАЯ ВЕРСИЯ
## 1. Назначение
TT-008 фиксирует согласованную архитектурную модель Service Accounts и корпоративного Vendor Break-Glass Administrative Recovery.
Документ является архитектурным решением. Реализация начинается только после отдельного Source Inspection.
## 2. Архитектурные инварианты
1. Module владеет собственными permissions и authorization policy.
2. Module должен полноценно работать без Platform.
3. Local Admin является штатным владельцем административной authority Module.
4. Platform не владеет Module-specific authorization.
5. Platform не изменяет Module DB напрямую.
## 3. Service Account
### 3.1 Identity model
Service Account — отдельный тип `Principal`, наравне с User, но не User.
Концептуально:
```text
Principal
├── User
└── ServiceAccount
```
Service Account является **Module-owned entity**.
### 3.2 Ownership
Module отвечает за:
- создание;
- lifecycle;
- credentials;
- локальную регистрацию;
- role assignment;
- permission assignment;
- authentication/authorization.
Platform не является owner Service Account.
### 3.3 Creation
Service Account создаёт Local Admin внутри Module.
Одинаковая модель:
```text
Platform Managed → Module creates
Standalone → Module creates
```
### 3.4 Scope
Service Account принадлежит одному Module.
Cross-module Service Account не входит в TT-008 и потребует отдельного архитектурного решения.
### 3.5 Authorization
Создание Service Account не выдаёт ему permissions.
```text
Service Account
↓
local registration
↓
role assignment
↓
permission assignment
↓
effective policy
```
Authorization выполняется Module.
Service Account может иметь несколько ролей в соответствии с общей User → Role → Permission моделью.
Service Account без роли допустим; effective policy в этом случае пустая.
## 4. Credentials
Конкретный credential protocol пока не фиксируется в TT-008.
Архитектурные требования:
- credential должен быть пригоден для service-to-service authentication;
- секрет не должен быть повторно показан после создания;
- при утрате секрета выполняется rotation;
- credential должен поддерживать revocation;
- credential validation должна работать локально в Module;
- отсутствие Platform не должно автоматически ломать уже выданный credential.
Конкретный выбор token/key model и криптографии — отдельное решение после Source Inspection.
## 5. Lifecycle
Минимальные состояния:
```text
CREATED → ACTIVE → DISABLED
│
└──→ REVOKED
```
Смысл:
- `CREATED` — identity создана, но ещё не активирована;
- `ACTIVE` — credential и authorization могут использоваться;
- `DISABLED` — временно запрещено использование, может быть снова активировано;
- `REVOKED` — identity/credential окончательно отозваны и не должны возвращаться в рабочее состояние.
Физическое удаление Service Account не является штатным способом lifecycle management.
## 6. Local Admin
Local Admin может:
- create;
- enable;
- disable;
- rotate credentials;
- revoke;
- назначать/изменять роли;
- управлять authorization в пределах Module policy.
Local Admin не получает полномочий Vendor Break-Glass автоматически.
## 7. Platform Management Boundary
Platform может предоставлять management/observation capabilities:
- status;
- metadata;
- monitoring;
- audit visibility;
- lifecycle/rotation requests, если это предусмотрено Module contract.
Platform не может:
- напрямую создавать Service Account в DB;
- напрямую менять Module roles;
- напрямую менять Module permissions;
- напрямую изменять Module authorization policy.
Все management operations проходят через Module API/contract.
## 8. Platform Outage
Service Account должен продолжать работать при временной недоступности Platform, если его локальный credential и локальная policy остаются действительными.
Это означает:
```text
Platform unavailable
↓
Module authentication
↓
Module authorization
↓
Service continues
```
Полная Offline Authz / Policy Distribution не входит в TT-008 и будет отдельной задачей.
# 9. Vendor Break-Glass Administrative Recovery
## 9.1 Назначение
Break-Glass предназначен для ситуации:
> **потеряна управляемость штатными механизмами администрирования.**
Примеры:
- потерян/заблокирован последний Local Admin;
- сломано сопоставление LDAP/AD с административной моделью;
- административная конфигурация повреждена;
- штатный механизм авторизации не позволяет получить административный доступ;
- иная ситуация, при которой заказчик не может восстановить управление штатными средствами.
Break-Glass не предназначен для обхода штатной безопасности.
## 9.2 Availability
Vendor Break-Glass является capability **Corporate Platform**.
В Standalone/Standard он не предоставляется.
LDAP/AD остаётся штатным механизмом идентификации и обычной административной работы.
## 9.3 Workflow
```text
Customer
│
│ official recovery request
▼
Vendor
│
│ validates request / authorization
▼
Vendor Authorization
│
▼
Platform
│
│ recovery workflow
▼
Module
│
▼
Emergency Administration
│
▼
restore normal administrative chain
```
## 9.4 Emergency Authority
Emergency Administration **не является обычной RBAC role**.
Это временная Vendor-authorized security authority, ограниченная:
- Recovery Policy;
- installation;
- Module;
- scope;
- TTL.
Она предназначена только для восстановления штатной административной управляемости.
## 9.5 Allowed operations
Emergency Administration может выполнять security-recovery operations, необходимые для восстановления штатной цепочки:
- создать/восстановить Local Admin;
- активировать/деактивировать административный identity;
- восстановить штатную административную role assignment;
- выполнить credential rotation/revocation;
- восстановить необходимые security mappings;
- отключить скомпрометированный административный identity.
Emergency Administration не получает обычные бизнес-permissions Module.
## 9.6 Forbidden operations
Emergency Administration не должна позволять:
- читать/изменять бизнес-данные;
- менять Module permission catalog;
- произвольно выдавать себе Module permissions;
- изменять сам Break-Glass mechanism;
- отключать или удалять audit;
- превращаться в постоянный Vendor access.
## 9.7 Expiration
Emergency Authority имеет TTL.
После истечения TTL она автоматически перестаёт быть действующей.
Она не должна превращаться в постоянный административный аккаунт.
## 9.8 Audit
История Break-Glass обязательна.
Минимально фиксируются:
- request ID;
- installation;
- Module;
- initiator;
- approval;
- reason;
- issued_at;
- expires_at;
- authorization ID;
- result.
Дальнейшие действия Emergency Administration проходят через обычный Module audit.
## 9.9 Database tampering boundary
Security-critical validity не должна зависеть только от mutable boolean/status поля в БД.
В дальнейшем authorization artifact должен позволять Module криптографически подтвердить легитимность Vendor authorization.
Принцип:
> **Database stores state and audit; authorization proof establishes authority.**
Конкретная криптография не входит в текущий этап.
## 10. LDAP/AD
LDAP/AD не конкурирует с Break-Glass.
LDAP/AD — штатный механизм authentication/identity.
Break-Glass применяется только когда штатная административная цепочка потеряла управляемость.
Если LDAP/AD и штатное administrative mapping работают нормально, Break-Glass не нужен.
## 11. Commercial positioning
В архитектуре не фиксируется идея «платного root-доступа».
Break-Glass — capability корпоративной редакции Platform.
Он позиционируется как:
> **Vendor-assisted Administrative Recovery**
а не как backdoor/root access.
## 12. Final architectural principles
1. Service Account — отдельный Principal.
2. Service Account — Module-owned.
3. Local Admin создаёт Service Account.
4. Service Account принадлежит одному Module.
5. Создание Service Account не выдаёт permissions.
6. Module является authority для Service Account authorization.
7. Platform управляет только через Module contract.
8. Service Account может работать без временной доступности Platform.
9. Credentials показываются только при создании.
10. Утерянный credential требует rotation.
11. Lifecycle: CREATED / ACTIVE / DISABLED / REVOKED.
12. Break-Glass — capability Corporate Platform.
13. Break-Glass применяется только при потере управляемости штатными механизмами.
14. Emergency Administration — временная security authority, а не обычная RBAC role.
15. Emergency Administration имеет ограниченный scope и TTL.
16. Emergency Administration восстанавливает штатную administrative chain.
17. Emergency Administration не получает бизнес-permissions.
18. Break-Glass полностью auditable.
19. Security-critical authority не должна зависеть только от mutable DB state.
20. Конкретная криптография/token protocol утверждается отдельно.
## 13. Status
**APPROVED ARCHITECTURE**
Следующий этап: **TT-008 Source Inspection**.
---
# ENGLISH VERSION
## 1. Purpose
TT-008 defines the approved architecture for Service Accounts and Corporate Vendor Break-Glass Administrative Recovery.
This is an architecture decision. Implementation starts only after a separate Source Inspection.
## 2. Architectural invariants
1. Module owns its permissions and authorization policy.
2. Module must fully operate without Platform.
3. Local Admin owns normal Module administrative authority.
4. Platform does not own Module-specific authorization.
5. Platform never modifies Module DB directly.
## 3. Service Account
### 3.1 Identity model
Service Account is a separate `Principal` type alongside User.
```text
Principal
├── User
└── ServiceAccount
```
Service Account is a **Module-owned entity**.
### 3.2 Ownership
The Module owns:
- creation;
- lifecycle;
- credentials;
- local registration;
- role assignment;
- permission assignment;
- authentication/authorization.
Platform is not the owner.
### 3.3 Creation
Local Admin creates Service Accounts inside the Module.
```text
Platform Managed → Module creates
Standalone → Module creates
```
### 3.4 Scope
A Service Account belongs to exactly one Module.
Cross-module Service Accounts require a separate architecture decision.
### 3.5 Authorization
Creating a Service Account does not grant permissions.
```text
Service Account
↓
local registration
↓
role assignment
↓
permission assignment
↓
effective policy
```
Authorization is performed by the Module.
Multiple roles are allowed consistently with User → Role → Permission.
A Service Account without a role is allowed; its effective policy is empty.
## 4. Credentials
The exact credential protocol is intentionally not fixed yet.
Requirements:
- suitable for service-to-service authentication;
- secret shown only at creation;
- lost secret requires rotation;
- revocation supported;
- credential validation performed locally by Module;
- temporary Platform unavailability must not automatically invalidate an otherwise valid credential.
Exact token/key model and cryptography are separate decisions.
## 5. Lifecycle
Minimum states:
```text
CREATED → ACTIVE → DISABLED
│
└──→ REVOKED
```
Meaning:
- `CREATED` — identity exists but is not active;
- `ACTIVE` — credential and authorization may be used;
- `DISABLED` — temporarily unusable and may be re-enabled;
- `REVOKED` — permanently revoked and not expected to return to service.
Physical deletion is not the normal lifecycle mechanism.
## 6. Local Admin
Local Admin may:
- create;
- enable;
- disable;
- rotate credentials;
- revoke;
- assign/change roles;
- manage authorization within Module policy.
Local Admin does not automatically receive Vendor Break-Glass authority.
## 7. Platform Management Boundary
Platform may provide management/observation capabilities such as:
- status;
- metadata;
- monitoring;
- audit visibility;
- lifecycle/rotation requests where supported by the Module contract.
Platform must not:
- create Service Accounts directly in the DB;
- directly change Module roles;
- directly change Module permissions;
- directly modify Module authorization policy.
Management operations use the Module API/contract.
## 8. Platform Outage
Service Account must continue to work during temporary Platform unavailability if its local credential and local policy remain valid.
Full Offline Authz / Policy Distribution is outside TT-008.
# 9. Vendor Break-Glass Administrative Recovery
## 9.1 Purpose
Break-Glass exists when:
> **normal administrative management has become unavailable through the standard mechanisms.**
Examples:
- last Local Admin is lost/locked;
- LDAP/AD administrative mapping is broken;
- administrative configuration is damaged;
- normal authorization cannot provide administrative access;
- another condition prevents recovery through standard mechanisms.
Break-Glass is not intended to bypass normal security.
## 9.2 Availability
Vendor Break-Glass is a **Corporate Platform capability**.
It is not provided in Standalone/Standard.
LDAP/AD remains the normal identity/authentication mechanism.
## 9.3 Workflow
```text
Customer
│
│ official recovery request
▼
Vendor
│
│ validates request / authorization
▼
Vendor Authorization
│
▼
Platform
│
│ recovery workflow
▼
Module
│
▼
Emergency Administration
│
▼
restore normal administrative chain
```
## 9.4 Emergency Authority
Emergency Administration is **not a normal RBAC role**.
It is temporary Vendor-authorized security authority limited by:
- Recovery Policy;
- installation;
- Module;
- scope;
- TTL.
Its sole purpose is restoring normal administrative manageability.
## 9.5 Allowed operations
Emergency Administration may perform security-recovery operations required to restore the normal administrative chain:
- create/restore Local Admin;
- activate/deactivate administrative identity;
- restore normal administrative role assignment;
- rotate/revoke credentials;
- restore required security mappings;
- disable compromised administrative identities.
It does not receive normal Module business permissions.
## 9.6 Forbidden operations
Emergency Administration must not allow:
- reading/modifying business data;
- changing the Module permission catalog;
- granting arbitrary Module permissions to itself;
- modifying the Break-Glass mechanism;
- disabling/deleting audit;
- becoming permanent Vendor access.
## 9.7 Expiration
Emergency Authority has a TTL.
After expiration it automatically ceases to be valid.
It must not become a permanent administrative account.
## 9.8 Audit
Break-Glass activity is fully auditable.
At minimum record:
- request ID;
- installation;
- Module;
- initiator;
- approval;
- reason;
- issued_at;
- expires_at;
- authorization ID;
- result.
Actions performed under Emergency Administration are recorded by the normal Module audit system.
## 9.9 Database tampering boundary
Security-critical validity must not depend solely on a mutable DB boolean/status field.
The future authorization artifact must allow the Module to cryptographically verify legitimate Vendor authorization.
Principle:
> **Database stores state and audit; authorization proof establishes authority.**
Exact cryptography is outside the current stage.
## 10. LDAP/AD
LDAP/AD does not compete with Break-Glass.
LDAP/AD is the normal identity/authentication mechanism.
Break-Glass is used only when normal administrative management has become unavailable.
If LDAP/AD and normal administrative mapping work correctly, Break-Glass is unnecessary.
## 11. Commercial positioning
The architecture does not define Break-Glass as paid root access.
It is a capability of the Corporate Platform edition.
It is positioned as:
> **Vendor-assisted Administrative Recovery**
not as backdoor/root access.
## 12. Final architectural principles
1. Service Account is a separate Principal.
2. Service Account is Module-owned.
3. Local Admin creates Service Accounts.
4. Service Account belongs to one Module.
5. Creating a Service Account does not grant permissions.
6. Module owns Service Account authorization.
7. Platform manages through the Module contract.
8. Service Account can continue operating during temporary Platform unavailability.
9. Credentials are shown only at creation.
10. Lost credentials require rotation.
11. Lifecycle: CREATED / ACTIVE / DISABLED / REVOKED.
12. Break-Glass is a Corporate Platform capability.
13. Break-Glass is used only when normal administrative manageability is lost.
14. Emergency Administration is temporary security authority, not a normal RBAC role.
15. Emergency Administration has limited scope and TTL.
16. Emergency Administration restores the normal administrative chain.
17. Emergency Administration does not receive business permissions.
18. Break-Glass is fully auditable.
19. Security-critical authority must not depend only on mutable DB state.
20. Exact cryptography/token protocol is approved separately.
## 13. Status
**APPROVED ARCHITECTURE**
Next stage: **TT-008 Source Inspection**.