37 views
Skip to first unread message

niristotle okram

unread,
May 9, 2018, 12:46:28 PM5/9/18
to jenkins...@googlegroups.com
i am getting a failure calling the below function in a pipeline

    def getTimeStamp(str) {
       d = new Date(str).toTimestamp();
       return d
    }


Exception Caught: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.SqlGroovyMethods toTimestamp java.util.Date


If i unchecked the "groovy sandbox" and paste the pipeline - it WORKS
while if i checkout the jenkinsfile from the repo, the same error comes back. Is there a way where i can disable "sandbox" while retrieving the pi[eline script from a git repo?

Note: the method doesnt show up for approval too



--
Regards
nirish okram

Slide

unread,
May 9, 2018, 1:43:47 PM5/9/18
to jenkins...@googlegroups.com
To quote R. Tyler Croy. NEVER DISABLE THE SANDBOX. 

If you really want to do what you are trying to do, you can whitelist the toTimestamp method of the java.util.Date class in the global configuration area of Jenkins, or create the getTimeStamp function in a shared library.

--
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/CAPzcO4gxDR0idMzm8n9Y0W-5OoK4s7tty_uNGDzeQLvAija_wQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

niristotle okram

unread,
May 9, 2018, 2:32:41 PM5/9/18
to jenkins...@googlegroups.com
where do i see the option to whitelist? I dont see this method in the "pending list" waiting to be approved.  

On Wed, May 9, 2018 at 12:43 PM, Slide <slide...@gmail.com> wrote:
To quote R. Tyler Croy. NEVER DISABLE THE SANDBOX. 

If you really want to do what you are trying to do, you can whitelist the toTimestamp method of the java.util.Date class in the global configuration area of Jenkins, or create the getTimeStamp function in a shared library.

On Wed, May 9, 2018 at 9:46 AM niristotle okram <nirish...@gmail.com> wrote:
i am getting a failure calling the below function in a pipeline

    def getTimeStamp(str) {
       d = new Date(str).toTimestamp();
       return d
    }


Exception Caught: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.SqlGroovyMethods toTimestamp java.util.Date


If i unchecked the "groovy sandbox" and paste the pipeline - it WORKS
while if i checkout the jenkinsfile from the repo, the same error comes back. Is there a way where i can disable "sandbox" while retrieving the pi[eline script from a git repo?

Note: the method doesnt show up for approval too



--
Regards
nirish okram

--
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-users+unsubscribe@googlegroups.com.

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVe%2BaU-HUcHvys2Oy-rwUQnqbr8AdxAKjk7joySX3zJTNQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards
nirish okram

Victor Martinez

unread,
May 9, 2018, 5:04:07 PM5/9/18
to Jenkins Users
As far as I see it's there



What version of pipelines are you using?

niristotle okram

unread,
May 9, 2018, 9:20:05 PM5/9/18
to jenkins...@googlegroups.com
this is what i have 




--
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-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards
nirish okram

Victor Martinez

unread,
May 10, 2018, 4:14:27 AM5/10/18
to Jenkins Users
I'm not sure if you can upgrade those plugins but you could give a go and run a local jenkins instance with the latest version of those plugins and see whether the same behaviour keeps going. Other than that, I don't have any other suggestions.

Cheers

niristotle okram

unread,
May 10, 2018, 9:59:26 AM5/10/18
to jenkins...@googlegroups.com
What is your version of the plugins? 

On Thu, May 10, 2018 at 3:14 AM Victor Martinez <victormar...@gmail.com> wrote:
I'm not sure if you can upgrade those plugins but you could give a go and run a local jenkins instance with the latest version of those plugins and see whether the same behaviour keeps going. Other than that, I don't have any other suggestions.

Cheers

--
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/d8748045-ec9d-4c27-9b68-476e8f5437e6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Sent from mobile device, excuse typos if any.
Reply all
Reply to author
Forward
0 new messages