Skip to content

[HOTFIX] Check note access before notebook conversion - #5629

Open
jongyoul wants to merge 1 commit into
apache:masterfrom
jongyoul:codex/note-conversion-access
Open

jongyoul wants to merge 1 commit into
apache:masterfrom
jongyoul:codex/note-conversion-access

Conversation

@jongyoul

Copy link
Copy Markdown
Member

This updates notebook conversion to apply the existing note access check before returning converted content.

  • Reuses the existing note read check
  • Keeps allowed conversions unchanged
  • Adds coverage for denied and allowed requests

The core and quick workflows provide the full validation.

Copilot AI balanced review requested due to automatic review settings November 29, 2026 06:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues blocking the notebook-conversion authorization change.

No open issues 🎉

What changed in this PR

This hotfix applies Apache Zeppelin’s existing note-read authorization check before returning converted Jupyter notebook content, while preserving the response format for authorized users.

Changes:

  • Passes the authenticated service context into conversion and returns the existing permission-denied response when read access is denied.
  • Adds regression coverage for denied requests and successful reader conversions, including notebook content and filename preservation.
File Description
zeppelin-server/​src/​test/​java/​org/​apache/​zeppelin/​socket/​NotebookServerTest.java Tests denied and allowed conversions with isolated ticket state and cleanup.
zeppelin-server/​src/​main/​java/​org/​apache/​zeppelin/​socket/​NotebookServer.java Checks read permission before serializing and sending converted notebook content.

Review effort: Balanced

@miinhho

miinhho commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

LGTM 👍

@seung-00 seung-00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

Comment on lines 1357 to +1365
String noteId = fromMessage.get("noteId").toString();
getNotebook().processNote(noteId,
note -> {
if (note == null) {
throw new IOException("No such note: " + noteId);
} else {
Message resp = new Message(OP.CONVERTED_NOTE_NBFORMAT)
.put("nbformat", new JupyterUtil().getNbformat(note.toJson()))
.put("noteName", fromMessage.get("noteName"));
conn.send(serializeMessage(resp));
}
if (!authorizationService.isReader(noteId, context.getUserAndRoles())) {
permissionError(conn, "convert", context.getAutheInfo().getUser(),
context.getUserAndRoles(), authorizationService.getReaders(noteId));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we check permissions before loading the note to reduce reads?

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

4 participants