Skip to content

Guard root network tags against the shared modifications the user cannot write on - #936

Merged
flomillot merged 20 commits into
mainfrom
feat/guard-root-network-tags-on-shared-modifications
Oct 26, 2026
Merged

flomillot merged 20 commits into
mainfrom
feat/guard-root-network-tags-on-shared-modifications

Conversation

@flomillot

@flomillot flomillot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

POST /containers/root-network-tags/authorized refuses a root network tag missing on a shared modification the user cannot write on, or on its content (403 modification.rootNetworkTagsForbiddenByShared, with the allowed tags). The containers and the tags are sent in the body, as there may be too many containers for the URL.

GET /containers/references/write-access tells whether the containers point to shared modifications and, if so, whether the user can write on all, some or none of them.

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
…not write on

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce2f85d7-ba6b-424d-b2ce-9c0993bd68c1
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…t-network-applicabilities

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
…rk-tags-on-shared-modifications

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
…at/guard-root-network-tags-on-shared-modifications

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
…difications

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>

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.

🟡 Changes recommended

Tag authorization overlooks protected composite content, allowing subsequent insertion to modify it without write permission.

1 open issue
What changed in this PR

Adds permission-aware root-network tag checks and shared-modification write-access reporting, building on explicit tag applicability.

Changes:

  • Adds tag authorization and detailed write-access endpoints.
  • Filters shared modifications by write permission during tag renaming.
  • Adds applicability queries, error handling, and regression tests.
File Description
src/​test/​java/​org/​gridsuite/​modification/​server/​service/​ModificationRepositoryTest.java Tests tag intersections and protected rename behavior.
src/​test/​java/​org/​gridsuite/​modification/​server/​ModificationControllerTest.java Supplies user identity for renaming.
src/​test/​java/​org/​gridsuite/​modification/​server/​CompositeControllerTest.java Tests authorization and write-access responses.
src/​main/​java/​org/​gridsuite/​modification/​server/​service/​NetworkModificationService.java Implements permission-aware tag handling.
src/​main/​java/​org/​gridsuite/​modification/​server/​repositories/​NetworkModificationRepository.java Supports selective renaming and tag lookup.
src/​main/​java/​org/​gridsuite/​modification/​server/​repositories/​ModificationRepository.java Queries common root-network tags.
src/​main/​java/​org/​gridsuite/​modification/​server/​NetworkModificationController.java Exposes new endpoints and forwards user identity.
src/​main/​java/​org/​gridsuite/​modification/​server/​error/​NetworkModificationExceptionHandler.java Maps tag authorization failures to HTTP 403.
src/​main/​java/​org/​gridsuite/​modification/​server/​error/​ModificationBusinessErrorCode.java Defines the tag authorization error.
src/​main/​java/​org/​gridsuite/​modification/​server/​dto/​SharedModificationsWriteAccess.java Defines write-access response states.

Review effort: Balanced

if (notWritableUuids.isEmpty()) {
return;
}
List<String> allowedTags = networkModificationRepository.getCommonRootNetworkTags(notWritableUuids);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not supposed to happen with all the current PR but let's do it to secure more

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
…pplicabilities' into HEAD

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>

# Conflicts:
#	src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java
…pplicabilities' into HEAD

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@flomillot
flomillot requested a review from EtienneLt as a code owner October 21, 2026 14:55
…k tags

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
…pplicabilities' into feat/guard-root-network-tags-on-shared-modifications

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
…rk-tags-on-shared-modifications

# Conflicts:
#	src/test/java/org/gridsuite/modification/server/CompositeControllerTest.java
Base automatically changed from refactor/explicit-root-network-applicabilities to main October 23, 2026 14:34
…rk-tags-on-shared-modifications

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>

# Conflicts:
#	src/main/java/org/gridsuite/modification/server/NetworkModificationController.java
#	src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java
#	src/main/java/org/gridsuite/modification/server/service/NetworkModificationService.java
…l helpers

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@sonarqubecloud

Copy link
Copy Markdown

@flomillot
flomillot merged commit dab7828 into main Oct 26, 2026
4 checks passed
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.

3 participants