Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unintuitive API for trust/signing a notebook #98

Open
Madhu94 opened this issue Aug 1, 2017 · 8 comments
Open

Unintuitive API for trust/signing a notebook #98

Madhu94 opened this issue Aug 1, 2017 · 8 comments

Comments

@Madhu94
Copy link
Contributor

Madhu94 commented Aug 1, 2017

I was working on this issue in the notebook repo and was confused by the NotebookNotary class's API.

The check_cells method returns a boolean, but it also pops off the trusted key from cells' metadata. IMO, you can never tell, looking at the API, that it mutates the notebook contents model passed to it. Also, if you do not use check_cells and call sign or compute_signature or check_signature directly, the trusted key is not popped off.

Could we not mutate the notebook model here ? And, it should be conveyed to the user that sign and other like methods would require you to remove the trusted key.

If you agree something should be done here, I'd be willing to work on it.

Thanks!

@westurner
Copy link
Contributor

westurner commented Aug 1, 2017 via email

@Madhu94
Copy link
Contributor Author

Madhu94 commented Aug 1, 2017

@westurner Thanks a lot for getting back so soon. Not to be rude, but this doesn't really answer my question - i.e. (1) let's remove the trust info from the cells' metadata before signing? and (2) check_cells should not be doing anything other than checking the cells.

Thank you!

@westurner
Copy link
Contributor

westurner commented Aug 1, 2017 via email

@minrk
Copy link
Member

minrk commented Aug 2, 2017

I would say that check_cells and mark_cells probably should not be in nbformat at all (they were defined here before the web application and document format were moved to separate packages). These are really implementation details of the notebook web application and not part of the document format. sign and check_signature should not mutate the document, but the whole point of check_cells and mark_cells is to consume and define the trust metadata when communicating with the frontend.

If there's anything to do here, I might say that sign and check_signature could raise an error if trust metadata is seen, since that indicates that it's not being called on a correctly processed notebook document.

@westurner we specifically don't want to store signatures in the document. We used to do that and discovered that it caused a nightmare for version control, which was solved by computing signatures and storing them elsewhere. So any solution that includes signatures in the document would not be appropriate.

@westurner
Copy link
Contributor

westurner commented Aug 2, 2017 via email

@rgbkrk
Copy link
Member

rgbkrk commented Jan 6, 2020

Is the next step here to move check_cells and mark_cells to the notebook package?

@Madhu94
Copy link
Contributor Author

Madhu94 commented Jan 11, 2020

Thanks for reviving the stalled issue :)

Yes, I think doing that, and also @minrk's suggestion -

... sign and check_signature could raise an error if trust metadata is seen...

I'll proceed with doing this unless someone has any more suggestions?

@rgbkrk
Copy link
Member

rgbkrk commented Jan 14, 2020

Sounds good @Madhu94. Feel free to @ mention me on the PR to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants