Bug 1064217

Summary: SAML Assertion parsing - empty AttributeValue raises exception
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Kunjan Rathod <krathod>
Component: PicketLinkAssignee: Peter Skopek <pskopek>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Slavicek <pslavice>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2.0CC: bdawidow, jkudrnac, kkhan, okotek, psilva, pslavice, rmody
Target Milestone: DR11   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1164220    
Bug Blocks:    
Attachments:
Description Flags
TESTCASE none

Description Kunjan Rathod 2014-02-12 09:10:03 UTC
Created attachment 862164 [details]
TESTCASE

Description of problem:
PLINK2-10 added support for AttributeValue elements with nested elements. However, this 'fix' introduced another issue. Namely, when an AttributeValue exists but its empty in it. The 'mvn test' fails with 'showParserIsFailingWithEmptyAttributeValue(ParserTest): PL00069: Parser: Type not supported:AttributeValue'

Version-Release number of selected component (if applicable):


How reproducible:
Run mvn test on the uploaded PLINK2-126.zip(de-compress it) and you should get 'showParserIsFailingWithEmptyAttributeValue(ParserTest): PL00069: Parser: Type not supported:AttributeValue'. 

Steps to Reproduce:
1.Run mvn test on PLINK1-126
[krathod@dhcp223-143 PLINK2-126]$ mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building picketlinkbug 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/junit/junit/4.10/junit-4.10.pom
Downloaded: http://repo.maven.apache.org/maven2/junit/junit/4.10/junit-4.10.pom (3 KB at 1.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom (481 B at 0.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom (6 KB at 9.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/picketlink/picketlink-core/2.1.9.SP2/picketlink-core-2.1.9.SP2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/picketlink/picketlink-core/2.1.9.SP2/picketlink-core-2.1.9.SP2.pom (6 KB at 9.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/picketlink/picketlink-fed-parent/2.1.9.SP2/picketlink-fed-parent-2.1.9.SP2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/picketlink/picketlink-fed-parent/2.1.9.SP2/picketlink-fed-parent-2.1.9.SP2.pom (9 KB at 12.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/log4j/log4j/1.2.14/log4j-1.2.14.pom

...


-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running ParserTest
log4j:WARN No appenders could be found for logger (org.picketlink.identity.federation).
log4j:WARN Please initialize the log4j system properly.
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.223 sec <<< FAILURE!
showParserIsFailingWithEmptyAttributeValue(ParserTest)  Time elapsed: 0.008 sec  <<< ERROR!
java.lang.RuntimeException: PL00069: Parser: Type not supported:AttributeValue
	at org.picketlink.identity.federation.DefaultPicketLinkLogger.unsupportedType(DefaultPicketLinkLogger.java:184)
	at org.picketlink.identity.federation.core.parsers.util.SAMLParserUtil.parseAttributeValue(SAMLParserUtil.java:308)
	at org.picketlink.identity.federation.core.parsers.util.SAMLParserUtil.parseAttributeType(SAMLParserUtil.java:276)
	at org.picketlink.identity.federation.core.parsers.util.SAMLParserUtil.parseAttribute(SAMLParserUtil.java:229)
	at org.picketlink.identity.federation.core.parsers.util.SAMLParserUtil.parseAttributeStatement(SAMLParserUtil.java:204)
	at org.picketlink.identity.federation.core.parsers.saml.SAMLAssertionParser.parse(SAMLAssertionParser.java:145)
	at org.picketlink.identity.federation.core.parsers.saml.SAMLParser.parse(SAMLParser.java:71)
	at org.picketlink.identity.federation.core.parsers.AbstractParser.parse(AbstractParser.java:111)
	at ParserTest.showParserIsFailingWithEmptyAttributeValue(ParserTest.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


Actual results:

Tests in error: 
  showParserIsFailingWithEmptyAttributeValue(ParserTest): PL00069: Parser: Type not supported:AttributeValue

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:28.712s
[INFO] Finished at: Mon Feb 10 08:44:15 GMT 2014
[INFO] Final Memory: 13M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project picketlinkbug: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/krathod/NotBackedUp/krathod/cases/security-new/01035830-Picketlink/FSBTC/PLINK2-126/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
==========================================================


Expected results: The test should have been succeeded.

Comment 7 FIlip Bogyai 2014-07-17 12:39:02 UTC
This issue should be fixed in EAP 6.4 release.

Comment 8 Pedro Igor 2014-08-29 17:25:03 UTC
This was already fixed in upstream. I think we just need to update product branch.

https://issues.jboss.org/browse/PLINK-360

Comment 9 Pedro Igor 2014-10-30 19:34:48 UTC
Backported from upstream.

Commit:

https://code.engineering.redhat.com/gerrit/#/c/35777/

Comment 11 Hynek Mlnarik 2014-11-28 14:30:15 UTC
Verified in PicketLink 2.5.3.SP13-redhat-1 included in EAP 6.4.0.DR11.