Skip to content

csi: fix check of StagePublishBaseDir being subdirectory of MountDir#27717

Open
allisonlarson wants to merge 2 commits intomainfrom
b-fix-subdirectory-check
Open

csi: fix check of StagePublishBaseDir being subdirectory of MountDir#27717
allisonlarson wants to merge 2 commits intomainfrom
b-fix-subdirectory-check

Conversation

@allisonlarson
Copy link
Copy Markdown
Contributor

Description

Small fix, adds an IsSubdirectory helper that checks if a path is a subdirectory of another using the filepath.Rel, instead of only checking for a prefix match of two strings. Prevents an error being thrown if the StagePublishBaseDir and MountDir are given as separate directories that still start with the same characters (like /csi and /csilocal)

Testing & Reproduction steps

Bug was found when using a csi_plugin block such as:

csi_plugin {
  ...
  mount_dir              = "/csi"
  stage_publish_base_dir = "/csilocal"
}

returned the errorCSIPluginConfig StagePublishBaseDir must not be a subdirectory of MountDir, now it does not error. Tests have been added/updated.

Links

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@allisonlarson allisonlarson requested review from a team as code owners March 19, 2026 22:40
chrisroberts
chrisroberts previously approved these changes Mar 19, 2026
@allisonlarson allisonlarson added backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/1.11.x backport to 1.11.x release line labels Mar 20, 2026
@tgross
Copy link
Copy Markdown
Member

tgross commented Mar 23, 2026

MARKER_REVIEW_XQF27717

@themavik keep this slop debris out of our repo, please. If you want to contribute helpful comments on PR reviews, that's fine. But AI-generated reviews are absolutely unwelcome.

@allisonlarson
Copy link
Copy Markdown
Contributor Author

@chrisroberts I had forgotten the changelog, so thats been updated along with the appropriate labels

@allisonlarson allisonlarson added backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/2.0.x backport to 2.0.x release line and removed backport/ent/1.8.x+ent Changes are backported to 1.8.x+ent backport/1.11.x backport to 1.11.x release line labels Mar 24, 2026
@allisonlarson allisonlarson added this to the 2.0.1 milestone Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/ent/1.10.x+ent backport to 1.10.x+ent release line backport/ent/1.11.x+ent backport to 1.11.x+ent release line backport/2.0.x backport to 2.0.x release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants