{"action":"created","issue":{"url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/2264","labels_url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/2264/labels{/name}","comments_url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/2264/comments","events_url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/2264/events","html_url":"https://github.com/OctopusDeploy/Issues/issues/2264","id":124685837,"number":2264,"title":"Custom Account username/password are invisibly retained after switching to a BUILTIN account","user":{"login":"michaelnoonan","id":1627582,"avatar_url":"https://avatars.githubusercontent.com/u/1627582?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelnoonan","html_url":"https://github.com/michaelnoonan","followers_url":"https://api.github.com/users/michaelnoonan/followers","following_url":"https://api.github.com/users/michaelnoonan/following{/other_user}","gists_url":"https://api.github.com/users/michaelnoonan/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelnoonan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelnoonan/subscriptions","organizations_url":"https://api.github.com/users/michaelnoonan/orgs","repos_url":"https://api.github.com/users/michaelnoonan/repos","events_url":"https://api.github.com/users/michaelnoonan/events{/privacy}","received_events_url":"https://api.github.com/users/michaelnoonan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OctopusDeploy/Issues/labels/bug","name":"bug","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"alfhenrik","id":1035315,"avatar_url":"https://avatars.githubusercontent.com/u/1035315?v=3","gravatar_id":"","url":"https://api.github.com/users/alfhenrik","html_url":"https://github.com/alfhenrik","followers_url":"https://api.github.com/users/alfhenrik/followers","following_url":"https://api.github.com/users/alfhenrik/following{/other_user}","gists_url":"https://api.github.com/users/alfhenrik/gists{/gist_id}","starred_url":"https://api.github.com/users/alfhenrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfhenrik/subscriptions","organizations_url":"https://api.github.com/users/alfhenrik/orgs","repos_url":"https://api.github.com/users/alfhenrik/repos","events_url":"https://api.github.com/users/alfhenrik/events{/privacy}","received_events_url":"https://api.github.com/users/alfhenrik/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-01-04T02:07:42Z","updated_at":"2016-01-06T05:11:34Z","closed_at":null,"body":"_This same behaviour is likely anywhere *Custom User* is allowed as an option._\r\n\r\n**Steps to Reproduce**\r\n\r\n1. Create a Package Step and add the Windows Service feature\r\n2. Select `LocalSystem` for the **Service Account**\r\n3. Save, looking at the POST-ed JSON (and persisted document)\r\n4. Now edit the Step selecting `Custom user...` for the **Service Account**, and enter a username and password\r\n5. Save looking at the POST-ed JSON and the `CustomAccountName` and `CustomAccountPassword` properties are correctly added\r\n6. Now edit the Step selecting `Network Service` for the **Service Account**\r\n7. Save, looking at the POST-ed JSON (and persisted document) and the `CustomAccountName` and `CustomAccountPassword` properties are retained **even though they should have been cleared**.\r\n\r\nThe flow on effect of this is that offline drops are required to have a password for sensitive variables even though there aren't really supposed to be any sensitive variables.\r\n\r\n**Configuring the Custom Account**\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1627582/12082303/573d9636-b2dc-11e5-87f6-f547a6a0d613.png)\r\n\r\n**Switching back to the Network Service BUILTIN Account**\r\n\r\n![image](https://cloud.githubusercontent.com/assets/1627582/12082309/6cb81a40-b2dc-11e5-96b3-a016d5803bae.png)\r\n\r\n\r\nSource: http://help.octopusdeploy.com/discussions/problems/43593-offline-package-drop-incorrectly-thinks-there-are-sensitive-variables-and-requires-password"},"comment":{"url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/comments/169226516","html_url":"https://github.com/OctopusDeploy/Issues/issues/2264#issuecomment-169226516","issue_url":"https://api.github.com/repos/OctopusDeploy/Issues/issues/2264","id":169226516,"user":{"login":"alfhenrik","id":1035315,"avatar_url":"https://avatars.githubusercontent.com/u/1035315?v=3","gravatar_id":"","url":"https://api.github.com/users/alfhenrik","html_url":"https://github.com/alfhenrik","followers_url":"https://api.github.com/users/alfhenrik/followers","following_url":"https://api.github.com/users/alfhenrik/following{/other_user}","gists_url":"https://api.github.com/users/alfhenrik/gists{/gist_id}","starred_url":"https://api.github.com/users/alfhenrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfhenrik/subscriptions","organizations_url":"https://api.github.com/users/alfhenrik/orgs","repos_url":"https://api.github.com/users/alfhenrik/repos","events_url":"https://api.github.com/users/alfhenrik/events{/privacy}","received_events_url":"https://api.github.com/users/alfhenrik/received_events","type":"User","site_admin":false},"created_at":"2016-01-06T05:11:34Z","updated_at":"2016-01-06T05:11:34Z","body":"Currently when we save a deployment process we restore any sensitive variables that an action previously had, so even if you change the user account to be used, the password will be added back. \n\n```\nIEnumerable<KeyValuePair<string, PropertyValue>> WriteProperties(IEnumerable<KeyValuePair<string, string>> properties, IDictionary<string, string> sensitiveProperties, PropertiesDictionary existing)\n        {\n            //Create property collection from sensitive variables\n            var result = sensitiveProperties\n                .Where(p => !string.IsNullOrWhiteSpace(p.Value) \n                    && !string.IsNullOrWhiteSpace(p.Key))\n                .ToDictionary(s => s.Key, s => new PropertyValue(s.Value, true));\n\n            // Add any existing sensitive variables back onto the result if they havent been set\n            existing?.Where(e => e.Value.IsSensitive\n                && !result.ContainsKey(e.Key))\n                .ToList()\n                .ForEach(missingSensitive => result.Add(missingSensitive.Key, missingSensitive.Value));\n\n            // Add Non sensitive values\n            properties\n                .Where(property => !result.ContainsKey(property.Key)\n                    && !string.IsNullOrWhiteSpace(property.Value)\n                    && !string.IsNullOrWhiteSpace(property.Key))\n                .ToList()\n                .ForEach(property => result.Add(property.Key, new PropertyValue(property.Value)));\n            \n            return result;\n        }\n```\n\nCurrently the only workaround is to remove the feature, save the process, and then add the feature back using one of the BUILTIN accounts.\n\nThis affects both the Windows Service and IIS Website features as they allow you to specify custom users for the Windows service and the IIS App Pool.\n\n#2270 could be related to this issue as well.\n\nWould probably be best to discuss this further within the team to come up with a fix."}}