-
Notifications
You must be signed in to change notification settings - Fork 2
Add files via upload #6
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package com.softsafe.sast.platform.config.security; | ||
|
|
||
| import com.softsafe.sast.platform.config.RestAccessDeniedHandler; | ||
| import com.softsafe.sast.platform.config.RestAuthenticationEntryPoint; | ||
| import lombok.RequiredArgsConstructor; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在函数 process_test_data 中新增了 print(_add_new_func()) 语句,这会导致每次调用该函数时打印不必要的信息,影响性能和日志清晰度。 |
||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.core.annotation.Order; | ||
| import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
| import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
| import org.springframework.security.web.SecurityFilterChain; | ||
|
|
||
| @Configuration | ||
| @EnableWebSecurity | ||
| @RequiredArgsConstructor | ||
| public class SecurityConfig { | ||
| private final RestAuthenticationEntryPoint restAuthEntryPoint; | ||
| private final RestAccessDeniedHandler restAccessDeniedHandler; | ||
| private final OAuth2LoginSuccessHandler oauth2LoginSuccessHandler; | ||
|
|
||
| @Bean | ||
| @Order(2) | ||
| public SecurityFilterChain applicationSecurity(HttpSecurity http) throws Exception { | ||
|
|
||
| http.exceptionHandling(ex -> ex | ||
| .authenticationEntryPoint(restAuthEntryPoint) | ||
| .accessDeniedHandler(restAccessDeniedHandler) | ||
| ) | ||
| .authorizeHttpRequests(authorize -> authorize | ||
| .requestMatchers( | ||
| "/", "/login", "/login.html", | ||
| "/error", | ||
| "/github/webhook", | ||
| "/api/sast/**", | ||
| "/favicon.ico", "/icons/**" | ||
| ).permitAll() | ||
| .anyRequest().authenticated() | ||
| ) | ||
|
Comment on lines
+29
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Entire SAST API exposed without authentication. The
Please verify whether this is intentional. If these endpoints should be protected, apply appropriate authentication requirements. Run the following script to identify what endpoints exist under #!/bin/bash
# Description: Find all controllers/endpoints under /api/sast path to assess security implications
# Search for controller mappings under /api/sast
rg -n --type=java -C5 '@.*Mapping.*["\(]/api/sast|@RequestMapping.*sast'
# Search for RestController or Controller classes that might handle sast endpoints
rg -n --type=java -C3 'class.*SastController|class.*Sast.*Controller'🤖 Prompt for AI Agents |
||
| .oauth2Login(oauth2 -> oauth2 | ||
| .successHandler(oauth2LoginSuccessHandler) | ||
| .failureUrl("/login?error") | ||
| ) | ||
| .csrf(csrf -> csrf | ||
| .ignoringRequestMatchers("/github/webhook", "/api/sast/**") | ||
| ); | ||
|
Comment on lines
+43
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Search for GitHub webhook signature verification logic
rg -n --type=java -C5 'X-Hub-Signature|webhook.*verify|signature.*github|hmac'Repository: SoftSec-Tech/big_num_cal Length of output: 50 🏁 Script executed: # Find the webhook controller and handler
rg -n --type=java '@.*Mapping.*["\(].*webhook'Repository: SoftSec-Tech/big_num_cal Length of output: 50 🏁 Script executed: # Examine SecurityConfig.java to see the full context around lines 43-45
fd SecurityConfig.java --type fRepository: SoftSec-Tech/big_num_cal Length of output: 87 🏁 Script executed: # Search for authentication configuration to understand the permitAll setup
rg -n --type=java 'permitAll|csrf.*ignoringRequest' --max-count=20Repository: SoftSec-Tech/big_num_cal Length of output: 128 🏁 Script executed: cat -n SecurityConfig.javaRepository: SoftSec-Tech/big_num_cal Length of output: 2527 🏁 Script executed: # Search more broadly for webhook-related code
rg -n --type=java 'webhook|github' -iRepository: SoftSec-Tech/big_num_cal Length of output: 249 🏁 Script executed: # Search for any controller or handler classes
fd --type f --name '*Controller*' --o --name '*Handler*'Repository: SoftSec-Tech/big_num_cal Length of output: 318 🏁 Script executed: # Search for any webhook-related implementations with different patterns
rg -n 'webhook|github' -i --type=javaRepository: SoftSec-Tech/big_num_cal Length of output: 249 🏁 Script executed: # Search for any controller classes
fd --type f -n '*Controller*'Repository: SoftSec-Tech/big_num_cal Length of output: 298 🏁 Script executed: # Search for request mapping annotations that might handle webhooks
rg -n '@PostMapping|@RequestMapping|@GetMapping' --type=java -A2Repository: SoftSec-Tech/big_num_cal Length of output: 50 🏁 Script executed: # Get overall project structure
git ls-files --type f | head -30Repository: SoftSec-Tech/big_num_cal Length of output: 2146 🏁 Script executed: # Check if there are any TODOs or FIXMEs related to webhook
rg -n 'TODO|FIXME' --type=java -iRepository: SoftSec-Tech/big_num_cal Length of output: 50 🏁 Script executed: # Search for test files that might reference webhook
fd --type f --extension java | xargs grep -l webhook 2>/dev/null || echo "No webhook references found"Repository: SoftSec-Tech/big_num_cal Length of output: 87 Evaluate CSRF protection configuration against intended endpoint behavior. CSRF is disabled for
|
||
|
|
||
| return http.build(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在函数 process_test_data 中新增了 print(_add_new_func()) 语句,这会导致每次调用该函数时打印不必要的信息,影响性能和日志清晰度。