Instance scan - Column type check

shivaadapa
Tera Expert

shivaadapa_0-1705052827227.png

Hi 

I am trying to serach for querying against 'sys_object_source' table in all the script fields in the instance. But the above code is not working please help me.
Help me to provide how to keep correct regular expressions.

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

O really small though essential typo I made, here is working tested code:

 

(function (engine) {

	// Remove code comments
	var commentsRegEx = /\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm;
	var commentsRemovedValue = engine.columnValue.replace(commentsRegEx, '');

	var search_regex = /\bGlideRecord\(['"]sys_object_source['"]\)/gm;

	// Create scan finding
	if(search_regex.test(commentsRemovedValue)) {
		engine.finding.increment();
	}

})(engine);

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

24 REPLIES 24

Maik Skoddow
Tera Patron
Tera Patron

Hi @shivaadapa 

you observation is correct. By any reasons I don't understand, the Column type check always exclude the untouched OOTB artifacts and only include the customized and custom artifacts. Therefore, I replaced most of my checks with other types.

Maik

"By any reasons I don't understand"

It's just designed like that šŸ™‚ Would be nicer to have a checkbox or something on a check to be able to include/exclude untouched out-of-the-box, though unfortunately its just this way and no one at ServiceNow is developing anymore on Instance Scan so probably will stay this way forever.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

How should I check script fields are gliding against sys_object_source table. can I use any other checks? 

please help me!

You are really making a mess of all your questions. I've already answered this in one of your other questions. We cannot help you if you are making such a mess of this.

 

"Like I mentioned in one of your other questions: if you want out-of-the-box findings also to appear: Script Only Check is your goto."

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hi @Mark Roethof 

I already showed you that it's not giving custom ones also. so, that's why i am asking is there any another way?

please help me!