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

Provide native image builds #27

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

eidottermihi
Copy link
Member

@eidottermihi eidottermihi commented Aug 1, 2023

@eidottermihi eidottermihi marked this pull request as draft August 1, 2023 15:23
@eidottermihi eidottermihi changed the title WIP: Provide native image builds Provide native image builds Aug 1, 2023
NimbusJwtDecoder decoder = NimbusJwtDecoder.withJwkSetUri(jwkSetUri).build();
OAuth2TokenValidator<Jwt> delegatingValidator = new DelegatingOAuth2TokenValidator<>();
decoder.setJwtValidator(delegatingValidator);
return decoder;
}

private void configureBase(HttpSecurity http) throws Exception {
http.csrf().disable().headers().frameOptions().disable().and().cors();
http.csrf(csrf -> csrf.disable()).headers(headers -> headers.frameOptions(FrameOptionsConfig::disable))

Check failure

Code scanning / CodeQL

Disabled Spring CSRF protection High

CSRF vulnerability due to protection being disabled.

Copilot Autofix AI 29 days ago

To fix the problem, we need to enable CSRF protection by removing the csrf.disable() call. This will ensure that CSRF tokens are required for state-changing requests, thereby protecting the application from CSRF attacks.

  • Remove the csrf.disable() call from the configureBase method.
  • Ensure that CSRF protection is enabled by default.
Suggested changeset 1
src/main/java/de/muenchen/oss/appswitcher/security/SecurityConfiguration.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/main/java/de/muenchen/oss/appswitcher/security/SecurityConfiguration.java b/src/main/java/de/muenchen/oss/appswitcher/security/SecurityConfiguration.java
--- a/src/main/java/de/muenchen/oss/appswitcher/security/SecurityConfiguration.java
+++ b/src/main/java/de/muenchen/oss/appswitcher/security/SecurityConfiguration.java
@@ -75,3 +75,3 @@
     private void configureBase(HttpSecurity http) throws Exception {
-        http.csrf(csrf -> csrf.disable()).headers(headers -> headers.frameOptions(FrameOptionsConfig::disable))
+        http.csrf(withDefaults()).headers(headers -> headers.frameOptions(FrameOptionsConfig::disable))
                 .cors(withDefaults());
EOF
@@ -75,3 +75,3 @@
private void configureBase(HttpSecurity http) throws Exception {
http.csrf(csrf -> csrf.disable()).headers(headers -> headers.frameOptions(FrameOptionsConfig::disable))
http.csrf(withDefaults()).headers(headers -> headers.frameOptions(FrameOptionsConfig::disable))
.cors(withDefaults());
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

1 participant