From ec25326ec5a9deb09fdf3c4f47c59a6323d258f4 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Sat, 19 Oct 2024 10:53:39 -0500 Subject: [PATCH 1/5] Add files via upload --- .../encryptAndDecryptPasswordFields.js | 15 +++++++++++++++ Background Scripts/readme.md | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Background Scripts/encryptAndDecryptPasswordFields.js create mode 100644 Background Scripts/readme.md diff --git a/Background Scripts/encryptAndDecryptPasswordFields.js b/Background Scripts/encryptAndDecryptPasswordFields.js new file mode 100644 index 0000000000..9190a46214 --- /dev/null +++ b/Background Scripts/encryptAndDecryptPasswordFields.js @@ -0,0 +1,15 @@ +//For Non-password fields Encryption syntax using Key Management Framework Cryptographic module + +var password = "Hello World"; +var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_ENCRYPTION") + .withInputFormat("KMFNone"); +var encryptedText = encryptOp.doOperation(password); //Encrypting Hello world +gs.info("After Encryption: " + encryptedText); + + +//For Non-password fields Decryption syntax using Key Management Framework Cryptographic module + +var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_DECRYPTION") + .withOutputFormat("KMFNone"); +var clear_text = encryptOp.doOperation('91ddbb5d47c012101b589d2f316d438012p3lgrR72vEQW5yLk-WXKQ==aGqxYzUXuyLt3HTqcW6-HA=='); //Pass Cipher text of Hello World (Which is the output of first script) +gs.info("After decryption: " + clear_text); diff --git a/Background Scripts/readme.md b/Background Scripts/readme.md new file mode 100644 index 0000000000..d769839893 --- /dev/null +++ b/Background Scripts/readme.md @@ -0,0 +1,11 @@ +Generally when you want to encrypt or decrypt any Non-password fields earlier we have Glide Encrypter API methods for encryption and decryption. +The GlideEncrypter API uses 3DES encryption standard with NIST 800-131 A Rev2 has recommended against using to encrypt data after 2023. +ServiceNow offers alternative cryptographic (Key Management Framwork) solutions to the GlideEncrypter API. + +Note: ServiceNow recommending to deprecate GlideEncrypter API with in the instances as soon as possible. The actual dead line is September 2025. + +These are the sample scripts I ran in my PDI: For Non-password fields. I used AES 256 algorithm for Symmetric Data Encryption/Decryption. + +To test the scripts you need to create Cryptographic module and generate the key. + +"global.vamsi_glideencrypter" is my cryptographic module name. \ No newline at end of file From 2ef3e176d4e68cb1c2fdcfd7b5bae5fe9bc3a913 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Tue, 29 Oct 2024 17:34:06 -0500 Subject: [PATCH 2/5] Delete Background Scripts/encryptAndDecryptPasswordFields.js Deleting duplicate file --- .../encryptAndDecryptPasswordFields.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Background Scripts/encryptAndDecryptPasswordFields.js diff --git a/Background Scripts/encryptAndDecryptPasswordFields.js b/Background Scripts/encryptAndDecryptPasswordFields.js deleted file mode 100644 index 9190a46214..0000000000 --- a/Background Scripts/encryptAndDecryptPasswordFields.js +++ /dev/null @@ -1,15 +0,0 @@ -//For Non-password fields Encryption syntax using Key Management Framework Cryptographic module - -var password = "Hello World"; -var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_ENCRYPTION") - .withInputFormat("KMFNone"); -var encryptedText = encryptOp.doOperation(password); //Encrypting Hello world -gs.info("After Encryption: " + encryptedText); - - -//For Non-password fields Decryption syntax using Key Management Framework Cryptographic module - -var encryptOp = new sn_kmf_ns.KMFCryptoOperation("global.vamsi_glideencrypter", "SYMMETRIC_DECRYPTION") - .withOutputFormat("KMFNone"); -var clear_text = encryptOp.doOperation('91ddbb5d47c012101b589d2f316d438012p3lgrR72vEQW5yLk-WXKQ==aGqxYzUXuyLt3HTqcW6-HA=='); //Pass Cipher text of Hello World (Which is the output of first script) -gs.info("After decryption: " + clear_text); From 20569ab95194715aca7dd41abb708f83dba77b74 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Tue, 29 Oct 2024 17:34:43 -0500 Subject: [PATCH 3/5] Delete Background Scripts/readme.md Deleting duplicate file --- Background Scripts/readme.md | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 Background Scripts/readme.md diff --git a/Background Scripts/readme.md b/Background Scripts/readme.md deleted file mode 100644 index d769839893..0000000000 --- a/Background Scripts/readme.md +++ /dev/null @@ -1,11 +0,0 @@ -Generally when you want to encrypt or decrypt any Non-password fields earlier we have Glide Encrypter API methods for encryption and decryption. -The GlideEncrypter API uses 3DES encryption standard with NIST 800-131 A Rev2 has recommended against using to encrypt data after 2023. -ServiceNow offers alternative cryptographic (Key Management Framwork) solutions to the GlideEncrypter API. - -Note: ServiceNow recommending to deprecate GlideEncrypter API with in the instances as soon as possible. The actual dead line is September 2025. - -These are the sample scripts I ran in my PDI: For Non-password fields. I used AES 256 algorithm for Symmetric Data Encryption/Decryption. - -To test the scripts you need to create Cryptographic module and generate the key. - -"global.vamsi_glideencrypter" is my cryptographic module name. \ No newline at end of file From d3100460bee9c96539db3c5a29b3545295e4b765 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Tue, 29 Oct 2024 18:11:13 -0500 Subject: [PATCH 4/5] Create Stale Tasks Auto-Close.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups. --- .../Stale Tasks Auto-Close.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Background Scripts/Stale Tasks Auto-Close/Stale Tasks Auto-Close.js diff --git a/Background Scripts/Stale Tasks Auto-Close/Stale Tasks Auto-Close.js b/Background Scripts/Stale Tasks Auto-Close/Stale Tasks Auto-Close.js new file mode 100644 index 0000000000..daa41de944 --- /dev/null +++ b/Background Scripts/Stale Tasks Auto-Close/Stale Tasks Auto-Close.js @@ -0,0 +1,18 @@ +var staleDays = 7; +var closeDays = 14; +var reminderGR = new GlideRecord('task'); +reminderGR.addActiveQuery(); +reminderGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + staleDays); +reminderGR.query(); +while (reminderGR.next()) { + gs.eventQueue('task.reminder', reminderGR, reminderGR.assigned_to, staleDays + ' days without update.'); + } + +var closeGR = new GlideRecord('task'); +closeGR.addActiveQuery(); +closeGR.addEncodedQuery('sys_updated_onRELATIVELE@dayofweek@ago@' + closeDays); +closeGR.query(); +while (closeGR.next()) { + closeGR.state = 3; // Closed + closeGR.update(); + } From 4be2fc0cbf6a2a6a57e08d89f16b265017b8c570 Mon Sep 17 00:00:00 2001 From: Vamsi Krishna Date: Tue, 29 Oct 2024 18:14:02 -0500 Subject: [PATCH 5/5] Stale Tasks Auto-Close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups. --- Background Scripts/Stale Tasks Auto-Close/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Background Scripts/Stale Tasks Auto-Close/readme.md diff --git a/Background Scripts/Stale Tasks Auto-Close/readme.md b/Background Scripts/Stale Tasks Auto-Close/readme.md new file mode 100644 index 0000000000..b88cecc984 --- /dev/null +++ b/Background Scripts/Stale Tasks Auto-Close/readme.md @@ -0,0 +1 @@ +The script identifies tasks that haven’t been updated for a set period, sends reminder notifications to assigned users, and, if still inactive after additional time, automatically closes them. This helps keep task lists current and reduces manual follow-ups. \ No newline at end of file