Repository navigation
Name the key-file side effect - #9
Merged
Merged
Conversation
ServiceAccountKey.isCloudInfrastructureGuest is hostname.trim == "cloud-infrastructure". writeCredentials reads /etc/hostname inside privateKey.map and passes that text through. A missing hostname file throws. The MIME decode, field check, trailing newline, .tmp sibling, rw-------, and ATOMIC_MOVE/REPLACE_EXISTING move stay. Co-authored-by: Leonid Dubinsky <dub@podval.org>
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.
writeCredentialsis the only place the library touches the machine. The guest skip is one predicate,ServiceAccountKey.isCloudInfrastructureGuest, whose body ishostname.trim == "cloud-infrastructure". The companion isprivate[besom]and has no Besom types, so a test can call it while Besom stayscompileOnly.writeCredentialsreads/etc/hostnameand passes that text to the predicate. The read stays insideprivateKey.map:key.flatMap(_.privateKey).map(writeCredentials). The map depth is unchanged. A missing/etc/hostnamethrows fromFiles.readString. The predicate does not catch that and treat a missing file as another host.The rest of the write is unchanged:
Base64.getMimeDecoder, theclient_email/private_keycheck, the trailing newline on the JSON, the.tmpsibling, POSIXrw-------, andFiles.movewithREPLACE_EXISTINGandATOMIC_MOVE."9.0.0"and"6.20.0"stay inline.resourcesiskeyAdminMembers :+ key.Comments on the map and on
writeCredentials: the exportgrokBotKeyFileforces this map, and the guest skip is this hostname comparison and nothing else.ServiceAccountKeyTestlocks a trailing newline (cloud-infrastructure\n), a trailing space plus newline (sotrimis inside the predicate), the exact host, and non-matching hosts (localhost,localhost\n,not-cloud-infrastructure).Sample, README, CI, and
Bucketare untouched.Verify
./gradlew buildpasses on JDK 25 (Scala 3.10.0).ServiceAccountKeyTestis 1 test,LogicalNamesTestis 20 tests, 0 failures.pulumi previewwas not run. This environment has no Pulumi or GCP credentials, and a preview of an existing stack can write the grok-bot JSON key.