Secret Keys Become Application Data

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

Secret Keys Become Application Data

Bring your own key with Symfony 8.2 and Navi.

Interactive version — https://slide.darkwood.com/slides/secret-keys-become-application-data

Mathieu Ledru

November 27, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

31 slides
  1. Darkwood · BYOK · Symfony 8.2 · Navi SECRET KEYS

    BECOME APPLICATION DATA BYOK × Symfony 8.2 × Navi @matyo91
  2. The old model ANTHROPIC_API_KEY=... The secret belongs to the deployment.

    operator 01 | .env → deployment → application @matyo91
  3. Slide 3 · 1/2 · représentation statique Ownership What happens

    when the key belongs to the user? DEPLOYMENT .env static one credential boot-time configuration USER HTTP 02 | BYOK Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  4. Slide 3 · 2/2 · représentation statique Ownership What happens

    when the key belongs to the user? dynamic many credentials runtime application data .env is no longer the answer. 02 | BYOK Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  5. Slide 4 · 1/2 · représentation statique The experiment A

    secret now has a lifecycle User ↓ Symfony Form ↓ encrypt ↓ SQLite ciphertext ↓ decrypt ↓ Navi ↓ 03 | lifecycle Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  6. Slide 4 · 2/2 · représentation statique The experiment A

    secret now has a lifecycle Symfony AI ↓ Anthropic FOUR VERBS INPUT STORE USE OBSERVE 03 | lifecycle Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  7. Slide 5 · 1/2 · représentation statique Boundaries Keep every

    layer small RESPONSIBILITIES FORM — accept credential KEY MANAGEMENT — encrypt / decrypt DATABASE — persist ciphertext NAVI — orchestrate SYMFONY AI — talk to provider AiConnection ↓ 04 | layers Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  8. Slide 5 · 2/2 · représentation statique Boundaries Keep every

    layer small CredentialProtector::decrypt() ↓ WorkflowRunner ↓ TestAiConnectionAction ↓ Anthropic\Factory::createPlatform() Navi is a workflow shell, not an LLM SDK. 04 | layers Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  9. Slide 6 · 1/3 · représentation statique Symfony 8.2 ·

    experimental Symfony gets the missing primitive $ciphertext = $this->encrypter->encrypt( $this->keyId, $apiKey, ); $connection->setCiphertextBlob( base64_encode($ciphertext->blob), ); $connection->setKmsKeyId($ciphertext->keyId); 05 | KeyManagement Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  10. Slide 6 · 2/3 · représentation statique Symfony 8.2 ·

    experimental Symfony gets the missing primitive Ciphertext = blob + key id 8.2.x-dev · experimental direct encrypt · not envelope DEV / TEST Sodium TESTED 05 | KeyManagement Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  11. Slide 6 · 3/3 · représentation statique Symfony 8.2 ·

    experimental Symfony gets the missing primitive PROD AWS KMS CONFIGURED O NLY 05 | KeyManagement Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  12. Slide 7 · 1/2 · représentation statique HTTP input The

    form becomes a security boundary #[AsFormType] final class AiConnectionInput { #[FormField(PasswordType::class, [ 'always_empty' => true, 'attr' => ['autocomplete' => 'new-password'], ])] public ?string $apiKey = null; } 06 | form Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  13. Slide 7 · 2/2 · représentation statique HTTP input The

    form becomes a security boundary password field never redisplayed blank edit = keep ciphertext The key used to enter through dotenv. Now it enters through HTTP. 06 | form Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  14. Evidence What SQLite actually contains $ sqlite3 var/data.db \ "SELECT

    kms_key_id, length(ciphertext_blob), instr(ciphertext_blob, 'sk-ant') FROM ai_connection;" app-key|96|0 PLAINTEXT FOUND: 0 Evidence, not a cryptographic audit. 07 | ciphertext @matyo91
  15. Slide 9 · 1/3 · représentation statique Execution boundary Decrypt

    at the last responsible moment $apiKey = $this->credentials->decrypt($connection); try { $this->workflows->run( Context::fromArray([ 'connection_id' => $connection->getId(), 'provider' => $connection->getProvider(), 'model' => $connection->getModel(), ]), 08 | decrypt Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  16. Slide 9 · 2/3 · représentation statique Execution boundary Decrypt

    at the last responsible moment [new TestAiConnectionAction($apiKey, ...)], ); } finally { $apiKey = str_repeat("\0", strlen($apiKey)); } NAVI CONTEX T connection_id provider 08 | decrypt Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  17. Slide 9 · 3/3 · représentation statique Execution boundary Decrypt

    at the last responsible moment model SECRET NOT HERE context_has_secret: no 08 | decrypt Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  18. Slide 10 · 1/3 · représentation statique Live probe Failure

    is still evidence plaintext_in_ciphertext: no decrypt_matches: yes context_has_secret: no test_ok: false Anthropic: credit balance too low HOW FAR IT TRAVELLED 09 | probe Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  19. Slide 10 · 2/3 · représentation statique Live probe Failure

    is still evidence encrypt ✓ persist ✓ decrypt ✓ Navi ✓ Symfony AI ✓ Anthropic ✓ completion ✕ A billing error still tells us how far the request travelled. 09 | probe Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  20. Slide 10 · 3/3 · représentation statique Live probe Failure

    is still evidence Proves a usable credential reached the provider. Not completion, token usage, or a cost receipt. 09 | probe Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  21. Observability · Cost of a diff An AI credential has

    an economic blast radius API KEY MODEL ACCESS TOKENS $ STATUS cost = input × input_rate + output × output_rate + cache_write × rate + cache_read × rate per 1M tokens 10 | cost Implemented Not validated against a successful provider receipt 42 / 8 = SIMUL ATED COUNTS @matyo91
  22. Transport Provider ≠ endpoint ≠ credential storage REPORTED AZURE SHAPE

    Anthropic bridge │ ├── api.anthropic.com │ └── Azure AI compatible endpoint <resource>.services.ai.azure.com /anthropic/v1/messages AZURE BASEURL: WIRED, NOT CALLED Sometimes compatibility is configuration, not another abstraction. 11 | endpoint @matyo91
  23. Slide 13 · 1/3 · représentation statique Key custody Sodium

    locally, KMS outside SODIUM application ↓ encryption key ↓ ciphertext TESTED AWS KMS 12 | KMS Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  24. Slide 13 · 2/3 · représentation statique Key custody Sodium

    locally, KMS outside application ↓ KMS API ↓ master key outside app CONFIGURED · NOT CALLED External KMS improves key management. It does not make a compromised 12 | KMS Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  25. Slide 13 · 3/3 · représentation statique Key custody Sodium

    locally, KMS outside runtime safe. 12 | KMS Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  26. Slide 14 · 1/3 · représentation statique Scoreboard What actually

    ran VERIFIED container / Twig / YAML lint PHPUnit · 2 tests · 15 assertions Browser BYOK flow encrypted badge · blank key on edit invalid-key error SQLite plaintext search = 0 Live Anthropic reached 13 | evidence Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  27. Slide 14 · 2/3 · représentation statique Scoreboard What actually

    ran billing error NOT VERIFIED AWS KMS call Azure Anthropic call successful completion real token receipt provider-validated cost STATUSES 13 | evidence Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  28. Slide 14 · 3/3 · représentation statique Scoreboard What actually

    ran implemented · configured tested · verified 13 | evidence Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data @matyo91
  29. Slide 15 · 1/3 · représentation statique Ownership is the

    architecture ANTHROPIC_API_KEY=... user ↓ input ↓ encryption ↓ persistence ↓ execution @matyo91 Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data
  30. Slide 15 · 2/3 · représentation statique ↓ observability ↓

    rotation .env is enough when the secret belongs to the deployment. Once it belongs to a user, it needs an application lifecycle. KeyManagement protect it Navi orchestrate it Symfony AI use it → → → @matyo91 Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data
  31. Slide 15 · 3/3 · représentation statique Each layer can

    stay small. @matyo91 Version interactive : https://slide.darkwood.com/slides/secret-keys-become-application-data

More Decks by Mathieu Ledru

Other Decks in Programming