Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…rmanager (#932) The four packages that used manager's Uploader/Downloader (pkg/agent queue results, pkg/aws ISO staging, pkg/pipeline stage data and results, pkg/staging schedule params) now build a feature/s3/transfermanager client through a new pkg/s3transfer.New, which starts from manager's behaviour rather than transfermanager's defaults: - 5 MiB parts, not 8 MiB, for uploads and ranged downloads; - a multipart threshold equal to the part size (manager's rule), not a fixed 16 MiB; WithPartSize moves both, so imagebuilder keeps 64 MiB parts and its single-PutObject cutoff, with WithConcurrency(4); - downloads as ranged GETs, not part-number GETs; - 5 concurrent parts, and CRC32 upload checksums under WhenSupported (both already the same in both libraries). Tests against Substrate (no AWS): pkg/s3transfer asserts the request shapes (PutObject vs CreateMultipartUpload/UploadPart counts at the boundaries, 5 MiB Range headers, no partNumber GETs, a stored CRC32, an empty object downloads), each call site round-trips through the emulator (multipart sizes and empty files), and a gate fails if any Go file calls transfermanager.New outside pkg/s3transfer or imports the old package. The SDK modules move up to the versions transfermanager v0.4.16 requires (service/s3 v1.114.3); root and nested modules are re-tidied. Fixes #932
scttfrdmn
added a commit
that referenced
this pull request
Oct 16, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 16, 2026
scttfrdmn
added a commit
that referenced
this pull request
Oct 17, 2026
…#1036) * Make the path validators correct on Windows, and follow links (#1000) ValidatePathForReading compared filepath.Abs against /etc-style prefixes, so on Windows it refused nothing. It now applies the host's rules: - Windows: refuses the Windows directory, ProgramData and System Volume Information (case-insensitive, either separator), UNC and \\?\, \\.\, \??\ prefixes, alternate data streams, reserved device names, and elements ending in a dot or space. - Every OS: any ".." element (before cleaning), NUL bytes, case-insensitive root comparison (macOS /ETC), and symlink/junction resolution of the longest existing prefix via filepath.EvalSymlinks; /private/etc and /var/root added for macOS. spored's queue runner now validates every glob match, not only the pattern, so a wildcard or a link through an allowed directory cannot upload a system file. ValidateMountPath describes a Linux instance path and now uses package path on every host; SanitizePath output is forward-slashed everywhere. Tests: host-neutral table plus build-tagged POSIX and Windows tables (drive letters, UNC, ADS, device names, junctions, 8.3 short names); the Windows string rules are also unit-tested on every OS. (#1000) * go mod tidy after rebase * Build the queue-runner test's uploader with s3transfer.New after #974 (#1000) * Windows CI: run pkg/security now that its validators handle Windows paths (#1000) * go mod tidy after rebase * Resolve junctions on Windows with GetFinalPathNameByHandle (#1000) Since Go 1.23 (GODEBUG winsymlink=1) os.Lstat reports a junction or mount point as ModeIrregular and filepath.EvalSymlinks no longer follows it, so a junction to C:\Windows passed ValidatePathForReading. On Windows, open the longest existing prefix with FILE_FLAG_BACKUP_SEMANTICS and use GetFinalPathNameByHandle; refuse a reparse point that cannot be resolved. POSIX keeps EvalSymlinks.
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 #932
What
All 16 SA1019 sites in four packages move from
feature/s3/managertofeature/s3/transfermanagerv0.4.16:pkg/agent/queue_runner.go: spored's job and queue result uploadspkg/aws/imagebuilder.go:UploadISOToS3pkg/pipeline/data_handoff.go: stage output upload, stage input download,DownloadResultsToLocalpkg/staging/staging.go:UploadScheduleParamsEvery client is built through a new internal package,
pkg/s3transfer. ItsNewstarts from manager's behaviour, not transfermanager's defaults, because three of these callers run inside spored and a change there shows up only on hardware.s3transfer.NewWithPartSizemoves both)GetObjectRanges)ChecksumMode=ENABLEDvia the s3 clientChecksumMode=ENABLEDimagebuilder.gokeeps its 64 MiB parts and concurrency 4 throughWithPartSize/WithConcurrency, so an ISO under 64 MiB is still a single PutObject.One behaviour difference I couldn't avoid: transfermanager buffers each part in memory. It allocates a pool of concurrency+1 parts up front plus the first part. Manager read an
*os.Filein place through aSectionReader. An upload larger than one part therefore holds about 35 MiB by default, or about 384 MiB for an ISO. This is in the CHANGELOG.The SDK modules move up to what transfermanager requires (
service/s3v1.102.2 to v1.114.3,aws-sdk-go-v2v1.47.3, smithy-go v1.28.5). Root,lambda/sweep-orchestratorandlambda/ttl-reaperare re-tidied.go.modno longer requiresfeature/s3/manager, andgrep -rn 'feature/s3/manager' --include=*.go .is empty. The public-surface snapshot is unchanged: no exported symbol inpkg/awsorpkg/storagemoved, andapi_surface_test.gopasses.Tests (Substrate, no AWS)
pkg/s3transfer/s3transfer_test.goasserts manager's documented behaviour against the requests sent, recorded by a newtestutil.S3Recorder:WithPartSize(8 MiB), 7 MiB is single and 9 MiB is 2 parts;Range: bytes=0-5242879first and nopartNumber;UploadISOToS3at 64 MiB±1 makes 1 PutObject or 2 UploadParts;queue_runner.uploadFileround-trips 7 MiB;DownloadResultsToLocal, round-trip an 11 MiB or 6 MiB file plus an empty file;UploadScheduleParamsstores the body and metadata and sendsx-amz-tagging. The tags are checked on the request because Substrate drops them: S3: PutObject and CreateMultipartUpload ignore x-amz-tagging, so GetObjectTagging returns an empty tag set scttfrdmn/substrate#1434.TestTransferClientsAreBuiltByNewparses every Go file in the repo, nested modules included, and resolves import aliases. It fails on atransfermanager.Newcall outsidepkg/s3transferand on any import of the old package. It fails if it walks fewer than 100 files.Each test failed against a revert that compiles:
New:CreateMultipartUpload calls = 0, want 1GET requests = 1, want 31 part-number GETsWithPartSize:PutObject calls = 0, want 1RequestChecksumCalculation=WhenRequired:no CRC32 checksum storedWithPartSize:UploadPart calls = 13, want 2Tagging:want one PutObject carrying x-amz-tagging ..., got 0tm.Newin imagebuilder: the gate reports it.make check: everything passes except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested,make check-tidyandmake check-docsare clean. The new code has no staticcheck findings.Coordination with #938
#938 (still open) adds line-scoped
//lint:ignore SA1019 ... (#932)comments on these 16 uses. This PR removes the uses, so whichever lands second has to drop them. If this merges first, #938's ignores become unused-directive findings and conflict on the edited lines, and #938 should delete them when it rebases. If #938 merges first, this PR needs a rebase that deletes them.Not verified