Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Ask a question about regex in CRS

Access Controls
(10 lines)
Trustwave Acquires Breach Security and with it ModSecurity
(13 lines)
Jun 21, 2010
Neo Liu
Neo Liu
Hi, everyone
    The following rule comes from
rules/base_rules/modsecurity_crs_41_sql_injection_attacks.conf , but I
don't understand what does the regular expression "(?:[\\\(\)\%#]|--)"
mean. What's the meaning of "\%" in a regex?

SecRule MATCHED_VAR "(?:[\\\(\)\%#]|--)"
        
"t:none,setvar:'tx.msg=%{rule.msg}',setvar:tx.sql_injection_score=+%{tx.critical_anomaly_score},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_ATTACK/SQL_INJECTION-%{matched_var_name}=%{tx.0}"


Reply
Tags: regex
Messages in this thread
Ask a question about regex in CRS
reply Re: Ask a question about regex in CRS
(45 lines) Jun 24, 2010 10:40
Similar Threads
A question about android regex implementation
Hi  Jesse and All,
I have written some simple benchmarks for harmony regex and find the
performance of harmony is poor compared to RI. For example, Mathcer.find()
only reach 60% of that of RI. I heard Android use icu4jni re-implement
this
module. Since icu4jni use native code I think it may has higher
performance
than harmony. I am trying to use icu4jni as the back-end of harmony regex
but find icu4jni has no functions related to regex operations.
I know there are some android guys in our community. So can anyone tell me
some detail info for android's regex, like if it re-implement the regex
logic using native code by android itself rather than icu4jni and really
get
higher performance compared to harmony regex? Thanks a lot!


Using Regex
All,

 

I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?

 

Sample code that is throwing errors:

 

myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");

 

error: invalid escape sequence.

 

Thanks,

 

Matt

 



Using variables in regex
Well, how do I use the content of a variable in regex?

$username = "user1"
file {  "userdata.tar.bz2":
                source => "puppet://$server/modules/$module/
userdata.tar.bz2",
                ensure => $users ? {
                                /$username/ => absent,
                                default => present,
                        },
}

$users is a custom fact that contains all local users:

users => at avahi bin daemon dnsmasq ftp games haldaemon lp mail
messagebus nobody ntp polkituser postfix pulse root sshd suse uuidd
wwwrun man news uucp puppet user1

When I hardcode "user1" into the regex my test works fine and the file
is removed.

But things like /$variable/ or /\$variable/ or /#{variable}/ just
don't work.
Is it even possible in version 0.25.4?





Using Regex in Embedded Pig in Java
All,

 

I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?

 

Sample code that is throwing errors:

 

myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");

 

error: invalid escape sequence.

 

Thanks,

 

Matt



Issues with Node Regex

I am trying to match groups of nodes - i.e.

Node: synd1-path2.path2.some.domain
Node: synd2-path2.path2.some.domain

By using either of the node definitions below:

node /^synd\w+\.path2\.some\.domain$/ {
    include ibapps
    include db
}


client-side password validation using regex
Hi all,

I was wondering if it's possible to validate a <html:password> field
on client-side by using a regular expression.
A look at validateMask.js told me that the only field types supported are
'hidden', 'text', 'textarea' and 'file'.

Code:

            if ((field.type == 'hidden' ||
                field.type == 'text' ||
                 field.type == 'textarea' ||
                                 field.type == 'file') &&
                 (field.value.length > 0)) {

                if (!jcv_matchPattern(field.value, oMasked[x][2]("mask")))
{
                    if (i == 0) {
                        focusField = field;
                    }
                    fields[i++] = oMasked[x][1];
                    isValid = false;
                }
            }


Is this the exspected behavior? Is there any reason for not supporting
'password' fields?
If so, how would I validate a password field by using a regex (without
changing the js file on my own :))?

Cheers,


Ref. 324 * Geoinformationszentrum
Tel. 0211 9449-6310 * Fax: 0211 9449-6610
Email: stephan.### @it.nrw.de<mailto:stephan.k### @it.nrw.de>



Created: (HIVE-1483) Update AWS S3 log format deserializer regex
Update AWS S3 log format deserializer regex

Question about CL.ZERO
Hi all,

  Does it mean that the coordinator node always return success to the
client
at CL.ZERO? But if the coordinator node sends a request to a given node
B(RF=1), then B is down, what happened? The coordinator node will write
the
hint locally?

Thanks.

Shen


LZO Question
Hello?
    I got source code from
http://github.com/kevinweil/hadoop-lzo?compiled 
them successfully,and then
1?copy hadoop-lzo-0.4.4.jar to directory:$HADOOP_HOME/lib of each master
and 
slave
2?Copy all files under directory:../Linux-amd64-64 to directory:
$HADDOOP_HOME/lib/native/Linux-amd64-64 of each master and slave
3,and upload a file:test.lzo to HDFS
4?then run?hadoop jar $HADOOP_HOME/lib/hadoop-lzo-0.4.4.jar 
com.hadoop.compression.lzo.DistributedLzoIndexer test.lzo to test

got errors?

LZO Question
Hello?
    I got source code from
http://github.com/kevinweil/hadoop-lzo?compiled 
them successfully,and then
1?copy hadoop-lzo-0.4.4.jar to directory:$HADOOP_HOME/lib of each master
and 
slave
2?Copy all files under directory:../Linux-amd64-64 to directory:
$HADDOOP_HOME/lib/native/Linux-amd64-64 of each master and slave
3,and upload a file:test.lzo to HDFS
4?then run?hadoop jar $HADOOP_HOME/lib/hadoop-lzo-0.4.4.jar 
com.hadoop.compression.lzo.DistributedLzoIndexer test.lzo to test

got errors?

propertyregex question
Here's my input

abc/long/distance

I want to get abc back.  Here's my code

<propertyregex property="myprop"
              input="${input}"
              regexp="(.*)/*"
              select="\0"
              casesensitive="false" />

but I got back the whole string (abc/long/distance)

Do you have any ideas?

Thanks




Bootstrap question
Hi,

  I have a 0.6.3 cluster which contains 6 nodes.  I added 6 new nodes
by setting AutoBootstrap to true and setting an InitialToken on each new
node, then waiting for the "Bootstrapping" message in the log before
starting another.  Then I've been watching the logs on the old boxes
waiting to see AntiCompaction messages.

Unfortunately after several hours I only see 1 of the 6 old nodes has
the AntiCompaction message.  The new nodes are placed such that every
old node should have some data pulled from it.  Why don't I see more
Anti Compaction messages?  Are there other things I should be looking
at?

Thanks,

-Anthony




TS SDK Question on Plugins
Hi Folks,

Couple of question related to the Append Transform Plugin:

1. The except below is from example/append-transform.c

    How can I print the data in the buffers? I would like to print the
strings being created/appended.
    The buffer is a opaque data structure (ts.h: typedef void
*INKIOBufferReader)

 if (data->append_needed) {
      data->append_needed = 0;
      INKIOBufferCopy(INKVIOBufferGet(data->output_vio),
append_buffer_reader, append_buffer_length, 0);
      ...
}

2. Are there utilities in TS or SDK to help parse HTML files fetched from
orgin server?

Thanks,
Manish


Question on ClientAbortException
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/connector/ClientAbortException.html

What does this mean exactly?  A user makes a request for a resource and
closes the browser before they get the response?


Jul 2, 2010 10:04:27 AM com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: executePhase(RENDER_RESPONSE
6,com.sun.faces.conte### @1efe4ac) threw exception
javax.faces.FacesException
        at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:135)
        at
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
        at
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
        at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
        at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
        at java.lang.Thread.run(Thread.java:619)
Caused by: ClientAbortException:  java.io.IOException
        at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:358)
        at
org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
        at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:309)
        at
org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)
        at
org.apache.catalina.connector.Response.flushBuffer(Response.java:548)
        at
org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:279)
        at
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:203)
        at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
        ... 32 more
Caused by: java.io.IOException
        at
org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:696)
        at
org.apache.coyote.http11.InternalAprOutputBuffer$SocketOutputBuffer.doWrite(InternalAprOutputBuffer.java:726)
        at
org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:124)
        at
org.apache.coyote.http11.InternalAprOutputBuffer.doWrite(InternalAprOutputBuffer.java:532)
        at org.apache.coyote.Response.doWrite(Response.java:560)
        at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
        ... 39 more


Using CATALINA_BASE:   "C:\apache-tomcat-6.0.26"
Using CATALINA_HOME:   "C:\apache-tomcat-6.0.26"
Using CATALINA_TMPDIR: "C:\apache-tomcat-6.0.26\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.6.0_20"
Using CLASSPATH:       "C:\apache-tomcat-6.0.26\bin\bootstrap.jar"
Server version: Apache Tomcat/6.0.26
Server built:   March 9 2010 1805
Server number:  6.0.26.0
OS Name:        Windows 2003
OS Version:     5.2
Architecture:   x86
JVM Version:    1.6.0_20-b02
JVM Vendor:     Sun Microsystems Inc.
Using CATALINA_BASE:   "C:\apache-tomcat-6.0.26"
Using CATALINA_HOME:   "C:\apache-tomcat-6.0.26"
Using CATALINA_TMPDIR: "C:\apache-tomcat-6.0.26\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.6.0_20"
Using CLASSPATH:       "C:\apache-tomcat-6.0.26\bin\bootstrap.jar"
Server version: Apache Tomcat/6.0.26
Server built:   March 9 2010 1805
Server number:  6.0.26.0
OS Name:        Windows 2003
OS Version:     5.2
Architecture:   x86
JVM Version:    1.6.0_20-b02
JVM Vendor:     Sun Microsystems Inc.

Leo Donahue



SqlSession question
Hello

I am new to iBatis (3) and try to develop a standalone client system.
So I am really interested in some best practices by using the
SqlSession and handling the session management.

The documentation says:
"Instances of SqlSession are not to be shared and are not thread
safe. ... Never keep references to a SqlSession instance in a static
field or even an instance field of a class." (page 9)

So I'm not quite sure if I really need a new SqlSession for EVERY
INSERT, UPDATE or SELECT query?! And how can I handle my transactions,
when they are distributed across more than one DAO-class?

Thanks a lot...
Nico


Question about context.xml
Hello,
 
I'm sure this question has been posted in the past already, but when 
searching for "Tomcat 6 context.xml" (or similar) I didn't find anything 
which described my question.

My question is about the several possibility to declare <context> 
elements for configuring JNDI resources in Tomcat 6 configuration.
In Tomcat 6 documentation 
(http://tomcat.apache.org/tomcat-6.0-d...-howto.html#conte
xt.xml%20configuration) there are described to ways to configure JNDI 
resources for a webapp:
* in $CATALINA_BASE$/conf/server.xml
* in META-INF/context.xml for each webapp

AFAIK there is an additional possibilities two configure JNDI resources:
* in $CATALINA_BASE$/conf/Catalina/localhost/<name-of-web-app>.xml
Is that correct?

And why is there a context.xml in $CATALINA_BASE/conf and what is it 
for? Would be happy if someone could help me out with this.

Best regards,

Abid


question : how to get debug log
Hi expert

 

I would like get the further detail log defined in the source in such a
way that a) containerLog.debug() or log.isDebugEnabled().

I tried to change log level defined in conf/logging.properties, but I am
not getting what I want.

 

For example, if I want to print debug message from singlesignon class in
Catalina.out, could someone tell me what to do?

 

Thanks, 

 



RE: another question on RequestDispatcherProvider
I am implementing similar functionality, I am forwarding to login.jsp
using
requestDispatcher, but seems to be it does't work.
if you have peace of code with all the steps related to this helps me lot.
Thanks
Rajesh Badam


Paul Wilton wrote:
 
 No worries - thanks for helping me out.
 
  
 
  
 
 From: Sergey Beryozkin [mailto:sbery### @progress.com] 
 Sent: 06 January 2010 12:31
 To: use### @cxf.apache.org; Paul Wilton; us### @cxf.apache.org
 Subject: RE: another question on RequestDispatcherProvider
 
  
 
  
 
 Hi,
 
 I've verified that the 2nd option (using CXFServlet) is basically
 identical to the first one, I had to do :
 
 <init-param>
     <param-name>redirect-list</param-name>
     <param-value>/WEB-INF/book.jsp</param-value>
 </init-param>
 
 <init-param>
     <param-name>redirect-servlet-name</param-name>
     <param-value>jsp</param-value>
 </init-param>
 
 Without the redirect-servlet-name parameter CXFServlet with a "/"
 pattern will be reentered after this CXFServlet has tried to forward.
 
 So, to summarize, if we have CXFServlet with a "/" pattern then the
 following options are available as far as redirection to jsp or
indeed
 some other resources/servlets is concerned :
 
 1. RequestDispacterProvider configuration in Spring has to include a
 dispatcherName property to avoid a CXFServlet reentrance.
 2. Alternatively, CXFServlet has to include the 2 init parameters,
 similar to the above one, but for private resources the option 1
would
 likely be preferred and indeed option 1 will be just slightly more
 effective
 It might make sense to combine the 2 options if users are allowed to
 directly interact with some resources, ex, when redirecting to diff
URIs
 or when both external users and RequestDispatcherProvider reuse the
same
 resources such as JSP pages, etc
 
 thanks Paul for experimenting with this feature
 cheers, Sergey
 
 
 
 
 -----Original Message-----
 From: Sergey Beryozkin [mailto:sber### @progress.com]
 Sent: Wed 1/6/2010 5:03 AM
 To: Paul Wilton; us### @cxf.apache.org
 Subject: RE: another question on RequestDispatcherProvider
 
 
 Hi Paul
 
 thanks for the confirmation, I'll update the docs. But will also play
a
 bit with the 2nd option to make sure it also works given that both
 RequestDispatchProvider and CXFServlet will create a custom
 HttpServletRequest wrapper, so I'd like to test that no interference
 will occur...
 
 cheers, Sergey
 
 -----Original Message-----
 From: Paul Wilton [mailto:Paul.### @bbc.com]
 Sent: Wed 1/6/2010 5:01 AM
 To: Sergey Beryozkin; us### @cxf.apache.org
 Subject: RE: another question on RequestDispatcherProvider
 
 Hi Sergey
 
 Option 1 works : )
 
 
 
 Thanks
 
 Paul
 
 
 
 
 
 From: Sergey Beryozkin [mailto:sbery### @progress.com]
 Sent: 05 January 2010 17:45
 To: Paul Wilton; use### @cxf.apache.org
 Subject: RE: another question on RequestDispatcherProvider
 
 
 
 
 
 Hi Paul
 
 I have tried to modify CXFServlet listening on '/' to block if it is
a
 /WEB-INF/* pathImfo which is being processed now, but I've observed
what
 you did. Basically, when a RequestDispatcherProvider forwards, the
first
 servlet which gets this forward request is the same CXFServlet so
 blocking it just results in the original forward request being
blocked
 and thus an empty response is returned.
 
 So here is what can be done here :
 
 1. add
 
 <property name="dispatcherName" value="jsp"/>
 
 to
 
 <bean id="dispatchProvider1"
 class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
 
         <property name="resourcePath"
value="/WEB-INF/jsp/test.jsp"/>
 
         <property name="scope" value="request"/>
 
     </bean>
 
 it will restrict the space a bit and will exclude CXFServlet from a
list
 of candidates, as far as RequestDispatcher.forward(...) is concerned.
 
 
 I have tried it from Eclipse, though I will need to update it to
ensure
 JDK but not JRE is used by default for JSP pages be compiled...But
 CXFServlet is definitely bypassed.
 
 2. If it is feasible to make your jsp pages public by moving them one
 level higher from /WEB-INF, say to /jsp/..., then configuring
CXFServlet
 to redirect to /jsp/test.jsp will do the trick. What will happen is
that
 RequestDispatcherProvider will forward and CXFServlet will forward it
 further... I think the reason it could not forward to /WEB-INF was
that
 private resources under /WEB-INF are not visible at the CXFServlet
 level...
 
 hope it helps, can you please try one of the above options ?
 
 thanks, Sergey
 
 -----Original Message-----
 From: Paul Wilton [mailto:Paul.W### @bbc.com]
 Sent: Tue 1/5/2010 10:01 AM
 To: Sergey Beryozkin
 Cc: us### @cxf.apache.org
 Subject: RE: another question on RequestDispatcherProvider
 
 Hi Sergey
 
 I have tried extending the CXFServlet and overriding the redirect
method
 as you suggest. But the response is empty by that time -
 
 By the time redirect method is invoked has the CXFServlet already
 intercepted the  .jsp request and created a new Response (discarding
the
 one generated when the JSP was initially processed by the servlet
 container) ?
 
 
 
 
 This e-mail (and any attachments) is confidential and may contain
 personal views which are not the views of the BBC unless specifically
 stated. If you have received it in error, please delete it from your
 system. Do not use, copy or disclose the information in any way nor
act
 in reliance on it and notify the sender immediately.
 
 Please note that the BBC monitors e-mails sent or received. Further
 communication will signify your consent to this
 
 This e-mail has been sent by one of the following wholly-owned
 subsidiaries of the BBC:
 
 BBC Worldwide Limited, Registration Number: 1420028 England,
Registered
 Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
 BBC World News Limited, Registration Number: 04514407 England,
 Registered Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
 BBC World Distribution Limited, Registration Number: 04514408,
 Registered Address: BBC Media Centre, 201 Wood Lane, London, W12 7TQ
 
 
 
 
 
 
 
 





Newbie question
Hi all,
I'm just starting with CXF and i have a question.
I have to store a variable in the session, but i can' t seem to find how i
can do that.
Can anyone help me with that?
thanks a bunch
Ted