Skip to content

[P2] share upload generates an invalid curl command for content types with shell metacharacters #69

Closed

Description

@Vonng

Summary

share upload interpolates form fields into a shell command without quoting. Ordinary content types containing a semicolon produce a command that cannot be executed.

Reproduction

mcli share upload --content-type 'text/plain; charset=utf-8' ALIAS/BUCKET/object
# replace <FILE> in the generated command and execute it with bash

Observed

The generated command contains:

-F Content-Type=text/plain; charset=utf-8

When executed, the shell treats the semicolon as a command separator. The generated command returns 127 and the upload request is malformed.

The form arguments are directly concatenated at share-upload-main.go.

Expected

Generated commands must be valid shell commands for all supported values. Every URL, form name, and form value must be quoted safely; text fields should use --form-string where appropriate.

Acceptance

  • Content types with parameters, spaces, quotes, backslashes, dollar signs, and shell metacharacters generate executable commands.
  • Recursive key templates continue to work.
  • Add unit tests for generated command parsing/execution or compare against a shell-safe argv construction.
  • Do not expose credentials beyond the existing share URL contract.

Confirmed on current main 07753f7efc5036465bb79dadde031ec07f172505 with an actual generated curl command execution.

Activity

  1. Vonng commented on Nov 8, 2026

    @Vonng
    MemberAuthor

    Fixed on main in #74 (bfb58768).

    Generated upload commands now quote every complete POSIX-shell argument and use --form-string for literal fields. Tests execute the generated command and verify both argv and multipart content; HTTP/TLS functional tests and live SILO uploads pass. The changelog documents the execution change: use a POSIX shell (or sh -c "$upload" for a stored command), not direct variable expansion or cmd.exe. Bilingual reference updates are prepared in pgsty/silo.pgsty.com#52.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions