Skip to content

Avoid using javascript "document" object in Portal #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ca8467c41b9abc10ce0f62c3b24bcbaa/checksum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CuNEYHj5RbBsjVJxohTMD1xntLLtuzW06YrIQxv_dnuv66Z-CP9Yyz94aT1y6VMee62ueoZ-zoVm79qzmSN0EDnNTIajGUE-L9E8z-wSmPjpDRK6unp5pT-WyQru961HXU1NDT6tYoVYpmHPnC1pxK1hGqlJ5xCFlFjoYHaWTOMQ-jgr2lppwmOLGMGR7znGbC3ffVubbJzVWxZF2A54U5qoSwKmMb-Sl6nBVJvbZz8finGJvOBn8WzxH6DP_rUNqXJ4ZflVbC2EWzi2mlf_jhEvu35jXElgy6I7myTSoOJvWiK8J6arVkKEt1MNTtewGnDrFnAbFFZ53T08x7UafmirFgZuS4MbzwCYGQ_dX9IlcB-5OLXuB1JYApTLKEJnT364IFKOpAgwzZm5F9dhRAYQG6qVRonDCHrXl1ZJ1WFEMgDCksXtQpTcc53Fe-cH348-sbttOrFExqMtN8HmrJxdjJWFQB0WIPnb7BLMIc6qvc0QIfku9KZpHSlse1cttB-pn_l5UM07YLgjoWCB2wvGaLkZdjDOT0MZizytu7SaAs0SFgm4Q2g4p3xTJ9C78cM24TaT0oQ_gIehRDaf-ETeb4XCdMj1hpaRB4PR2JquoRXJvkfZ7bB6l0ahyfDeQvKqk2cmDf0Mt2CKXeALoAOwe3vhtLMTXKOL1NBAjm4
InPO8pvCMD9mUh_JaTShthpznssMFIICRymMeOi7QVChk76V-EFLUoiXeUjw3OC903vEi4fIDHW7Cg2M90JNyK-fwzVsnd5StkBdeWanv5Of1EDMfZY6sK3Z_UnA7qkB2u6Mm31rthr24Yh9J8hCZxAETxkKpd_zVvvy_bjUoqYZWkx2lI11v2lkQB3QgTn5tHPIV1NY5uGlweZZu1rH7UnUFrZF9TzBnL2hBOb82VfdJch3-kTp1UE9I2HTf5b0YmZtGX8Rozvvf4P40wG8V7WfKb0qab_rJuTF3XMXq3tHBsf5tm6eg4zfobEr_s2eoVJFXVQRXHzjWDCGg5wb_l7faPIaaKzXIBUNLA-wteHz06dGnYUlYVxv0PO5AwM54vaS_z8-ihS-c739CEMu1IeIp5FWjxApSIw2bg7LNXvHgCmhK87Y9nP2TzkIIKmJa2qiQKL-cycmTWc-15zwGraaFfshj-JiznHQ6Pxg4i5uie8nTfuCBdF0lgaVhZoJjQ_4hJeLnb5ON_f4PEr_14eaftxX1U9hvtXyeAj-pvTZkc_WSXBIuRKjdEuzy3MPORtQaQa2khASdhkeCqlavrV-KZWM0NWX8nEHNnJkLNIYqqrRSLbpw-49tjTqzfEVsX7bFOovtQuPfGUDMFU41vsLi52YYtc6i_gvronFdHk
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="scan_table_check">
<scan_table_check action="INSERT_OR_UPDATE">
<active>true</active>
<advanced>true</advanced>
<category>upgradability</category>
<conditions table="sys_properties">name=sn_atf.runner.enabled^value=false^EQ<item endquery="false" field="name" goto="false" newquery="false" operator="=" or="false" value="sn_atf.runner.enabled"/>
<item endquery="false" field="value" goto="false" newquery="false" operator="=" or="false" value="false"/>
<item endquery="true" field="" goto="false" newquery="false" operator="=" or="false" value=""/>
</conditions>
<description>Automate your testing with ServiceNow's Automated Test Framework to ensure functionality after updates and deployments.</description>
<documentation_url/>
<finding_type>scan_finding</finding_type>
<name>Encourage ATFs</name>
<priority>2</priority>
<resolution_details>https://docs.servicenow.com/bundle/xanadu-application-development/page/administer/auto-test-framework/task/atf-enable-tests.html&#13;
&#13;
https://www.servicenow.com/community/developer-forum/how-to-get-type-of-instance-via-script/m-p/2029442</resolution_details>
<run_condition/>
<score_max>100</score_max>
<score_min>0</score_min>
<score_scale>1</score_scale>
<script><![CDATA[(function (finding, current) {
// Checks if we are in a non-production instance
if (gs.getProperty("glide.installation.production") === "false")
finding.increment();

})(finding, current);]]></script>
<short_description>Validate ATFs are enabled in sub production instances</short_description>
<sys_class_name>scan_table_check</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2024-10-14 16:09:20</sys_created_on>
<sys_id>357638f05391521000b51901a0490e6e</sys_id>
<sys_mod_count>4</sys_mod_count>
<sys_name>Encourage ATFs</sys_name>
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
<sys_policy/>
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
<sys_update_name>scan_table_check_357638f05391521000b51901a0490e6e</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-10-14 16:26:20</sys_updated_on>
<table>sys_properties</table>
<use_manifest>false</use_manifest>
</scan_table_check>
<sys_translated_text action="delete_multiple" query="documentkey=357638f05391521000b51901a0490e6e"/>
<sys_es_latest_script action="INSERT_OR_UPDATE">
<id>357638f05391521000b51901a0490e6e</id>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2024-10-14 16:09:19</sys_created_on>
<sys_id>96baf8785391521000b51901a0490e96</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-10-14 16:09:19</sys_updated_on>
<table>scan_table_check</table>
<use_es_latest>true</use_es_latest>
</sys_es_latest_script>
</record_update>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?><record_update table="scan_table_check">
<scan_table_check action="INSERT_OR_UPDATE">
<active>true</active>
<advanced>true</advanced>
<category>manageability</category>
<conditions/>
<description>Always avoid using native js "document" object for DOM manipulation in service portal. Instead we should use AngularJS equivalent capabilities to achieve the same.</description>
<documentation_url/>
<finding_type>scan_finding</finding_type>
<name>Avoid using javascript "document" object in Portal</name>
<priority>1</priority>
<resolution_details/>
<run_condition/>
<score_max>100</score_max>
<score_min>0</score_min>
<score_scale>1</score_scale>
<script><![CDATA[(function (finding, current) {
var regex = /gel\s*\(|[\s\w\d]document\.[a-zA-Z]+|\.onchange\s*\(|\.onclick\s*\(|\$.+?\s*\(|Event\.|jQuery\s*\(/g;

var scriptValue = current.getValue("client_script") || "";
var matches = scriptValue.match(regex);

if (matches) {
matches.forEach(function(match) {
finding.increment();
});
}
})(finding, current);]]></script>
<short_description>Avoid using javascript "document" object in Portal</short_description>
<sys_class_name>scan_table_check</sys_class_name>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2024-10-14 17:36:18</sys_created_on>
<sys_id>e65c4d305315521000b51901a0490e38</sys_id>
<sys_mod_count>2</sys_mod_count>
<sys_name>Avoid using javascript "document" object in Portal</sys_name>
<sys_package display_value="Example Instance Checks" source="x_appe_exa_checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_package>
<sys_policy/>
<sys_scope display_value="Example Instance Checks">ca8467c41b9abc10ce0f62c3b24bcbaa</sys_scope>
<sys_update_name>scan_table_check_e65c4d305315521000b51901a0490e38</sys_update_name>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-10-14 17:44:48</sys_updated_on>
<table>sp_widget</table>
<use_manifest>false</use_manifest>
</scan_table_check>
<sys_translated_text action="delete_multiple" query="documentkey=e65c4d305315521000b51901a0490e38"/>
<sys_es_latest_script action="INSERT_OR_UPDATE">
<id>e65c4d305315521000b51901a0490e38</id>
<sys_created_by>admin</sys_created_by>
<sys_created_on>2024-10-14 17:36:18</sys_created_on>
<sys_id>54ae89b05315521000b51901a0490e99</sys_id>
<sys_mod_count>0</sys_mod_count>
<sys_updated_by>admin</sys_updated_by>
<sys_updated_on>2024-10-14 17:36:18</sys_updated_on>
<table>scan_table_check</table>
<use_es_latest>true</use_es_latest>
</sys_es_latest_script>
</record_update>
Loading