We both know but default the Workflow SharePoint Task when created it automatically everyone who access can read or can modify the task inside.
But we can achieve to modify that because on the workflow properties there is a option that called “SpecialPermissions” (see on the screenshot as below)
and then put this script below inside code : createTaskWithContentType1_MethodInvoking
HybridDictionary permsCollection = new HybridDictionary();
createTaskWithContentType1.SpecialPermissions = permsCollection;