Trusted Application Authentication IPv6 Exception
Symptoms
While trying to set up an Application Link between JIRA and Stash using Trusted Applications, the following exception is logged in atlassian-stash.log
:
SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.IllegalArgumentException: '0:0:0:0:0:0:0:1%0' is not an IP string literal.
at com.atlassian.ip.InetAddresses.forString(InetAddresses.java:64)
at com.atlassian.ip.IPMatcher.matches(IPMatcher.java:46)
at com.atlassian.security.auth.trustedapps.AtlassianIPMatcher.match(AtlassianIPMatcher.java:51)
at com.atlassian.security.auth.trustedapps.DefaultRequestValidator.validateRemoteRequestIP(DefaultRequestValidator.java:34)
at com.atlassian.security.auth.trustedapps.DefaultRequestValidator.validate(DefaultRequestValidator.java:26)
at com.atlassian.security.auth.trustedapps.DefaultTrustedApplication.checkRequest(DefaultTrustedApplication.java:117)
at com.atlassian.security.auth.trustedapps.DefaultTrustedApplication.decode(DefaultTrustedApplication.java:88)
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationFilterAuthenticator.authenticate(TrustedApplicationFilterAuthenticator.java:102)
This happens when trying to view the Source tab on a JIRA issue which displays a HTTP 500 error.
Cause
Currently, application links can exhibit some incorrect behavior when IPv6 is enabled due to the way Java deals with IPv6:
Resolution
Users can force Java to use IPv4 by adding by appending
-Djava.net.preferIPv4Stack=true
toJVM_REQUIRED_ARGS
orJVM_SUPPORT_RECOMMENDED_ARGS
in<Stash installation directory>/bin/setenv.sh