Skip to content

Trust fails to persist #812

@joyceerhl

Description

@joyceerhl

The hashes stored to trust store in trustNotebook are not the same as the hashes computed when checking isNotebookTrusted. This used to work before, the main difference is we're now using model.getContent() to retrieve the current notebook contents. I did a comparison of the contents that are being hashed in a debugger and they look the same, so could be an encoding issue? End result is that notebooks are trusted with one hash but checked for trust with a different hash, i.e. user-trusted notebooks are always untrusted on next load

ETA: model.getContent() returns stringified notebook contents that differ from what's actually stored on disk. This is the root cause of the problem. A proper fix for this would ensure that getContent() returns data that is identical to what's on disk

ETA to the ETA: There are actually two separate problems. The first is that getContent() sometimes unnecessarily reorders the JSON. The second is that JSON.parse converts escaped unicode characters to actual unicode, so the constructed model will differ from the actual file contents on disk until the user hits save

/cc @DonJayamanne

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions