Skip to content

Environment variable with %18 in the value breaks appcmd #71

Open

Description

@erenes

One automatically generated password that is set in an environment variable in a container accidentally contained the sequence %18.

This resulted in the following appcmd command:

C:\Windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='MY_ENV_VAR',value='%18']" /commit:apphost

The result of which is:

ERROR ( hresult:c00cee2b, message:Failed to commit configuration changes.
 )

When using %64 it "works", resulting in a value of 'd' in the configuration, it seems clear that %## is interpreted as an ascii hex code. When using %25, I get a percent-sign in the value, as "expected".

I think a % value should be escaped (as %25 perhaps, maybe there's another escape sequence available?) while passing it to appcmd.

Note: Error code 0xc00cee2b is "WC_E_XMLCHARACTER".

Activity

  1. victor-makovsky-covergo commented on Jan 29, 2021

    @victor-makovsky-covergo

    Same problem here:
    When there is an environment variable with characters like "%14", ServiceMonotor.exe fails with the following error message:

    APPCMD failed with error code -1072894421
    Failed to update IIS configuration
    
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