Skip to content

Conversation

@MMaiero
Copy link
Member

@MMaiero MMaiero commented Sep 8, 2025

Note: We are using the Conventional Commits convention for our pull request titles. Please take a look at the PR title format document for the supported types and scopes.

Brief description of the PR. [e.g. Added null check on object to avoid NullPointerException]

Related Issue: This PR fixes/closes {issue number}

Description of the solution adopted: A more detailed description of the changes made to solve/close one or more issues. If the PR is simple and easy to understand this section can be skipped

Screenshots: If applicable, add screenshots to help explain your solution

Manual Tests: Optional description of the tests performed to check correct functioning of changes, useful for an efficient review

Any side note on the changes made: Description of any other change that has been made, which is not directly linked to the issue resolution [e.g. Code clean up/Sonar issue resolution]

@MMaiero MMaiero requested a review from Copilot September 8, 2025 07:22
@MMaiero MMaiero changed the title Feature/container temporary credentials feat: container temporary credentials Sep 8, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a temporary identity service feature for container authentication that allows containers to be provisioned with temporary credentials for accessing Kura REST APIs, enhancing security by eliminating the need for persistent credentials.

  • Implements TemporaryIdentityService API and core functionality for managing in-memory temporary identities
  • Adds container identity integration to automatically provision temporary credentials for containers
  • Introduces REST authentication provider for validating temporary tokens

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/identity/TemporaryIdentityService.java Defines the new API interface for temporary identity management
kura/org.eclipse.kura.core.identity/src/main/java/org/eclipse/kura/core/identity/IdentityServiceImpl.java Implements temporary identity service functionality within the existing identity service
kura/org.eclipse.kura.core.identity/src/main/java/org/eclipse/kura/core/identity/TemporaryIdentity.java Data model for temporary identity objects with permissions and tokens
kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/auth/TemporaryTokenAuthenticationProvider.java REST authentication provider for validating temporary tokens
kura/org.eclipse.kura.rest.provider/src/main/java/org/eclipse/kura/internal/rest/provider/AuthenticationFilter.java Updates authentication filter to support temporary token validation
kura/org.eclipse.kura.container.provider/src/main/java/org/eclipse/kura/container/provider/ContainerInstance.java Container integration to create and inject temporary credentials
kura/org.eclipse.kura.container.provider/src/main/java/org/eclipse/kura/container/provider/ContainerInstanceOptions.java Configuration options for container identity integration
kura/test/org.eclipse.kura.core.identity.test/src/main/java/org/eclipse/kura/core/identity/test/TemporaryIdentityServiceTest.java Comprehensive test suite for temporary identity functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +134 to +137
// Check if this is a temporary token principal by examining the class name
if (requestUser.getClass().getSimpleName().contains("TemporaryToken")) {
return isTemporaryUserInRole(requestUser, role);
}
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Using class name comparison is fragile and error-prone. Consider using instanceof check or implementing a marker interface/method to identify temporary token principals instead of string comparison on class name.

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +157
// Get the token using reflection
final String token = (String) principal.getClass().getMethod("getToken").invoke(principal);
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Using reflection to access the token is fragile and can fail at runtime. Consider defining an interface with a getToken() method that the TemporaryTokenPrincipal can implement, allowing for type-safe access.

Copilot uses AI. Check for mistakes.
.setDeviceList(baseConfig.getContainerDevices())
.setFrameworkManaged(baseConfig.isFrameworkManaged())
.setLoggingType(baseConfig.getContainerLoggingType())
.setContainerNetowrkConfiguration(baseConfig.getContainerNetworkConfiguration())
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

There is a typo in the method name. It should be "setContainerNetworkConfiguration" instead of "setContainerNetowrkConfiguration".

Suggested change
.setContainerNetowrkConfiguration(baseConfig.getContainerNetworkConfiguration())
.setContainerNetworkConfiguration(baseConfig.getContainerNetworkConfiguration())

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
47.7% Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

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