Skip to content

Conversation

@sdkakcy
Copy link

@sdkakcy sdkakcy commented Jan 2, 2026

This PR addresses a security vulnerability in Docker registry authentication by replacing unsafe string interpolation with proper shell escaping.

Changes Made

  • ✅ Export safeDockerLoginCommand from packages/server/src/services/registry.ts
  • ✅ Replace unsafe login commands in packages/server/src/utils/providers/docker.ts
  • ✅ Replace unsafe login commands in packages/server/src/utils/cluster/upload.ts
  • ✅ Improve error messages for better user experience

Security Impact

Before: Docker login commands were vulnerable to shell injection:

echo "${password}" | docker login --username "${username}" --password-stdin "${registryUrl}"

After: Using safe shell escaping:

const loginCommand = safeDockerLoginCommand(registryUrl, username, password);

Benefits

  • 🔒 Prevents shell injection attacks through malicious registry credentials
  • 🛡️ Ensures proper escaping of special characters in usernames/passwords
  • 🔄 Maintains consistent security practices across the codebase
  • ✨ No breaking changes to existing functionality

Testing

  • Existing functionality preserved
  • No API changes
  • Improved security without affecting user experience
  • All affected files updated consistently

Related Issue

Closes #3382

Type of Change

  • Security enhancement
  • Code refactoring
  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have made corresponding changes to the documentation (if applicable)
  • My changes follow security best practices

- Export safeDockerLoginCommand from registry service
- Replace unsafe string interpolation in docker.ts with safeDockerLoginCommand
- Replace unsafe string interpolation in upload.ts with safeDockerLoginCommand
- Improve error messages for better user experience
- Prevent shell injection vulnerabilities in registry credentials
@sdkakcy sdkakcy requested a review from Siumauricio as a code owner January 2, 2026 23:40
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.

Security Enhancement: Safe Shell Escaping for Docker Registry Authentication

1 participant