Generate API Token does not display token to user.

18 views
Skip to first unread message

Philip Mason

unread,
Aug 29, 2019, 3:21:56 PM8/29/19
to Jenkins Users
Hi Jenkins folks. Running LTS 2.176.3.

I find that "Add New Token" in the user configuration page isn't working.

"Generate" button creates token, but it is never displayed to the user. Have to refresh the page to see that the token was created.

The Script Console suggestion from Cloudbees to generate a token for a user throws an NPE at user.save().

- - - Philip

Mark Waite

unread,
Aug 29, 2019, 3:42:33 PM8/29/19
to Jenkins Users
That is quite unexpected.  I just used Jenkins 2.176.3 with Google Chrome and confirmed that a token is generated as expected.  In my case, I am connecting to Jenkins over SSL from the public internet, with the SSL certificate handled by LetsEncrypt and the reverse proxy by nginx.

Can you describe the ways that your configuration is different from mine?

Are you running a reverse proxy?
Are you running a different web browser?
Are you running through a web proxy?
Are you running some software that might be filtering or blocking a portion of the HTTP traffic from Jenkins?



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/77cca0af-1244-4193-94fe-7e87d9de9a98%40googlegroups.com.


--
Thanks!
Mark Waite

Philip Mason

unread,
Aug 29, 2019, 4:14:00 PM8/29/19
to Jenkins Users
Hi Mark,

No proxy involved at any level ...  Standard Chrome browser.

But I've just discovered there's a potential problem writing to the user config files.

 hudson.model.User.save  is hitting NPEs in the Cloudbees example token generation script, as well as occasionally when I re-login to a old session like this:

java.lang.NullPointerException
	at hudson.Util.fileToPath(Util.java:1501)
	at hudson.model.UserIdMapper.createDirectoryForNewUser(UserIdMapper.java:145)
	at hudson.model.UserIdMapper.putIfAbsent(UserIdMapper.java:92)
	at hudson.model.User.putUserFolderIfAbsent(User.java:806)
	at hudson.model.User.constructUserConfigFile(User.java:802)
	at hudson.model.User.save(User.java:796)
	at jenkins.security.LastGrantedAuthoritiesProperty.update(LastGrantedAuthoritiesProperty.java:81)
	at jenkins.security.LastGrantedAuthoritiesProperty$SecurityListenerImpl.loggedIn(LastGrantedAuthoritiesProperty.java:112)
	at jenkins.security.SecurityListener.fireLoggedIn(SecurityListener.java:129)
	at hudson.security.AuthenticationProcessingFilter2.onSuccessfulAuthentication(AuthenticationProcessingFilter2.java:106)
	at org.acegisecurity.ui.AbstractProcessingFilter.successfulAuthentication(AbstractProcessingFilter.java:486)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:266)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1701)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1668)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:502)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:427)
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:321)
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:159)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:748)
- - - Philip

Philip Mason

unread,
Aug 30, 2019, 11:17:44 PM8/30/19
to Jenkins Users
Identified a problem with the Permissive Script Security plugin version 0.5.
This was the cause of the problem.   Rolling back the plugin to version 0.3 solved the issue.

- - - Philip
 
Reply all
Reply to author
Forward
0 new messages