[jira] [Comment Edited] (KNOX-791) "&#x" render issue

2017-03-28 Thread Jeffrey E Rodriguez (JIRA)

[ 
https://issues.apache.org/jira/browse/KNOX-791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15946480#comment-15946480
 ] 

Jeffrey E  Rodriguez edited comment on KNOX-791 at 3/29/17 3:43 AM:


Would like bring up am issue that this Jira may have caused. Maybe the 
community at large can comment.

Before KNOX-791 "&" used to be decoded to "&" during html parsing.

The issue is that in OUT rewrite rule we will not able to match the query 
string.

Example:

given html
http://foo:99/test/&q=bar”>test

rule:
{code:xml}

 http://newtest/test/?{*}?{scheme}?{host}?{port}"/>
 
{code}

This rule above will not work since the “& amp;“ will not be matched.


The following test illustrates the issue of what we would like
to solve.
{code:title=testAmpRewrite.java|borderStyle=solid}
@Test
  public void testAmpRewrite() throws Exception {
URI goodUri, badUri, outputUri;
Matcher matcher;
Matcher.Match match;
Template input, pattern, template;
badUri = new URI(
"http://foo:99/test/&q=bar";); // we should be able to match
goodUri = new URI(
"http://foo:99/test/?q=bar";);

input = Parser.parseLiteral(goodUri.toString());
pattern = Parser.parseTemplate("{scheme}://{host}:{port}/test/?{*}");
template = 
Parser.parseTemplate("http://newtest/test/?{*}?{scheme}?{host}?{port}";);

// Match query string
String expectedUri = 
"http://newtest/test/?scheme=http&host=foo&port=99&q=bar";;
matcher = new Matcher();
matcher.add(pattern, null);
match = matcher.match(input);
assertNotNull( match );
outputUri = Expander.expand(template, match.getParams(), null);
assertEquals("Not matched", expectedUri, outputUri.toString());//

// no match of query string ?
input = Parser.parseLiteral(badUri.toString()); 
match = matcher.match(input);
assertNull( match); // Shows that we are not able to match ?
  }

{code}

Maybe we should made an exception for "&" on a query string. Another 
alternative is to add a decode option or alternative way to decode the encoded 
"&".

This is causing some issues on the Spark UI through Knox we are planning 
contributing.

Thanks.
   Jeff Rodriguez




was (Author: jeffreyr97):
Would like bring up am issue that this Jira may have cause. Maybe the community 
at large can comment.

Before KNOX-791 "&" used to be decoded to "&" during html parsing.

The issue is that in OUT rewrite rule we will not able to match the query 
string.

Example:

given html
http://foo:99/test/&q=bar”>test

rule:
{code:xml}

 http://newtest/test/?{*}?{scheme}?{host}?{port}"/>
 
{code}

This rule above will not work since the “& amp;“ will not be matched.


The following test illustrates the issue of what we would like
to solve.
{code:title=testAmpRewrite.java|borderStyle=solid}
@Test
  public void testAmpRewrite() throws Exception {
URI goodUri, badUri, outputUri;
Matcher matcher;
Matcher.Match match;
Template input, pattern, template;
badUri = new URI(
"http://foo:99/test/&q=bar";); // we should be able to match
goodUri = new URI(
"http://foo:99/test/?q=bar";);

input = Parser.parseLiteral(goodUri.toString());
pattern = Parser.parseTemplate("{scheme}://{host}:{port}/test/?{*}");
template = 
Parser.parseTemplate("http://newtest/test/?{*}?{scheme}?{host}?{port}";);

// Match query string
String expectedUri = 
"http://newtest/test/?scheme=http&host=foo&port=99&q=bar";;
matcher = new Matcher();
matcher.add(pattern, null);
match = matcher.match(input);
assertNotNull( match );
outputUri = Expander.expand(template, match.getParams(), null);
assertEquals("Not matched", expectedUri, outputUri.toString());//

// no match of query string ?
input = Parser.parseLiteral(badUri.toString()); 
match = matcher.match(input);
assertNull( match); // Shows that we are not able to match ?
  }

{code}

Maybe we should made an exception for "&" on a query string. Another 
alternative is to add a decode option or alternative way to decode the encoded 
"&".

This is causing some issues on the Spark UI through Knox we are planning 
contributing.

Thanks.
   Jeff Rodriguez



> "&#x" render issue
> --
>
> Key: KNOX-791
> URL: https://issues.apache.org/jira/browse/KNOX-791
> Project: Apache Knox
>  Issue Type: Bug
>Reporter: Prabhjyot Singh
>Assignee: Sandeep More
> Fix For: 0.11.0
>
> Attachments: KNOX-791.001.patch, KNOX-791.002.patch, ss.png
>
>
> If "&#x" is used as a value for any attribute in any tag say  or  
> then it is being treated/rendered different.
> An example to reproduce will be 
> {code:java}
> 
> {code}
> The above should look like; !ss.png|screen shot!
> Or another example would be:
> {code:java}
> http://g

[jira] [Comment Edited] (KNOX-791) "&#x" render issue

2016-12-12 Thread Sandeep More (JIRA)

[ 
https://issues.apache.org/jira/browse/KNOX-791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15743305#comment-15743305
 ] 

Sandeep More edited comment on KNOX-791 at 12/12/16 10:09 PM:
--

Aww shoot ! sorry about that, uploaded the correct patch now. KNOX-801 seems 
like a definite overlap, there is less information to test though but looks 
like a overlap. I tested with the following example {{test link}} without the patch 
{{https://localhost:9443/test?chapt=2%C2%A7=3}} with the patch 
{{https://localhost:9443/test?chapt=2§=3}}. 


was (Author: smore):
Aww shoot ! sorry about that, uploaded the correct patch now. KNOX-801 seems 
like a definite overlap, there is less information to test though but looks 
like a overlap. I tested with the following example {{ test link }} without the patch {{ 
https://localhost:9443/test?chapt=2%C2%A7=3 }} with the patch {{ 
https://localhost:9443/test?chapt=2§=3 }}. 

> "&#x" render issue
> --
>
> Key: KNOX-791
> URL: https://issues.apache.org/jira/browse/KNOX-791
> Project: Apache Knox
>  Issue Type: Bug
>Reporter: Prabhjyot Singh
>Assignee: Sandeep More
> Fix For: 0.11.0
>
> Attachments: KNOX-791.001.patch, ss.png
>
>
> If "&#x" is used as a value for any attribute in any tag say  or  
> then it is being treated/rendered different.
> An example to reproduce will be 
> {code:java}
> 
> {code}
> The above should look like; !ss.png|screen shot!
> Or another example would be:
> {code:java}
> http://google.com/param1=123&#xparam2=890";>test link
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)