[JIRA] (JENKINS-59105) Accessing Jenkins using API token does not work in group memberships

35 views
Skip to first unread message

harishbito@gmail.com (JIRA)

unread,
Aug 27, 2019, 12:10:11 PM8/27/19
to jenkinsc...@googlegroups.com
Harish Kumar created an issue
 
Jenkins / Bug JENKINS-59105
Accessing Jenkins using API token does not work in group memberships
Issue Type: Bug Bug
Assignee: Oleg Nenashev
Components: role-strategy-plugin
Created: 2019-08-27 16:09
Environment: Jenkins version : 2.174
Role-based Authorization Strategy version : 2.10
Priority: Major Major
Reporter: Harish Kumar

I am using Role Based Strategy to manage user permission.

I have an account under group A. I give this group Admin permission. When I call rest API with user API token Jenkins rejects the request with 403 Forbidden Error. If I add this user directly to the global roles and grant appropriate permission, it works. 

It seems API authorization doesn't work with Group. Any idea on this?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

o.v.nenashev@gmail.com (JIRA)

unread,
Aug 27, 2019, 12:13:02 PM8/27/19
to jenkinsc...@googlegroups.com
Oleg Nenashev commented on Bug JENKINS-59105
 
Re: Accessing Jenkins using API token does not work in group memberships

Are you sure you have set up the CSRF Token correctly? Please also provide the REST API request you are invoking

harishbito@gmail.com (JIRA)

unread,
Aug 27, 2019, 12:25:01 PM8/27/19
to jenkinsc...@googlegroups.com

harishbito@gmail.com (JIRA)

unread,
Aug 27, 2019, 12:27:03 PM8/27/19
to jenkinsc...@googlegroups.com

harishbito@gmail.com (JIRA)

unread,
Aug 27, 2019, 12:28:02 PM8/27/19
to jenkinsc...@googlegroups.com

harishbito@gmail.com (JIRA)

unread,
Aug 28, 2019, 10:18:02 AM8/28/19
to jenkinsc...@googlegroups.com
Harish Kumar edited a comment on Bug JENKINS-59105
 
Re: Accessing Jenkins using API token does not work in group memberships
It fails in Yes as far I can tell the very first request made and it set up seems valid.

Its
is the crumb request which is failing : "https://jenkinsurl/crumbIssuer/api/json"

harishbito@gmail.com (JIRA)

unread,
Aug 28, 2019, 10:20:02 AM8/28/19
to jenkinsc...@googlegroups.com
Harish Kumar edited a comment on Bug JENKINS-59105
Yes as far I can tell the set up seems valid.


Its is the crumb request which is failing : "https://jenkinsurl/crumbIssuer/api/json"


Error : someuser is missing the Overall/Read permission

alexhraber@gmail.com (JIRA)

unread,
Apr 6, 2020, 3:26:03 PM4/6/20
to jenkinsc...@googlegroups.com

This is something I've noticed as well. Github webhooks are failing with 403, which were previously succeeding without any issues.

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

alexhraber@gmail.com (JIRA)

unread,
Apr 6, 2020, 3:27:02 PM4/6/20
to jenkinsc...@googlegroups.com
Alex Raber edited a comment on Bug JENKINS-59105
This is something I've noticed as well. Github webhooks are failing with 403, which were previously succeeding without any issues after upgrading LTS from `2 . 204.5` to `2.222.1`.

zburton@ancestry.com (JIRA)

unread,
Apr 6, 2020, 4:53:04 PM4/6/20
to jenkinsc...@googlegroups.com
Zane Burton edited a comment on Bug JENKINS-59105
I have replicated this bug. This command fails with the error "Access Denied user is missing the Agent/Create permission"

{color:#000000}curl --location --user {color}{color:#a31515}'username:APIKEY'{color}{color:#000000} --header {color}{color:#a31515}"Content-Type:application/x-www-form-urlencoded"{color}{color:#000000} --request POST {color}{color:#a31515}"https://jenkins.example.com/computer/doCreateItem?name=I-00A223022A4B270A6.example.com&type=hudson.slaves.DumbSlave"{color}

zburton@ancestry.com (JIRA)

unread,
Apr 6, 2020, 4:53:04 PM4/6/20
to jenkinsc...@googlegroups.com

I have replicated this bug. This command fails with the error "Access Denied user is missing the Agent/Create permission"

curl --location --user 'username:APIKEY' --header "Content-Type:application/x-www-form-urlencoded" --request POST "https://jenkins.example.com/computer/doCreateItem?name=I-00A223022A4B270A6.example.com&type=hudson.slaves.DumbSlave"

o.v.nenashev@gmail.com (JIRA)

unread,
Apr 7, 2020, 7:11:03 AM4/7/20
to jenkinsc...@googlegroups.com
Oleg Nenashev started work on Bug JENKINS-59105
 
Change By: Oleg Nenashev
Status: Open In Progress

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:09:03 PM4/7/20
to jenkinsc...@googlegroups.com

More details:

 

I added this to JENKINS_OPS in my jenkins.sh (I'm running in k8s via docker):

jenkins_opts_array=('-Dhudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO=true')

I then generated a new token for my user, and set up my Github repo webhook as follows:
url: https://dev-jenkins.url.gov/job/testjob/build
secret: <user-token> (with admin/owner perms)
application/json

Then click apply and then click the test button from github. 403.

I have also enabled and disabled the Enable proxy compatibility CSRF checkbox in Global Security.

Note my testing is done in a sandbox, but the issue is impacting my production jenkins as well. I'd prefer not to roll back if possible.

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:09:04 PM4/7/20
to jenkinsc...@googlegroups.com
Alex Raber edited a comment on Bug JENKINS-59105

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:09:04 PM4/7/20
to jenkinsc...@googlegroups.com

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:10:04 PM4/7/20
to jenkinsc...@googlegroups.com
Alex Raber edited a comment on Bug JENKINS-59105
More details:

 

I added this to JENKINS_OPS in my jenkins.sh (I'm running in k8s via docker):

{{jenkins_opts_array=('-Dhudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO=true')}}

I then generated a new token for my user, and set up my Github repo webhook as follows:
url: [https://dev-jenkins.url.gov/job/testjob/build]
secret: <user-token> (with admin/owner perms)
application/json

Then click apply and then click the test button from github. 403.

I have also enabled and disabled the Enable proxy compatibility CSRF checkbox in Global Security.

Note my testing is done in a sandbox, but the issue is impacting my production jenkins as well. I'd prefer not to roll back if possible.

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:10:05 PM4/7/20
to jenkinsc...@googlegroups.com
Alex Raber edited a comment on Bug JENKINS-59105
More details:

 

I added this to JENKINS_OPS in my jenkins.sh (I'm running in k8s via docker):

` {{ jenkins_opts_array=('-Dhudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO=true') ` }}

I then generated a new token for my user, and set up my Github repo webhook as follows:
url: [https://dev-jenkins.url.gov/job/testjob/build]
secret: <user-token> (with admin/owner perms)
application/json

Then click apply and then click the test button from github. 403.

I have also enabled and disabled the Enable proxy compatibility CSRF checkbox in Global Security.

Note my testing is done in a sandbox, but the issue is impacting my production jenkins as well. I'd prefer not to roll back if possible.

alexhraber@gmail.com (JIRA)

unread,
Apr 7, 2020, 3:14:02 PM4/7/20
to jenkinsc...@googlegroups.com
Alex Raber edited a comment on Bug JENKINS-59105
More details:

 

I added this to JENKINS_OPS in my jenkins.sh (I'm running in k8s via docker):

{{jenkins_opts_array=('-Dhudson.security.csrf.CrumbFilter.UNPROCESSED_PATHINFO=true')}}



I then generated a new token for my user, and set up my Github repo webhook as follows:
url: [https://dev-jenkins.url.gov/job/testjob/build]
secret: <user-token> (with admin/owner perms)
application/json

Then click apply and then click the test button from github. 403.

I have also enabled and disabled the Enable proxy compatibility CSRF checkbox in Global Security.

Note my testing is done in a sandbox, but the issue is impacting my production jenkins as well. I'd prefer not to roll back if possible.


There are also these items in the 2.204.6 upgrade doc:

 
{code:java}
- Remove Enable Security checkbox in the Global Security configuration. (issue 40228)
- Remove the ability to disable CSRF protection. Instances upgrading from older versions of Jenkins will have CSRF protection enabled and the default issuer set if they currently have it disabled. (pull 4509)
{code}
 

These are not options in the UI in 2.222.1

dbeck@cloudbees.com (JIRA)

unread,
Apr 11, 2020, 12:50:03 PM4/11/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages