Repository navigation
fix(storage): pass unknown --efs-mount-options through, refuse unsafe ones (#1390) - #1401
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
… ones (#1390) ParseCustomOptions silently dropped every option it had no field for (nconnect, noac, lookupcache, ...). Well-formed unknown options now reach the mount -t nfs4 command and the fstab line verbatim via EFSMountOptions.Extra; malformed/metacharacter options, non-numeric values for numeric options, and efs-utils-only options (tls, iam, accesspoint, ...) are refused, and runLaunch refuses them before any AWS call.
scttfrdmn
force-pushed
the
fix/1390-efs-mount-options
branch
from
October 28, 2026 21:34
4472de6 to
5422dce
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.
Fixes #1390
storage.ParseCustomOptionsdropped every option it had no field for, so--efs-mount-options nconnect=8,timeo=600mounted withtimeo=600and nonconnect, and nothing said so.The storage script mounts with
mount -t nfs4(the kernel NFS client, fromnfs-utils), not amazon-efs-utilsmount -t efs. The kernel client has supportednconnectsince Linux 5.3, and AL2023 runs 6.x. So the fix passes options through instead of refusing them:nameorname=value, letters/digits/_ . -, plus: / +in a value) is added verbatim to the newEFSMountOptions.Extraand emitted before_netdev. It reaches bothmount -t nfs4 -ocommands (by mount-target IP and by DNS) and the fstab line.--efs-mount-optionsand the option:tls,iam,accesspoint, ...), whichmount -t nfs4rejects at boot.runLaunchchecks the flag before its first AWS call. A single launch renders the storage script only after creating the key pair, role and security group. The sweep paths already render every member before creating anything.ShellQuote(shellEscape) on the whole option string. The character set exists to keep the fstab line six fields long and the option list a list.Gates. Each one was watched failing against a compiling revert:
TestEFSMountOptionsReachTheMountOnEveryPathcovers the single launch (launchStorageScript), the foreground sweep and the detached sweep. Withnconnect=4it checks both mount commands and the fstab line exactly. Against thepkg/storage/efs.gorevert, all 3nconnect=4subtests fail.TestEFSMountOptionsWithMetacharactersAreRefusedOnEveryPathsends;,$(...)and'options down all 3 paths. Against the revert, all 9 subtests fail (the options were accepted).timeo=150subtests on all 3 paths andTestParseCustomOptionsKnownOptionsUnchangedpass on the revert, matching the old output exactly.timeo=150subtests fail._netdevmakes the storage gate fail.TestParseCustomOptionsPassesUnknownOptionsThrough/...RefusesWhatItCannotPassfail against the revert.TestValidateEFSMountOptionsFlagfails when therunLaunchcall is removed.User-data size: the template is unchanged. Only the option string grows, by the option itself.
TestBareBootstrapFitsItsBudget, the pkg/tasklaunch user-data tests and the pkg/userdata tests all pass.Checks:
make check,make lint(0 issues) andsemgrep scan --config=auto --error .are clean.make api-snapshotadds the newExtrafield. Help text is unchanged.