Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Op-21881:CVE-fixes with java-17 and spring-boot upgrade-v4.0 #466

Merged
merged 13 commits into from
Mar 27, 2024

Conversation

emanipravallika
Copy link
Collaborator

Copy link
Collaborator

Choose a reason for hiding this comment

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

remove commented out code
also we have to fix the bean creation here properly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

remove commented out code
also, we have to fix the bean creation here properly.

@Bean
public AuthenticationManager authenticationManager(
AuthenticationConfiguration authConfig) throws Exception {
return authConfig.getAuthenticationManager();
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have getAuthenticationManager defined in AuthConfig? but why do we need to have the bean declaration then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it is not defined in AuthConfig

Copy link
Collaborator

Choose a reason for hiding this comment

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

than why it used here authConfig.getAuthenticationManager();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will remove it

import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;

public class BearerTokenExtractor {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Attach a java doc explaining where this is needed

SamlAuthTokenUpdateFilter authTokenUpdateFilter = new SamlAuthTokenUpdateFilter()
http.addFilterAfter(authTokenUpdateFilter,
BasicAuthenticationFilter.class)
// saml.init(http)
Copy link
Collaborator

Choose a reason for hiding this comment

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

cleanup


@Slf4j
@ControllerAdvice(basePackageClasses = [OpsmxSaporPolicyController.class, OpsmxAutopilotController.class,
OpsmxAuditClientServiceController.class, OpsmxDashboardController.class, OpsmxPlatformController.class,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why OpsmxDashboardController has been removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will add back

Copy link
Collaborator

@rahul-chekuri rahul-chekuri left a comment

Choose a reason for hiding this comment

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

@emanipravallika overall good work, highly appreciated.

Did you test swagger after this upgrade?
Did you test saml config? what was the outcome?
What other auth configs you tested other than ldap?

There are a lot of places where cleanup is needed. I have pointed most of them but you too review them and remove.

@@ -94,60 +96,54 @@ public void authorizeUserForApplicationId(

log.debug("authorizing the endpoint : {}", endpointUrl);

switch (method) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the switch has been replaced by if-else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if switch case is used - encountered this error{Incompatible types. Found: 'org.springframework.http.HttpMethod', required: 'char, byte, short, int, Character, Byte, Short, Integer, String, or an enum'}, SO, I replaced with if-else

@@ -182,64 +178,59 @@ public void authorizeUserForServiceId(String username, String endpointUrl, Strin

log.info("authorizing the endpoint for service Id : {}", endpointUrl);

switch (method) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if switch case is used - encountered this error{Incompatible types. Found: 'org.springframework.http.HttpMethod', required: 'char, byte, short, int, Character, Byte, Short, Integer, String, or an enum'}, SO, I replaced with if-else

@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAccessibility
Copy link
Collaborator

Choose a reason for hiding this comment

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

cleanup needed??

org.gradle.parallel=true
spinnakerGradleVersion=8.25.0
targetJava11=true
spinnakerGradleVersion=1-0-SNAPSHOT
Copy link
Collaborator

Choose a reason for hiding this comment

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

from where did we pick these versions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From spinnaker gate-oes

spinnakerGradleVersion=8.25.0
targetJava11=true
spinnakerGradleVersion=1-0-SNAPSHOT
#targetJava11=true
Copy link
Collaborator

Choose a reason for hiding this comment

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

cleanup needed??

@@ -21,3 +21,4 @@ targetJava11=true
#
#fiatComposite=true
#korkComposite=true
org.gradle.jvmargs=-Xmx6g -Xms6g
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we passing JVM args in props? do these shouldn't be part of the run command? how are we sure about the values like 6g?

@rahul-chekuri rahul-chekuri merged commit 471b2ae into v4.0 Mar 27, 2024
1 check failed
@rahul-chekuri rahul-chekuri deleted the BugFix/OP-21881-CVE-Fixes-v4.0 branch March 27, 2024 14:21
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