-
Notifications
You must be signed in to change notification settings - Fork 215
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
add example code and docs to demonstrate matching data: and tel: URLs #21
Comments
Bump to revisit. Mike, perhaps just give me one complex example and I'll use it to flesh out the docs. |
Can't this be achieved with just
It's hardly much of a stretch to figure how to change that for other protocols. |
No. I have allowUrlProtocols("mailto", "javascript", "tel", "https") and this allows https and mailto. But tel & javascript gets stripped. |
I put together #126 to try to fill this gap. It integrates a URL classifier engine that lets you express predicates over URLs like /** We define a classifier with a declarative syntax */
static final UrlClassifier CLASSIFIER = UrlClassifiers.builder()
// We want to allow HTTP and HTTPS for this example
.scheme(BuiltinScheme.HTTP, BuiltinScheme.HTTPS)
.authority(
AuthorityClassifiers.builder()
// We whitelist some subdomains of hosts we trust.
.host("**.example.com", "**.example.net")
.build())
// We allow access to .html files
.pathGlob("**.html")
.build(); I haven't integrated it because I don't know if anyone needs that level of flexibility. It does have better support for data and tel URLs. If that looks useful, I can move that in. |
Seems it could save a lot of "custom" work. No I also do some substring and regex checks of URLs using apply method of ElementPolicy. |
This issue is about docs and examples. |
There is no hostility in this thread that I see. We mean well.
|
I'm trying to fit my pro-bono work, including this project, in between a lot of other stuff. Sorry if I was abrupt, but I have no hostility towards you. https://greatergood.berkeley.edu/article/item/six_tips_for_reading_emotions_in_text_messages
I have not read the If issue #22 is where you want to discuss it that's great. Recency doesn't matter to me.
That PR includes Scheme's control how raw parts are composed into a string. I don't know if I got that correct, because I've not seen a failing testcase. https://github.com/OWASP/url-classifier/blob/master/src/test/java/org/owasp/url/UrlValueTest.java has tests for encoding of percents so that, e.g. |
I have misinterpreted your response and I apologize. I must admit my initial comment concerning the PR wasn't too clear either. Thank you for your detailed response, the part concerning javascript escaping is especially relevant and helpful in this context. I'll try out the test cases and the classifier library in more detail and comment with a test case once I have something more tangible. |
Original issue reported on code.google.com by
[email protected]
on 21 Jan 2014 at 4:04The text was updated successfully, but these errors were encountered: