Loading
Draft: PoC: Option A - FF_GIT_URLS_WITHOUT_TOKENS + override credential helper for DAP
What does this MR do?
Proof of Concept for Option A from #593467: replace the current sed-based git remote set-url workaround with a Runner-aware credential helper override.
Related to issue #593467.
Approach
- Enable
FF_GIT_URLS_WITHOUT_TOKENS=trueas a job variable, so the Runner setsoriginto a clean URL (no token embedded) and configures acredential.<host>.helperthat returnsCI_JOB_TOKENinstead of usinginsteadOfURL rewriting. - Override
credential.helpervia twoGIT_CONFIG_*env var entries:credential.helper=''resets the helper stack (drops the Runner's CI_JOB_TOKEN helper).- An inline shell helper that echoes
username=oauth/password=${GIT_PASSWORD}(the DAP OAuth token).
- Remove the
sed-basedgit remote set-urlfrommain_workflow_commands. It is no longer needed, and it was the source of the on-disk and process-listing token exposure documented in the issue.
Files changed
ee/app/services/ai/duo_workflows/start_workflow_service.rbbase_variables: addFF_GIT_URLS_WITHOUT_TOKENS: 'true'.git_environment_variables: bumpGIT_CONFIG_COUNTfrom2to4; add the twocredential.helperentries.main_workflow_commands: remove thegit remote set-url ... | sedline.
Why this addresses the issue
The current implementation (added in !226743 (merged)) writes the OAuth token to .git/config on disk and briefly exposes it in process listings via sed. The accepted-risk note in the issue lists exactly these as the concerns to eliminate.
With this PoC:
✅ Token is never written to.git/config.✅ Token is never exposed in process listings.✅ originstays as the clean URL (LLM-friendly, addresses Sebastian's concern in note 3187622813).✅ Same mechanism works transparently for LFS / fetch / push.✅ Aligns with the pattern already used in Remote Development Workspaces (workspace_variables_git_credential_store.sh).
Caveats / Open questions for evaluation
GIT_CONFIG_NOSYSTEM=1andGIT_CONFIG_GLOBAL=/dev/nullare already set by DAP. We need to confirm that the Runner'sget_sourcesstage (which is what consumesFF_GIT_URLS_WITHOUT_TOKENS) still works correctly with those env vars present. If the Runner relies on system/global git config to write its credential helper, we may need to revisit and instead override the helper insidemain_workflow_commands(after the Runner's clone phase) rather than via env vars.- Submodule authentication has been called out as a known issue with
FF_GIT_URLS_WITHOUT_TOKENS(gitlab-org/gitlab-runner#38801). DAP workloads currently do not appear to depend on submodules during clone, but worth verifying. - Runner version dependency:
FF_GIT_URLS_WITHOUT_TOKENSexists today but is off by default. Self-managed customers on older Runner versions need to be considered before this can ship as a non-PoC. - Spec updates are intentionally not included in this PoC. The existing specs in
ee/spec/services/ai/duo_workflows/start_workflow_service_spec.rb(notably thegit environment variablesandsetup_script configurationdescribe blocks) will need updating once the approach is validated.
Testing
Manual testing recommended:
- Run a DAP workflow and inspect the workload container's
.git/config: the OAuth token should no longer be present. - Verify
git fetch/git pushfrom the DAP container againstoriginstill succeed. - Verify nothing in
psoutput exposes the token.
Checklist
- Branch prefixed with
aherczeg/593467/ - Tests updated (deferred until approach is validated)
- Manual verification on a real DAP run