Dumb question

40 views
Skip to first unread message

David Curry

unread,
Nov 14, 2017, 11:47:46 AM11/14/17
to cas-...@apereo.org

I'm looking at the cas.adminPagesSecurity.ip property setting in the Maven overlay, which comes set as follows:

cas.adminPagesSecurity.ip=127\.0\.0\.1

But since the backslash is a special character in Java properties files, shouldn't that be:

cas.adminPagesSecurity.ip=127\\.0\\.0\\.1

so that the backslash makes it into the regular expression (making the '.' match a '.' instead of any character)?

I could've sworn it used to be that way in the overlay (and it jumped out at me as a potential mistake in the regular expression I replaced it with), but now, checking everything I can find, it seems that it was never that way (or at least not any time recently).

The only other example of a regular expression in the properties file I can find in the documentation is this one:

cas.authn.pm.policyPattern=^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,10}


Am I confused? Should it be single backslashes, or double?

--Dave

--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu

The New School

cur...@newschool.edu

unread,
Nov 14, 2017, 11:50:00 AM11/14/17
to CAS Community
Sorry, clicked "send" by mistake. Repeating the message (with the rest of it) here

I'm looking at the cas.adminPagesSecurity.ip property setting in the Maven overlay, which comes set as follows:

cas.adminPagesSecurity.ip=127\.0\.0\.1

But since the backslash is a special character in Java properties files, shouldn't that be:

cas.adminPagesSecurity.ip=127\\.0\\.0\\.1

so that the backslash makes it into the regular expression (making the '.' match a '.' instead of any character)?

I could've sworn it used to be that way in the overlay (and it jumped out at me as a potential mistake in the regular expression I replaced it with), but now, checking everything I can find, it seems that it was never that way (or at least not any time recently).

The only other example of a regular expression in the properties file I can find in the documentation is this one:

cas.authn.pm.policyPattern=^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,10}

which does indeed include double backslashes.

Am I confused? Should the pattern for the IP address contain single backslashes, or double?

--Dave 

Waldbieser, Carl

unread,
Nov 14, 2017, 12:25:19 PM11/14/17
to cas-user

I just use:

cas.adminPagesSecurity.ip=127\.0\.0\.1

Seems to work how I would expect.

Thanks,
Carl Waldbieser
ITS Identity Management
Lafayette College
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/9cedfe31-e2e1-4f5e-b8f0-14b84f0fcff6%40apereo.org.

David Curry

unread,
Nov 14, 2017, 1:01:24 PM11/14/17
to cas-...@apereo.org
I agree that in the particular case of IP addresses, it probably doesn't matter, because the '.' is going to match either a '.' or a single character of any value but that will almost always be a '.' anyway, since IP addresses have a more or less fixed format.

I guess my question is a bit more general than this particular regular expression -- IF the intent is to have a backslash appear in a regular expression that's given as a value to a property in cas.properties, shouldn't the backslash be doubled (in which case the default is "wrong")?


--Dave


--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu

The New School


To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/1539672735.90113090.1510680316099.JavaMail.zimbra%40lafayette.edu.

Reply all
Reply to author
Forward
0 new messages