{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":694,"path":"api-reference/scripts/t_SecureAProcessor.md","title":"Secure and protect a processor","bundle":null,"doc_type":null,"release":"australia","body":"\n# Secure and protect a processor\n\nYou can protect your processor against unauthorized use by using role restrictions, and protect it by requiring a CSRF token.\n\n## About this task\n\n**Note:** This feature is deprecated. While legacy, existing custom processors continue to be supported, creating new custom processors has been deprecated. Instead, use the [Scripted REST APIs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\nYou can re-use a table's user role restrictions to protect it from access by your processor. This protection method assumes the processor will access table data.\n\n## Procedure\n\n1.  Create or select a user role that has access to the table the processor script calls.\n\n2.  Navigate to **System Definition** &gt; **Processors**.\n\n3.  In **Script**, add the following code block.\n\n    ```\n    var now_GR = new GlideRecord('your_table_name');\n    // canRead() compares the table’s ACL to the user making this request, and returns true if the logged-in user has read access to this table\n    if(gr.canRead())  \n    { \n      // Perform table query here  \n      g_processor.writeOutput('Success!'); \n    } else { \n      g_processor.writeOutput('You do not have permission to read table your_table_name'); \n    }\n    ```\n\n4.  Update the code block to use other access restrictions as needed.\n\n    Available access functions include:\n\n    -   canCreate\\(\\)\n    -   canRead\\(\\)\n    -   canWrite\\(\\)\n    -   canDelete\\(\\)\n5.  Click **Update**.\n\n\n**Parent Topic:**[Processors](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/c_Processors.md)\n\n## Protect a processor with a CSRF token\n\nYou can protect a processor by requiring a CSRF token.\n\n### About this task\n\nScript type processors can require a CSRF token check before the processor runs.\n\n### Procedure\n\n1.  Navigate to **All** &gt; **System Definition** &gt; **Processors**.\n\n2.  Open a processor record.\n\n3.  Select the **CSRF protect** option.\n\n4.  Click **Update**.\n\n\n**Related topics**  \n\n\n[Assign a role to a user](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/t_AssignARoleToAUser.md)\n\n"}}