Skip to content

fix(frontend): prevent editing description without write access#6834

Open
Raja-Hamid wants to merge 1 commit into
apache:mainfrom
Raja-Hamid:fix/readonly-workflow-description
Open

fix(frontend): prevent editing description without write access#6834
Raja-Hamid wants to merge 1 commit into
apache:mainfrom
Raja-Hamid:fix/readonly-workflow-description

Conversation

@Raja-Hamid

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

On the workflow list, the description of a read-only workflow was still editable. ListItemComponent's editable input only means "this is the private dashboard view" and is hardcoded [editable]="true" by the container (user-workflow.component.html:184,193), so it was never an access check — onEditDescription() guarded on it alone. A user with READ-only access to a shared workflow could open the editor, and only the backend rejected the save (WorkflowResource.scala:153-164, ForbiddenException("No sufficient access privilege.")).

The access data was already on the bound entry and already used in the same file (e.g. list-item.component.ts:219 for the share modal) — it just wasn't consulted for editing.

Fix (list-item.component.ts / .html):

  • new canEditDescription getter: editable && entry.accessLevel === "WRITE"
  • onEditDescription() guards on it — both entry points funnel through it, so the modal and the failing request are unreachable without WRITE
  • the Edit Description control and the "Write a description…" hover placeholder are hidden for read-only entries

Mirrors the existing dataset pattern (user-dataset-list-item.component.html:49).

Scope is deliberately limited to the description, per the issue. Rename (onEditName()) and the card view share the same class of bug and are better handled separately, as is the duplicate error toast.

Recording 2026-07-23 202732

Any related issues, documentation, discussions?

Closes #3497

How was this PR tested?

Unit tests (Vitest) — 4 new cases in list-item.component.spec.ts (no-modal + control-hidden for READ, plus WRITE regression guards):

corepack yarn ng test --watch=false --include="**/list-item.component.spec.ts"
24/24 passing; 2 of the new cases were red before the fix.

Regression across components embedding ListItemComponent:
corepack yarn ng test --watch=false
--include="/list-item.component.spec.ts" --include="/card-item.component.spec.ts"
--include="/search-results.component.spec.ts" --include="/user-workflow.component.spec.ts"
--include="**/hub-search-result.component.spec.ts"
5 files, 180/180 passing

Manual: bin/single-node stack + ng serve; seeded a workflow owned by another user and shared READ-only. In Your Work → Workflows the read-only row no longer exposes the Edit Description control or the hover placeholder and clicking does nothing, while WRITE rows still open the editor and save successfully.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Yes alongside Claude Code

The list row's editable input only means 'this is the private dashboard view' and is hardcoded to true by the container, so it was never an access check. A user with READ-only access to a shared workflow could therefore open the description editor; the save then failed with the backend's 'No sufficient access privilege.'.

Gate description editing on the entry's actual access level:
- add a canEditDescription getter (editable && entry.accessLevel === 'WRITE')
- use it as the guard in onEditDescription()
- hide the Edit Description control and the 'Write a description...' hover placeholder for read-only entries

This mirrors the existing dataset list-item pattern (editable && entry.accessPrivilege === 'WRITE').

Closes apache#3497
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @xuang7, @mengw15, @kunwp1
    You can notify them by mentioning @xuang7, @mengw15, @kunwp1 in a comment.

@xuang7 xuang7 added the release/v1.2 back porting to release/v1.2 label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The description of read-only workflows are still editable

2 participants