René's URL Explorer Experiment


Title: [llm-config] how to encrypt a per-user API key at rest, with no new infrastructure · Issue #438 · regybean/Trellis · GitHub

Open Graph Title: [llm-config] how to encrypt a per-user API key at rest, with no new infrastructure · Issue #438 · regybean/Trellis

X Title: [llm-config] how to encrypt a per-user API key at rest, with no new infrastructure · Issue #438 · regybean/Trellis

Description: Question How should a per-user API key be encrypted at rest, in this stack, with no new infrastructure? Settled: app-level envelope encryption, AES-256-GCM, master key supplied via env, ciphertext in Postgres. Not KMS, not pgcrypto. Noth...

Open Graph Description: Question How should a per-user API key be encrypted at rest, in this stack, with no new infrastructure? Settled: app-level envelope encryption, AES-256-GCM, master key supplied via env, ciphertext ...

X Description: Question How should a per-user API key be encrypted at rest, in this stack, with no new infrastructure? Settled: app-level envelope encryption, AES-256-GCM, master key supplied via env, ciphertext ...

Opengraph URL: https://github.com/regybean/Trellis/issues/438

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[llm-config] how to encrypt a per-user API key at rest, with no new infrastructure","articleBody":"## Question\n\nHow should a per-user API key be encrypted at rest, in this stack, with no new infrastructure?\n\nSettled: app-level envelope encryption, AES-256-GCM, master key supplied via env, ciphertext in Postgres. Not KMS, not `pgcrypto`. Nothing in this repo does crypto today — `tooling/secrets-sync` is dev-env plumbing, not a runtime primitive.\n\nFind:\n\n- **Node's built-in `crypto` versus a library.** Whether `node:crypto` covers AES-256-GCM envelope encryption cleanly enough to avoid a dependency, and what a maintained library buys. The repo prefers standard libraries over custom solutions, so the bar for hand-rolling is high — but so is the bar for taking a dependency on crypto code.\n- **Envelope structure.** Master key → data key → ciphertext, versus encrypting directly under a key derived from the master. What each costs at rotation time.\n- **The stored value.** One `bytea`/`text` column or several (ciphertext, IV, auth tag, key version). What a key-version field buys before rotation is specified.\n- **Master key handling.** Format and length, how it arrives through `@acme/env` as a secret with no profile value, and what happens on a run that has no key — the repo's `secretsOnly` pattern relaxes secrets on runs that cannot supply one, which must not silently disable encryption.\n- **Tests.** Backend suites self-provision containers and never mock env (ADR 0014). How a test gets a real master key without one being committed.\n- **Runtime portability.** Must work under Node on Next.js and under Nitro for the TanStack apps. Flag anything Web Crypto-only or Node-only that would break one of them.\n\nPrimary sources: Node docs, the library's own docs, OWASP guidance on key storage. Post the findings as a comment on this ticket and close it.\n","author":{"url":"https://github.com/regybean","@type":"Person","name":"regybean"},"datePublished":"2026-09-24T15:16:50Z","url":"https://github.com/regybean/Trellis/issues/438"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:182c2a57-500c-5191-30ad-6660824e0667
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC1BA:1C7D35:18884F8:20B6E42:6AED7960
html-safe-noncefe660177db617336c945d0f2142bd92c46fe33100fe644e4d9deb7d9bd6f2b9a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUJBOjFDN0QzNToxODg4NEY4OjIwQjZFNDI6NkFFRDc5NjAiLCJ2aXNpdG9yX2lkIjoiNDg2MjgzODI0ODY0OTM1NzY2NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace5abe0091e9124594998a3e8c10fc73030b844660075e80b3dc74794773cf31f
hovercard-subject-tagissue:5570512309
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/regybean/Trellis/438/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3ad70d7eb1b3de776ba45e75a49860865b36c3b1f1f76353707a1ead7e00f9de/regybean/Trellis/issues/438
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3ad70d7eb1b3de776ba45e75a49860865b36c3b1f1f76353707a1ead7e00f9de/regybean/Trellis/issues/438
og:image:altQuestion How should a per-user API key be encrypted at rest, in this stack, with no new infrastructure? Settled: app-level envelope encryption, AES-256-GCM, master key supplied via env, ciphertext ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameregybean
hostnamegithub.com
expected-hostnamegithub.com
None56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11
turbo-cache-controlno-preview
go-importgithub.com/regybean/Trellis git https://github.com/regybean/Trellis.git
octolytics-dimension-user_id72984305
octolytics-dimension-user_loginregybean
octolytics-dimension-repository_id1268736093
octolytics-dimension-repository_nworegybean/Trellis
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1268736093
octolytics-dimension-repository_network_root_nworegybean/Trellis
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/regybean/Trellis/issues/438#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fregybean%2FTrellis%2Fissues%2F438
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fregybean%2FTrellis%2Fissues%2F438
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=regybean%2FTrellis
Reloadhttps://github.com/regybean/Trellis/issues/438
Reloadhttps://github.com/regybean/Trellis/issues/438
Reloadhttps://github.com/regybean/Trellis/issues/438
regybeanhttps://github.com/regybean
Trellishttps://github.com/regybean/Trellis
Codehttps://github.com/regybean/Trellis
Issues28 (28)https://github.com/regybean/Trellis/issues
Pull requestshttps://github.com/regybean/Trellis/pulls
Actionshttps://github.com/regybean/Trellis/actions
Projectshttps://github.com/regybean/Trellis/projects
Security and qualityhttps://github.com/regybean/Trellis/security
Insightshttps://github.com/regybean/Trellis/pulse
https://github.com/regybean/Trellis
New issuehttps://github.com/login?return_to=https://github.com/regybean/Trellis/issues/438
New issuehttps://github.com/login?return_to=https://github.com/regybean/Trellis/issues/438
[llm-config] how to encrypt a per-user API key at rest, with no new infrastructurehttps://github.com/regybean/Trellis/issues/438#top
https://github.com/regybean
wayfinder:researchhttps://github.com/regybean/Trellis/issues?q=state%3Aopen%20label%3A%22wayfinder%3Aresearch%22
https://github.com/regybean
regybeanhttps://github.com/regybean
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#issue-5570512309
regybeanhttps://github.com/regybean
wayfinder:researchhttps://github.com/regybean/Trellis/issues?q=state%3Aopen%20label%3A%22wayfinder%3Aresearch%22
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#event-31768164434
regybeanhttps://github.com/regybean
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#event-31768290211
[llm-config] map: per-user LLM Connections and Model configs #435https://github.com/regybean/Trellis/issues/435
regybeanhttps://github.com/regybean
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#event-31768325443
[llm-config] what stays in env, and how does a materialised default carry its credential? #440https://github.com/regybean/Trellis/issues/440
[llm-config] spec: per-user LLM Connections and Model configs #444https://github.com/regybean/Trellis/issues/444
regybeanhttps://github.com/regybean
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#event-31768407727
https://github.com/regybean
regybeanhttps://github.com/regybean
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#issuecomment-5817721422
decipher.setAuthTag()https://nodejs.org/api/crypto.html#deciphersetauthtagbuffer-encoding
PR 52345https://github.com/nodejs/node/pull/52345
audited by cure53 at v1.0.0 in Sep 2024https://cure53.de/audit-report_noble-crypto-libs.pdf
own AES-256-GCM pagehttps://doc.libsodium.org/secret-key_cryptography/aead/aes-256-gcm
NIST SP 800-38D §8.3https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
draft-irtf-cfrg-aead-limitshttps://datatracker.ietf.org/doc/draft-irtf-cfrg-aead-limits/
ReEncrypthttps://docs.aws.amazon.com/kms/latest/APIReference/API_ReEncrypt.html
PR 63411https://github.com/nodejs/node/pull/63411
Tink prefixes every ciphertext with a 5-byte key identifierhttps://developers.google.com/tink/wire-format
Node's Buffer docshttps://nodejs.org/api/buffer.html#buffers-and-character-encodings
@acme/env ADR 0002https://github.com/regybean/Trellis/blob/main/packages/platform/env/docs/adr/0002-secret-requiredness-is-derived-never-declared.md
apps ADR 0002https://github.com/regybean/Trellis/blob/main/apps/docs/adr/0002-ci-build-stubs-for-infra-client-env.md
Cryptographic Storagehttps://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html
Secrets Managementhttps://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
ADR 0014https://github.com/regybean/Trellis/blob/main/docs/adr/0014-tests-validate-real-env.md
Node runtime pagehttps://nitro.build/deploy/runtimes/node
Nitro's node config optionhttps://nitro.build/config
Workers' node:crypto pagehttps://developers.cloudflare.com/workers/runtime-apis/nodejs/crypto/
Edge runtime docshttps://nextjs.org/docs/app/api-reference/edge
since Node 19 and non-experimental since Node 23https://nodejs.org/api/globals.html#crypto_1
MDNhttps://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/encrypt
W3C Web Cryptography §29.4.1https://w3c.github.io/webcrypto/#aes-gcm-operations
#440https://github.com/regybean/Trellis/issues/440
#444https://github.com/regybean/Trellis/issues/444
regybeanhttps://github.com/regybean
completedhttps://github.com/regybean/Trellis/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 24, 2026https://github.com/regybean/Trellis/issues/438#event-31771719518
Sign up for freehttps://github.com/signup?return_to=https://github.com/regybean/Trellis/issues/438
Sign in to commenthttps://github.com/login?return_to=https://github.com/regybean/Trellis/issues/438
regybeanhttps://github.com/regybean
wayfinder:researchhttps://github.com/regybean/Trellis/issues?q=state%3Aopen%20label%3A%22wayfinder%3Aresearch%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.