Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow notebooks to be trusted without triggering a save#2718

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
minrk merged 1 commit intojupyter:masterfromMadhu94:trust_without_save
Aug 7, 2017

Conversation

@Madhu94
Copy link
Contributor

Closes#195.

Trust should now add the notebook's signature without needing to trigger a save. Save will still trust the notebook, after checking and if it has not already been trusted.

I have not added an automatic refresh after trust, let me know if you think this would be a good idea.

@Madhu94Madhu94 closed thisAug 2, 2017
@Madhu94Madhu94 reopened thisAug 2, 2017
Copy link
Member

@minrkminrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks! I left a few comments inline.

# We need this check in case the notebook is
# trusted before save
ifnotself.notary.check_signature(nb):
self.check_and_sign(nb,path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

check_signature shouldn't be called beforecheck_and_sign, which consumes trust metadata. I think.save probably doesn't need to change at all.

@json_errors
@web.authenticated
@gen.coroutine
defput(self,path=''):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

POST is probably more appropriate for a request with no content.

self.notary.sign(nb)
else:
self.log.warning("Saving untrusted notebook %s",path)
self.log.warning("Signing notebook %s",path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This message is backwards. In this event, the notebook isnot signed. It is still untrusted.

window.location.reload();
nb.contents.trust(nb.notebook_path)
.then(function(res){
nb.events.trigger("trust_changed.Notebook",true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

it should still trigger reload to get the newly trusted notebook without sanitized output.

And.save should only be avoided when the notebook is read-only. We should still save & reload for non-read-only notebooks to avoid losing unsaved changes (which is unavoidable for read-only).

@Madhu94
Copy link
ContributorAuthor

Madhu94 commentedAug 2, 2017
edited
Loading

@minrk Thanks for the feedback! Took care of those comments.

Copy link
Member

@minrkminrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the quick turnaround!

ifself.notary.check_cells(nb):
self.notary.sign(nb)
else:
self.log.warning("Saving untrusted notebook %s",path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe leave this at "Notebook %s is not trusted."

},function(err){
console.log(err);
});
nb.save_notebook();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you still trigger save here if the notebook is not read-only? That way we can avoid losing unsaved changes when the notebook is editable.

varp;if (nb.writableandnb.dirty) {p=nb.save_notebook();}else {p=Promise.resolve();}p.then(function () {returnnb.contents.trust...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So if its read-only, we save it and then trust..Thanks, never noticed thedirty attribute.

@Madhu94Madhu94 closed thisAug 2, 2017
@Madhu94Madhu94 reopened thisAug 2, 2017
@Madhu94
Copy link
ContributorAuthor

Madhu94 commentedAug 2, 2017
edited
Loading

@minrk In addition to the changes you requested, I addedthis, I think the check makes sense here.

@gnestor
Copy link
Contributor

@minrk Do you think this ready to merge?

self.notary.sign(nb)
# We're checking the signature *after* the
# trusted keys have been removed
ifnotself.notary.check_signature(nb):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this entire method should be left exactly as it was. Adding this check here is not correct because it prevents updating the signatures of trusted notebooks.

@minrk
Copy link
Member

@gnestor almost. There's one addition in check_and_sign that should be reverted, but the rest should be set.

gnestor reacted with thumbs up emoji

@Madhu94
Copy link
ContributorAuthor

Madhu94 commentedAug 4, 2017
edited
Loading

@minrk The waystore_signature for the signature store is implemented, the signaturesdon't get updated.
I logged an issue with nbformat, please let me know if I'm wronghere

@Madhu94
Copy link
ContributorAuthor

I think this is a bug even on master. I noticed that without the check, the same signature was re-inserted each time the notebook was trusted.

@minrk, I probably shouldn't check this here - the issue should be fixed in nbformat. So, I'll revert that change, squash my commits and then we're good to go?

@minrk
Copy link
Member

@Madhu94 exactly right. This shouldn't be changed here, but fixed in nbformat itself. Thanks for digging in!

@Madhu94
Copy link
ContributorAuthor

Madhu94 commentedAug 5, 2017
edited
Loading

@minrk I rebased and squashed my commits and reverted that check inmanager.py. Let me know if there's anything else left?

@takluyver
Copy link
Member

@minrk this is, I think, the last remaining PR for 5.1. Is it ready to go?

@minrkminrk merged commitda2d54f intojupyter:masterAug 7, 2017
@minrk
Copy link
Member

Yes, indeed.

@minrk
Copy link
Member

Thanks,@Madhu94!

@Madhu94Madhu94 deleted the trust_without_save branchAugust 13, 2017 19:55
@Madhu94
Copy link
ContributorAuthor

Can I add this to the 5.1 changelog ?

@takluyver
Copy link
Member

Yes, please do!

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsApr 5, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@minrkminrkminrk left review comments

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

trust from menu not working for readonly ipy notebook

4 participants

@Madhu94@gnestor@minrk@takluyver

[8]ページ先頭

©2009-2025 Movatter.jp