Skip to content

fix: quote include fetch paths - #1891

Open
cyphercodes wants to merge 1 commit into
firecow:masterfrom
cyphercodes:fix/quote-include-fetch-paths
Open

fix: quote include fetch paths#1891
cyphercodes wants to merge 1 commit into
firecow:masterfrom
cyphercodes:fix/quote-include-fetch-paths

Conversation

@cyphercodes

@cyphercodes cyphercodes commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • Quote generated bash path arguments when fetching project/component includes over HTTP.
  • Also quote branch refs and sparse-checkout file arguments in the same command sequence.
  • Add coverage for a Windows-style cwd containing whitespace.

Fixes #1887

Tests

  • bunx vitest run tests/parser-includes.test.ts
  • bun run typecheck
  • bun run lint
  • bunx vitest run tests/test-cases/include-component/integration.test.ts

Summary by cubic

Quote all generated bash args during HTTP include fetches to prevent path splitting and checkout failures on paths with spaces. Fixes #1887 and adds tests for Windows-style paths.

  • Bug Fixes
    • Quote cwd, temp dirs, branch refs, and sparse-checkout file paths with Utils.safeBashString across cd, git clone, git sparse-checkout, and cp.
    • Add a test verifying correct command quoting when cwd includes spaces on Windows.

Written for commit db073fa. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@firecow firecow left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions and a note inline.

Comment thread src/parser-includes.ts
`cd ${tmpDir}`,
`git sparse-checkout set --no-cone ${normalizedFile}`,
`cd ${Utils.safeBashString(`${cwd}/${stateDir}`)}`,
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${remote.schema}://${remote.host}:${remote.port}/${project}.git ${Utils.safeBashString(tmpDir)}`,

@firecow firecow Jul 31, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${remote.schema}://${remote.host}:${remote.port}/${project}.git ${Utils.safeBashString(tmpDir)}`,
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${Utils.safeBashString(`${remote.schema}://${remote.host}:${remote.port}/${project}.git`)} ${Utils.safeBashString(tmpDir)}`,

Comment thread src/parser-includes.ts
`cd ${tmpDir}`,
`git sparse-checkout set --no-cone ${files[0]} ${files[1]}`,
`cd ${Utils.safeBashString(`${cwd}/${stateDir}`)}`,
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${remote.schema}://${remote.host}:${remote.port}/${project}.git ${Utils.safeBashString(tmpDir)}`,

@firecow firecow Jul 31, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${remote.schema}://${remote.host}:${remote.port}/${project}.git ${Utils.safeBashString(tmpDir)}`,
`git clone ${gitCloneBranch} -n --depth=1 --filter=tree:0 ${Utils.safeBashString(`${remote.schema}://${remote.host}:${remote.port}/${project}.git`)} ${Utils.safeBashString(tmpDir)}`,


expect(bashMultiSpy).toHaveBeenCalledWith([
`cd '${cwd}/${stateDir}'`,
`git clone --branch '1.3.0' -n --depth=1 --filter=tree:0 https://gitlab.com:443/arc/ci-cd-components.git '${tmpDir}'`,

@firecow firecow Jul 31, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`git clone --branch '1.3.0' -n --depth=1 --filter=tree:0 https://gitlab.com:443/arc/ci-cd-components.git '${tmpDir}'`,
`git clone --branch '1.3.0' -n --depth=1 --filter=tree:0 'https://gitlab.com:443/arc/ci-cd-components.git' '${tmpDir}'`,

Separately: this test pins an exact command array with everything mocked, breaks on any added flag, never runs bash. Also bashMulti already sets cwd, so cd ${cwd}/${stateDir} could be cd ${stateDir}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool not working (due to whitespace in user dir?)

2 participants