Repository navigation
Send secrets on create_host - #6
Merged
Merged
Conversation
czpython
force-pushed
the
dru-453-secrets-on-create-host
branch
4 times, most recently
from
September 7, 2026 07:28
828fc72 to
c827955
Compare
POST /hosts takes secrets, and the SDK did not send them, so a caller could not give a box a credential. create_host now takes secrets, a map from a service name to a Secret, a value the caller holds, or an Issuer, a URL the service fetches the value from. Both are frozen records. The custom service fields, host, auth_variable, auth_header, and auth_prefix, are keywords, and only the fields a caller sets go on the wire. The response carries no secret, and SandboxHost does not change. The records' repr never shows the value or the issuer's headers, so a log line with the secrets map exposes nothing. An empty auth_prefix goes on the wire, since Drukbox reads it as no prefix. A 409 for a deployment without the secrets proxy maps to SandboxConflictError. A 422 for a service name Drukbox does not know maps to SandboxValidationError. Both mappings existed. Their docstrings name the new causes. The README shows the surface. Version 0.2.0.
czpython
force-pushed
the
dru-453-secrets-on-create-host
branch
from
September 7, 2026 07:30
c827955 to
446309e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
create_hostsendssecrets.Secret(value, *, host, auth_variable, auth_header, auth_prefix)is a value the caller holds.Issuer(url, headers, refresh, *, ...)is a URL Drukbox fetches the value from. Both are frozen records, like the other records. The custom service fields are keywords, and each record sends only the fields the caller set.create_host(secrets={...})maps a service name to one of them. The response carries no secret, andSandboxHostdoes not change.SandboxConflictError. A 422 for a service name Drukbox does not know maps toSandboxValidationError. Both mappings existed, and their docstrings name the new causes.http-proxiesmethods stay.Where this differs from the ticket
endpoint_varandbase_pathamong the custom service fields. The service dropped both when the secrets proxy replaced the path route, so the wire contract has four custom fields, and the SDK sends those four.Names
New names, open to change:
Secret,Issuer, theirentry, and the base_Servicewithget_service, which holds the four custom fields for both.Gates
uv run ruff check,uv run ruff format --check,uv run pyright, anduv run pytestare green.Acceptance
Through the SDK, from the Mac, against a docker-sbx deployment of the current service on the KVM bed, with a dummy issuer that served a fake value, since provisioning never validates one:
create_hostwith an issuer-backedanthropicsecret returned an active host.get_hostrecord carries a secret.Secretfor a service name Drukbox does not know raisedSandboxValidationErrorwith the service's message.delete_hostcompleted.5 of 5, and the bed restored.
Review
The adversarial review reported two findings. Both are applied:
reprshowed the value and the issuer headers, so a log line with the secrets map exposed both. Those two fields are out of thereprnow, and a test keeps them out.auth_prefix, which Drukbox reads as "no prefix", so a raw API key would have gone out as a bearer. The filter dropsNoneonly now, with a test for both records.