-
Couldn't load subscription status.
- Fork 2k
[artifact] only inspect artifact contents #26892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Artifact inspection would inspect the alloc directory for symlinks pointing outside of the alloc directory. This can be problematic for drivers like the raw exec driver which provide the root system and will likely include symlinks. Inspecting only the artifact after being fetched can be difficult if the artifact is fetched to a pre-existing destination as it would require discerning between new and old paths. Instead, if an artifact is to be inspected, it is fetched to a temporary location. The isolated artifact is then inspected before being moved to its final destination.
| } | ||
| } | ||
|
|
||
| if err := mergeDirectories(env.Destination, finalDest); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the purpose of this merge so that we don't error or override contents that may already exist in the finalDest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So go-getter has two behaviors based on the source used:
- unpack/place artifact files within an existing directory structure (overwriting files on collision)
- delete destination directory and unpack/place artifact files
This is using the first approach (and gets into some of the behavior inconsistencies noted in the description).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding the PR description correctly, this is going to change the behavior of those sources that use option 2, isn't it?
The artifact.destination is placed relative to the task working directory. So couldn't we potentially solve this by having the "root" of the check be the task working directory instead of the allocdir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct that it will change the behavior of those sources using option 2, but only when artifact inspection is triggered. On platforms where landlock is available and is not disabled, artifact inspection will not be performed.
Isolating the check to the task directory won't be sufficient when using the exec driver, as an example. In that case the task directory will include things from the host (like bin/) which will contain symlinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct that it will change the behavior of those sources using option 2, but only when artifact inspection is triggered. On platforms where landlock is available and is not disabled, artifact inspection will not be performed.
I think that's an ok tradeoff, but we should document that behavior in the upgrade guide, because that's going to break somebody's jobspecs somewhere.
Description
Artifact inspection would inspect the alloc directory for symlinks
pointing outside of the alloc directory. This can be problematic
for drivers like the raw exec driver which provide the root system
and will likely include symlinks.
Inspecting only the artifact after being fetched can be difficult if
the artifact is fetched to a pre-existing destination as it would
require discerning between new and old paths. Instead, if an artifact
is to be inspected, it is fetched to a temporary location. The isolated
artifact is then inspected before being moved to its final destination.
The behavior of the artifact getter will be inconsistent when artifact
inspection is enabled versus when it is disabled. This is due to the
behavior difference of go-getter with different sources. Because
go-getter does not behave consistently across different source types,
there will be situations where fetching errors may be encountered
when inspection is disabled but fetching is successful when enabled.
Testing & Reproduction steps
Reproduction steps are described in #26865
Links
Fixes #26865
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
and job configuration, please update the Nomad website documentation to reflect this. Refer to
the website README for docs guidelines. Please also consider whether the
change requires notes within the upgrade guide.
Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.