You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by anthonycorbacho <gi...@git.apache.org> on 2016/10/29 06:30:21 UTC
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
GitHub user anthonycorbacho opened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
* [ ] - Create a proper way to throw webapp error
* [ ] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
* [ ] - Add Authorization check in `NotebookRestapi`
### What is the Jira issue?
* [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
* In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
* In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
* Start Zeppelin, login and set some permission to a note
* try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit a69a4e10c46452dcaaf8174c37e51705d6bc3214
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit 859fba52799bc1690b0726dc6dc672f9c4b016a7
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 67c63148233c0bf31715c9d97b37f4702fb3d2e6
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 43ec38932300db156a602507ae82a34a0b416257
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit 860f4b4ff789ac7087932920f71a73b30cbc9ba8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 01bec7ae0ece70fe5eed6f068bc40b4cc61ffd8d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit c0b98ffe2f1a3c4ee005ffe8b376bdc507eab2f0
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by tae-jun <gi...@git.apache.org>.
Github user tae-jun commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@anthonycorbacho Thanks :-) Don't worry! I do this because I want to do \U0001f604
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [x] - Add Authorization check in `NotebookRestapi`
- [x] - Add New test for security in notebook rest api
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [x] - Add Authorization check in `NotebookRestapi`
- [x] - Add New test for security in notebook rest api
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit a69a4e10c46452dcaaf8174c37e51705d6bc3214
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit 859fba52799bc1690b0726dc6dc672f9c4b016a7
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 67c63148233c0bf31715c9d97b37f4702fb3d2e6
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 43ec38932300db156a602507ae82a34a0b416257
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit 860f4b4ff789ac7087932920f71a73b30cbc9ba8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 01bec7ae0ece70fe5eed6f068bc40b4cc61ffd8d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit c0b98ffe2f1a3c4ee005ffe8b376bdc507eab2f0
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
commit a1cc1b81bd8f69f068803e6e87d110805905a039
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T03:33:20Z
Change cxf version from 2.7.7 to 2.7.8 to avoid method not found where throw WebAppException
commit 0cf19d2c41b288dc3a02cefc64de07c30b91e9ec
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T08:24:38Z
Fix typo and bad copy paste for isOwner
commit 2fd359cda8fe8aab72177c9c8c59b5bde3eb1c6c
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T08:30:17Z
Adress review and fix typos
commit 4768e3a73f3cec87c86ab8cabb05a7fe483aa922
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:48:14Z
Refactored Abstract rest api test to also handle the case of tests with shiro (security), I also added some utility http method to do action with authenticated user
commit 1055a837cb138d86618c895b71346d95f743496e
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:49:00Z
Simple implementation of notebook test with shiro (security)
commit 15c776d5889bd9c9d06d6246c3101aa1a2f4cb6d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:49:26Z
Rewording
commit 216b5cdd32183d9907ce33f8a91713909e790404
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-02T03:24:43Z
Fix typo
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by minahlee <gi...@git.apache.org>.
Github user minahlee commented on the issue:
https://github.com/apache/zeppelin/pull/1567
Same Spark 1.3.1 test profile failure exists on master which looks like below:
```
Results :
Tests in error:
InterpreterRestApiTest.init:57->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
CredentialsRestApiTest.init:46->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
ZeppelinRestApiTest.init:59->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
NotebookRestApiTest.init:58->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
SecurityRestApiTest.init:44->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
NotebookRepoRestApiTest.init:52->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
ConfigurationsRestApiTest.init:39->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
ZeppelinSparkClusterTest.init:52->AbstractTestRestApi.startUp:233->AbstractTestRestApi.start:201 » NullPointer
NotebookSecurityRestApiTest.init:49->AbstractTestRestApi.startUpWithAuthenticationEnable:229->AbstractTestRestApi.start:201 » NullPointer
Tests run: 9, Failures: 0, Errors: 9, Skipped: 0
```
So I am going to merge this if there is no more discussion.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@minahlee you are right, I guess the next step will be to abstract this logic from rest api and apply to both rest and websocket.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@tae-jun thanks for the feedback, let me take a look tomorrow
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by tae-jun <gi...@git.apache.org>.
Github user tae-jun commented on the issue:
https://github.com/apache/zeppelin/pull/1567
I also tested and was able to reproduce screenshot above.
When I was another user, it returned `403` status code with message:
```json
{"status":"FORBIDDEN","message":"Insufficient privileges you cannot get this note"}
```
However, when I didn't log in (i.e. anonymous), the browser(Chrome) redirected me to `http://localhost:8080/api/login` and returned `405` status code without any message. Users can be confused when there is no error message. And I think `403` status code is more proper since it's `forbidden`, not `method not allowed`.
So in my opinion, it would be better:
- Send `403` status code with some messages when a user is not logged in. Maybe something like:
```json
{"status":"FORBIDDEN","message":"Please log in"}
```
This is a miracle feature, by the way \U0001f44d
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [ ] - Add Authorization check in `NotebookRestapi`
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit a69a4e10c46452dcaaf8174c37e51705d6bc3214
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit 859fba52799bc1690b0726dc6dc672f9c4b016a7
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 67c63148233c0bf31715c9d97b37f4702fb3d2e6
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 43ec38932300db156a602507ae82a34a0b416257
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit 860f4b4ff789ac7087932920f71a73b30cbc9ba8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 01bec7ae0ece70fe5eed6f068bc40b4cc61ffd8d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit c0b98ffe2f1a3c4ee005ffe8b376bdc507eab2f0
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
commit a1cc1b81bd8f69f068803e6e87d110805905a039
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T03:33:20Z
Change cxf version from 2.7.7 to 2.7.8 to avoid method not found where throw WebAppException
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
Yeaaaaaay!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@minahlee yeah, actually i am doing this right now, I also updated to todo tasks thanks for your review!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by tae-jun <gi...@git.apache.org>.
Github user tae-jun commented on the issue:
https://github.com/apache/zeppelin/pull/1567
I guess it's same CI error with #1518.
There is a log which is:
```bash
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
+echo 'Unable to extract spark-1.3.1-bin-hadoop2.3.tgz'
Unable to extract spark-1.3.1-bin-hadoop2.3.tgz
```
This is because of cache failure of Travis CI, and if it happens, it goes forever. Because caching is done only at the first time.
Because of this, if you follow the log more, you can see:
```bash
SPARK HOME detected null
```
Therefore, Zeppelin cannot find Spark, and it goes to failure.
I think it will pass if you run Travis CI on your own repository.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [x] - Add Authorization check in `NotebookRestapi`
- [x] - Add New test for security in notebook rest api
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit 4a43b07c05026698fe268b4b45913a3b0f007f74
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit da3415f3b3c12d72e0466a736ccaa0a3231c79ed
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 0e4cc3c974cb52b8e6e039375c4748bc89665201
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 21f9288ef7225f56c6a9d92d26209b7440d64c6a
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit fe380abf6fc839f316a0eeaae43b3a1e44d58df9
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 6030776cd867f7575010ee7fa99e0b0782d308dd
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit ed404a4e331e28f76cc2a28ebc3498d3343da34e
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
commit c8c42b26a0b7403a02f90cce62336c2eb9498873
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T03:33:20Z
Change cxf version from 2.7.7 to 2.7.8 to avoid method not found where throw WebAppException
commit eacfa8eee2fde6d9fb1f3f8fc52b7b7967b6c665
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T08:24:38Z
Fix typo and bad copy paste for isOwner
commit db0c39c4a14d7a97b5d7caec3d332056d0773920
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T08:30:17Z
Adress review and fix typos
commit b412266b4dd73fd005a403b77acdec0599e55b3a
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:48:14Z
Refactored Abstract rest api test to also handle the case of tests with shiro (security), I also added some utility http method to do action with authenticated user
commit decd1e9c6c32f761a806e2367eeaa94121931631
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:49:00Z
Simple implementation of notebook test with shiro (security)
commit bab7e600780e19533b59c56e7c4b7e32e8841efc
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T14:49:26Z
Rewording
commit 49d4db9eff1fe908d9256ded67f21d53fa48e4d8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-02T03:24:43Z
Fix typo
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by minahlee <gi...@git.apache.org>.
Github user minahlee commented on the issue:
https://github.com/apache/zeppelin/pull/1567
Thank you for quick response, I only went through the code and it looks good to me. It would be nice if you can add some tests. Meanwhile let me build this branch and test it out.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [x] - Add Authorization check in `NotebookRestapi`
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit a69a4e10c46452dcaaf8174c37e51705d6bc3214
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit 859fba52799bc1690b0726dc6dc672f9c4b016a7
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 67c63148233c0bf31715c9d97b37f4702fb3d2e6
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 43ec38932300db156a602507ae82a34a0b416257
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit 860f4b4ff789ac7087932920f71a73b30cbc9ba8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 01bec7ae0ece70fe5eed6f068bc40b4cc61ffd8d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit c0b98ffe2f1a3c4ee005ffe8b376bdc507eab2f0
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
commit a1cc1b81bd8f69f068803e6e87d110805905a039
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T03:33:20Z
Change cxf version from 2.7.7 to 2.7.8 to avoid method not found where throw WebAppException
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by tae-jun <gi...@git.apache.org>.
Github user tae-jun commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@anthonycorbacho Nice! I agree with you :)
I will open the issue on JIRA. But since I don't know much about the code structure, I may need some help \U0001f603
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by minahlee <gi...@git.apache.org>.
Github user minahlee commented on the issue:
https://github.com/apache/zeppelin/pull/1567
I tested some of rest apis and it works well. Next step would be applying same policies to websocket. For example `reader` cannot change bound interpreter to note via rest api after this PR, but it is possible to do it via websocket(or GUI).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@tae-jun creating an issue doenst mean that you have to handle it, of course if you want you are welcome to do so, but remember we are a community so that mean we are here to help each others so if you create the PR i can spend some time and work with you on it :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@zjffdu Hey dudy I keep failing at Livy interpreter, i dont know why but i keep getting timeout somehow, can you take a look t it please? It also look like other pr are failing at the same stage :(
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin issue #1567: [ZEPPELIN-1586] Add security check in NotebookRestApi
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho commented on the issue:
https://github.com/apache/zeppelin/pull/1567
@tae-jun After looking at the code base, I think this case should be handle in another PR, this is kinda out of the scope of this PR and its already becoming super big.
But your made a very valid point here and I guess it deserve a Jira ticket. i will try to find some time to handle this special case.
What do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
Github user anthonycorbacho closed the pull request at:
https://github.com/apache/zeppelin/pull/1567
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] zeppelin pull request #1567: [ZEPPELIN-1586] Add security check in NotebookR...
Posted by anthonycorbacho <gi...@git.apache.org>.
GitHub user anthonycorbacho reopened a pull request:
https://github.com/apache/zeppelin/pull/1567
[ZEPPELIN-1586] Add security check in NotebookRestApi
### What is this PR for?
Bring some security check in `NotebookRestApi`.
### What type of PR is it?
[Bug Fix | Improvement | Refactoring]
### Todos
- [x] - Create a proper way to throw webapp error
- [x] - Add in `NotebookAuthorization` some method to check if user is owner, reader or writer
- [x] - Add Authorization check in `NotebookRestapi`
### What is the Jira issue?
- [ZEPPELIN-1586](https://issues.apache.org/jira/browse/ZEPPELIN-1586)
### How should this be tested?
First, force Zeppelin to use auth.
- In `conf/zeppelin-site.xml` change `zeppelin.anonymous.allowed` to **false**
```
<property>
<name>zeppelin.anonymous.allowed</name>
<value>false</value>
<description>Anonymous user allowed by default</description>
</property>
```
- In `conf/shiro.ini` set Shiro to use `Auth` at the end of the file
```
#/** = anon
/** = authc
```
- Start Zeppelin, login and set some permission to a note
- try to get a note from Zeppelin Rest Api `http://localhost:8080/api/notebook/{noteId}` (you can use your browser or curl (if you use curl please add shiro token to curl cookie))
### Screenshots (if appropriate)

### Questions:
- Does the licenses files need update? No
- Is there breaking changes for older versions? No
- Does this needs documentation? Maybe
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonycorbacho/incubator-zeppelin fix/ZEPPELIN-1586
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1567.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1567
----
commit a69a4e10c46452dcaaf8174c37e51705d6bc3214
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T05:49:10Z
Add new method on ZeppelinConfiguration to get is zeppelin is running on anonimous mode or not
commit 859fba52799bc1690b0726dc6dc672f9c4b016a7
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T07:22:13Z
Add new method to help to determinate if user is part of writer and/or owner for the given note
commit 67c63148233c0bf31715c9d97b37f4702fb3d2e6
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:56:04Z
Add new method to check if user and roles are member of the note (at least owner, reader, writer)
commit 43ec38932300db156a602507ae82a34a0b416257
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T09:57:06Z
Replace check of aninonimous by method
commit 860f4b4ff789ac7087932920f71a73b30cbc9ba8
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:32Z
Add webapp exception handler :)
commit 01bec7ae0ece70fe5eed6f068bc40b4cc61ffd8d
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-28T11:19:54Z
Handle security check
commit c0b98ffe2f1a3c4ee005ffe8b376bdc507eab2f0
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-10-29T05:58:04Z
Rename permission check note :: be more meaningful
commit a1cc1b81bd8f69f068803e6e87d110805905a039
Author: Anthony Corbacho <co...@gmail.com>
Date: 2016-11-01T03:33:20Z
Change cxf version from 2.7.7 to 2.7.8 to avoid method not found where throw WebAppException
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---