server
server
¶
Credential proxy — HTTP-over-Unix-socket reverse proxy with secret injection.
This module has zero terok imports. It is a self-contained security component: a standalone daemon that listens on a Unix socket, validates phantom tokens against a sqlite3 database, injects real credentials from the same database, and forwards requests to upstream API servers.
Task containers see only phantom API keys (worthless outside the proxy). Real secrets never enter the container filesystem or environment.
Startup::
terok-credential-proxy \
--socket-path /run/terok/credential-proxy.sock \
--db-path ~/.local/share/terok/proxy/credentials.db \
--routes-file ~/.local/share/terok/proxy/routes.json
Route config (JSON, generated by terok-agent from YAML registry)::
{
"claude": {
"upstream": "https://api.anthropic.com",
"auth_header": "Authorization",
"auth_prefix": "Bearer "
}
}
main()
¶
Parse CLI args and run the credential proxy.
Source code in src/terok_sandbox/credential_proxy/server.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | |