Repository navigation
Conversation
detach() now hands the worker its arguments in a 0600 file under the root-only state dir instead of argv; the worker reads it once and removes it. jget and the age passphrase feed use here-docs instead of printf, which is not a builtin in mksh and would otherwise run as an external command with the data in its arguments. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com>
5 of 6 tasks
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.
Long operations received their base64 JSON arguments (passphrases included) on the worker's argv for the whole run. Under mksh,
printfis not a builtin, soprintf '%s' "$X" | …also runs an external command with the data in its arguments.detach()(helper.sh) writes the args to$STATE/staging/args.<opid>with umask 077, via a here-doc intocat, and starts the worker with only<verb> <opid>.base64 -d <file) and removes it right away;cleanupalready removes any*<opid>*staging leftovers.jgetfeeds jq from a here-doc instead ofprintf.enc_age/dec_agefeed the passphrase toscript/age from a here-doc instead ofprintf.helper.sh already uses here-docs at runtime, so they work under the shells the module runs in.
Not in this PR:
mtproto-store sign-in --password; the binary only takes it as a flag, so that needs a change in mtproto-store first (an env var or stdin).sh helper.sh <verb> <b64>; that process is short-lived for detached verbs, but synchronous verbs keep it for their run.Testing
sh -n,mksh -n,busybox sh -non both scripts;shellcheck -s sh: same warnings as upstream main (96 worker, 58 helper).detach,jget,enc_age,dec_agefunctions with a stub worker and a stubscript: worker argv is only<verb> <opid>, args round-trip byte-exact (passphrase with\, quotes,$(...), backticks,-n), the file is 0600 and removed after reading, a bad opid is still refused, and the stub sees exactlypass\npass/passon stdin.ageencryption/decryption was not run.