The bot service in docker-compose.yml builds from ./bot, but the agent code lived in 'ai procurement/' and ./bot was only a Windows junction on reza.g's machine (and was gitignored) — exactly as the team reported: 'bot/ was never committed — prod-v7's bot is un-buildable from the repo.' - junction removed; 'ai procurement/' renamed to 'bot/' via git mv (all 41 files keep their history as pure renames) - 'bot/' dropped from .gitignore (voice/ stays ignored — runtime voice notes; bot/.env stays ignored by bot/.gitignore) - compose needs no change: context: ./bot and ./bot/app now resolve to committed files - bot/INTEGRATION-REPORT.md added: full story (problem, root cause, git state, security note on the committed BALE_BOT_TOKEN / AI_API_KEY compose defaults, and usage instructions for the team) Verified: 41 renames staged with zero secret/cache files; voice/ and bot/.env still ignored.
19 lines
771 B
Diff
19 lines
771 B
Diff
diff --git a/backend/app/utils/security.py b/backend/app/utils/security.py
|
|
index a78c1cb..75e7349 100644
|
|
--- a/backend/app/utils/security.py
|
|
+++ b/backend/app/utils/security.py
|
|
@@ -7,7 +7,13 @@ def get_actor(request: Request) -> str | None:
|
|
|
|
This is the reserved placeholder from the contract — no authentication
|
|
or authorization is enforced yet.
|
|
+
|
|
+ Services acting on behalf of a user (the Bale bot) pass ``X-Actor-Id``
|
|
+ (users.id); it wins over the raw token so the audit trail shows the human.
|
|
"""
|
|
+ actor_id = request.headers.get("X-Actor-Id")
|
|
+ if actor_id:
|
|
+ return actor_id.strip()
|
|
auth = request.headers.get("Authorization")
|
|
if auth and auth.lower().startswith("bearer "):
|
|
return auth[7:].strip() or None
|