Skip to content

Servers store the input parameters in disk, even if they are sensitive #209

@LMacchi

Description

@LMacchi

If I run a task using mco:

$ mco tasks run my_tasks::sleep_with_pwd_ruby -I server123 --duration=5 --password=kitten123

A new dir is created in the target server, server123:

/opt/puppetlabs/mcollective/tasks-spool # ls d2cbca244f7259be9923669793949ca8
choria.json  exitcode  files  stderr  stdout  wrapper_pid  wrapper_stderr  wrapper_stdin  wrapper_stdout

And the password, even tho it is marked as sensitive in the metadata, is stored in 2 files:

/opt/puppetlabs/mcollective/tasks-spool # cat d2cbca244f7259be9923669793949ca8/wrapper_stdin | jq
{
  "executable": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/files/my_tasks/tasks/sleep_with_pwd_ruby.rb",
  "arguments": [],
  "input": "{\"duration\":5,\"password\":\"kitten123\"}",
  "stdout": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/stdout",
  "stderr": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/stderr",
  "exitcode": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/exitcode"
}
/opt/puppetlabs/mcollective/tasks-spool # cat d2cbca244f7259be9923669793949ca8/choria.json | jq
{
  "start_time": 1752186428,
  "caller": "choria=me.mcollective",
  "task": "my_tasks::sleep_with_pwd_ruby",
  "request": {
    "executable": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/files/my_tasks/tasks/sleep_with_pwd_ruby.rb",
    "arguments": [],
    "input": "{\"duration\":5,\"password\":\"kitten123\"}",
    "stdout": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/stdout",
    "stderr": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/stderr",
    "exitcode": "/opt/puppetlabs/mcollective/tasks-spool/d2cbca244f7259be9923669793949ca8/exitcode"
  }
}

If I remove choria.json completely, I lose the ability to get the task status with mco tasks status, so my proposed solution is to, after task execution, change ['request']['input'] to {} in choria.json and remove wrapper_stdin.

I'm open to more complex ideas like editing only if the sensitive flag is set to true in the metadata file, but I haven't been able to figure out how to do that or if it's even possible.

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