Skip to content

NIFI-15875 Standardize Authorization for Verify Configuration Methods#11179

Merged
mcgilman merged 2 commits into
apache:mainfrom
exceptionfactory:NIFI-15875
May 1, 2026
Merged

NIFI-15875 Standardize Authorization for Verify Configuration Methods#11179
mcgilman merged 2 commits into
apache:mainfrom
exceptionfactory:NIFI-15875

Conversation

@exceptionfactory
Copy link
Copy Markdown
Contributor

Summary

NIFI-15875 Standardizes authorization handling for REST API methods responsible for initiating configuration verification requests for extension components. Changes include aligning method documentation with implemented requirements, and ensuring write authorization for components together with read authorization for any referenced Controller Services.

The new AuthorizeConfigVerification class provides a unified implementation and minimizes duplication of similar logic across different types of extension components.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

- Added AuthorizeConfigVerification class for shared component authorization handling
@mcgilman
Copy link
Copy Markdown
Contributor

Will review...

@mcgilman mcgilman self-requested a review April 28, 2026 14:15
Copy link
Copy Markdown
Contributor

@mcgilman mcgilman 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 PR @exceptionfactory! Just left a few noted below.

final Authorizer authorizer,
final AuthorizableLookup lookup,
final ComponentAuthorizable component,
final Map<String, String> proposedProperties,
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.

proposedProperties may have contain parameter references. I think we need to additionally authorize the Parameter Context when necessary. Similar to what was done here [1].

[1] https://github.com/apache/nifi/blob/main/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/authorization/AuthorizeComponentReference.java#L76

import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
class AuthorizeConfigVerificationTest {
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.

Does it make sense to also have coverage of a Controller Service reference or a Parameter reference.

security = {
@SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}")
@SecurityRequirement(name = "Write - /controller"),
@SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"),
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.

Other endpoints for Flow Analysis Rules just check Controller permissions. I don't think the UI allows the user to manually manage policies for individual access policies. I think enforcing permissions through the rule would technically work since it's parent is defined as the Controller, it's an inconsistency with the other Flow Analysis Rules endpoints.

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.

I was thinking along the same lines, Controller enforcement should work as the parent Authorizable in this case.

@exceptionfactory
Copy link
Copy Markdown
Contributor Author

Thanks for the review @mcgilman, I pushed an update to add Parameter reference authorization, and new test methods for that case and the Controller Service reference case.

Copy link
Copy Markdown
Contributor

@mcgilman mcgilman 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 updates @exceptionfactory!

@mcgilman mcgilman merged commit f30f877 into apache:main May 1, 2026
14 of 16 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.

2 participants