fix(request): no dangling ? on empty query strings; feat(auth): doc-level OCI env var indirections - #125
Open
jeffreyaven wants to merge 3 commits into
Open
fix(request): no dangling ? on empty query strings; feat(auth): doc-level OCI env var indirections#125jeffreyaven wants to merge 3 commits into
jeffreyaven wants to merge 3 commits into
Conversation
url.Parse records a trailing ? as ForceQuery and reproduces it on the wire. Signature schemes covering (request-target) then fail against servers that normalise the request line before verification - live OCI rejects every no-query body verb with 401 NotAuthenticated (GETs escape because they always carry real query params). Found by the oci provider live smoke; the signed-mock integration suite could not catch it because the dangling ? is self-consistent between signing and wire. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A provider doc may now ship default env var names in its config.auth block (tenancy_ocid_envvar, user_ocid_envvar, fingerprint_envvar, private_key_envvar, private_key_path_envvar, passphrase_envvar, region_envvar) so a populated environment needs no runtime --auth context, matching the credentialsenvvar convention of the API-key auth types. Indirections only - literal credential values remain runtime auth context territory. Plumbed through the internal DTO, authsurface and formulation wrapper layers; consumers map these onto the runtime AuthCtx Oci* fields (stackql wire-through tracked separately). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fingerprint, private key and passphrase are generic terms other auth types may legitimately claim; the doc-level OCI keys now all carry an OCI reference at the operator surface (tenancy_ocid_envvar, user_ocid_envvar via 'ocid'; oci_fingerprint_envvar, oci_private_key_envvar, oci_private_key_path_envvar, oci_passphrase_envvar, oci_region_envvar). Go field and getter names unchanged - consumers are unaffected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Two changes, bundled because both gate the
ociprovider release: the first is required for anyOCI write operation to work at all, the second enables zero-config auth from the provider doc.
1. Never emit a dangling
?for an empty query string (fix)operation_store.gobuilt every request URL aspath + "?" + queryeven when the encoded querywas empty.
url.Parserecords the trailing?asForceQueryand reproduces it on the wire andinside the signed
(request-target). Servers that normalise the request line before signatureverification then reconstruct
post /20160918/vcnsagainst a signature overpost /20160918/vcns?-> verification fails. Live OCI rejects every no-query body verb with401 NotAuthenticated / Failed to verify the HTTP(S) Signature; GETs escape because OCI listcalls always carry real query params (
?compartmentId=...).Signed-mock suites cannot catch this class of defect: the dangling
?is self-consistent betweensigning and wire, so digest and signed-header checks all pass. It was found by bisecting a live
failure (official-SDK signer probe succeeded where the engine failed) and confirmed with a raw
header/URL dump at the mock.
The fix appends
?(or&for paths with embedded queries) only when the encoded query isnon-empty:
2. Doc-level OCI env var indirections for
oci_signing_v1(feat)A provider doc may now ship default env var names in its
config.authblock, so a populatedenvironment needs no runtime
--authcontext - matching thecredentialsenvvarconvention ofthe API-key auth types:
Key set:
tenancy_ocid_envvar,user_ocid_envvar,oci_fingerprint_envvar,oci_private_key_envvar,oci_private_key_path_envvar,oci_passphrase_envvar,oci_region_envvar. Indirections only - literalcredential values remain runtime-auth-context territory. Plumbed through
internal/anysdk/auth_dto.go,pkg/authsurface.AuthDTOand thepublic/formulationwrapper(new getters
GetOci*EnvVar()); the API growth check is unaffected (methods on existinginterfaces, no new exported types). The consumer wire-through (mapping the doc-level getters onto
the runtime
AuthCtxintransformOpenapiStackqlAuthToLocal) is tracked as a stackql issue.Verification
go build ./...andgo vetclean (vet findings inregistry.goare pre-existing).go.modreplace) and verified against a live OCI AlwaysFree tenancy (
ap-melbourne-1): 18/18 smoke assertions including the full instance state walk(launch -> RUNNING -> STOP -> STOPPED -> START -> RUNNING -> rename -> terminate ->
TERMINATED), VCN/subnet/bucket lifecycles, and both signed forms (three-header GET/DELETE,
six-header POST/PUT).
?exactlyas live OCI does, so a regression fails the suite rather than only surfacing live.
Release
Suggest cutting
v0.5.4-alpha02from this branch for the pending stackql release - the ociprovider publish is gated on a released stackql that carries change 1.