[windup-dev] Fwd: [WindUp] Regular expression to detect filesystem paths

Marek Novotny mnovotny at redhat.com
Wed Apr 20 10:02:56 EDT 2016


forgot to include Romain in CC

On 20.4.2016 16:01, Brad Davis wrote:
> +1 -- it is not only important for Windows to Linux, but also for identifying file read / writes that need to be mounted for cloud deployments to things like OpenShift.
> 
> Brad Davis
> Director of FSI Solutions, Red Hat Consulting
> Email: bdavis at redhat.com | c: 980.226.7865 | http://www.redhat.com 
> 
> ----- Original Message -----
> From: "Marek Novotny" <mnovotny at redhat.com>
> To: "Windup-dev List" <windup-dev at lists.jboss.org>
> Sent: Wednesday, April 20, 2016 9:49:31 AM
> Subject: [windup-dev] Fwd: [WindUp] Regular expression to detect filesystem	paths
> 
> adding windup-dev ml as this could be interested to Windup community.
> 
> 
> Romain,
> 
>  I would go with simplified pattern for every unique occurrence to more
> more general one.
> 
> So try to use <or></or> and condition patterns in it.
> Something like the following:
> 
>  <rule id="filesystem-paths-properties">
> 	<when>
> 		<or>
> 			<filecontent filename="{*}.{extensions}"
> 				pattern="{filesystem}" />
> 			<filecontent filename="{*}.{extensions}"
> 				pattern="{netfilesystem}" />
> 			<filecontent filename="{*}.{extensions}"
> pattern="page import="{filesystem}" />
> 		</or>
> 	</when>
> 	<perform>
> 		<hint message="File system properties" effort="1"
> 		severity="mandatory">
> 			<message>
> 			TODO
> 			</message>
> 		</hint>
> 	</perform>
> 	<where param="extensions">
> 		<matches pattern="(java|properties|jsp|jpsf|tag|xml|txt)" />
> 	</where>
> 	<where param="filesystem">
> 		<matches pattern="(\S:[\\|/])" />
> 	</where>
> 	<where param="netfilesystem">
> 		<matches pattern="(\\\\ntfileserver\)" />
> 	</where>
> 	<where param="netfilesystem">
> 		<matches pattern="" />
> 	</where>
> </rule>
> 
> -------- Forwarded Message --------
> Subject: 	[WindUp] Regular expression to detect filesystem paths
> Date: 	Wed, 20 Apr 2016 15:29:03 +0200
> From: 	Roman Martin Gil <rmarting at redhat.com>
> To: 	Marek Novotny <mnovotny at redhat.com>
> 
> 
> 
> Hi,
> 
> I am very obfuscated to create a rule to identify some filesystem paths
> patterns. I am trying to detect when the code (.java, .properties) have
> the following entries:
> 
>   * "c:\\"
>   * "e:\\"
>   * "c:/"
>   * "e:/"
>   * "\\\\ntfileserver\"
>   * "page import="""
> 
> 
> My first approach is similar to:
> 
>         <rule id="filesystem-paths-properties">
>             <when>
>                 <filecontent filename="{*}.{extensions}"
> pattern="{filesystem}" />
>             </when>
>             <perform>
>                 <hint message="File system properties" effort="1"
> severity="mandatory">
>                     <message>
>                         TODO
>                     </message>
>                 </hint>
>             </perform>
>             <where param="extensions">
>                 <matches pattern="(java|properties|jsp|jpsf|tag|xml|txt)" />
>             </where>
>             <where param="filesystem">
>                 <matches pattern="((c|e):|[\\])" />
>             </where>
>         </rule>
> 
> However I am detecting cases as "Message: " as a pattern. How could I
> create a rule to identify these cases?
> 
> Thank you very much in advance
> 
> PD: What is the better mail list to send it?
> 
> 


-- 
Marek Novotny
--
Windup team member and Seam Project Lead

Red Hat Czech s.r.o.
Purkynova 99
612 45 Brno


More information about the windup-dev mailing list