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

Code Security Report: 10 high severity findings, 186 total findings #5

Open
1 task
mend-for-github-com bot opened this issue Aug 16, 2024 · 0 comments
Open
1 task
Labels
Mend: code security findings Code security findings detected by Mend

Comments

@mend-for-github-com
Copy link

mend-for-github-com bot commented Aug 16, 2024

Code Security Report

Scan Metadata

Latest Scan: 2024-11-04 04:59pm
Total Findings: 186 | New Findings: 0 | Resolved Findings: 0
Tested Project Files: 7339
Detected Programming Languages: 3 (JavaScript / TypeScript*, Go, Python)

  • Check this box to manually trigger a scan

Most Relevant Findings

The list below presents the 10 most relevant findings that need your attention. To view information on the remaining findings, navigate to the Mend Application.

SeverityVulnerability TypeCWEFileData FlowsDate
HighInsecure Directory Permissions

CWE-732

fs.go:118

12024-08-16 04:42pm
Vulnerable Code

}
// Create needed directories to extract file
// We can ignore gosec G304 here since it makes sense to give all users read access
// nolint:gosec
if err := os.MkdirAll(filepath.Dir(dstPath), 0755); err != nil {

1 Data Flow/s detected

if err := os.MkdirAll(filepath.Dir(dstPath), 0755); err != nil {

Secure Code Warrior Training Material
 
HighInsecure Directory Permissions

CWE-732

fs.go:105

12024-08-16 04:42pm
Vulnerable Code

dstPath := filepath.Clean(filepath.Join(fs.pluginsDir, removeGitBuildFromName(zf.Name, pluginDirName))) // lgtm[go/zipslip]
if zf.FileInfo().IsDir() {
// We can ignore gosec G304 here since it makes sense to give all users read access
// nolint:gosec
if err := os.MkdirAll(dstPath, 0755); err != nil {

1 Data Flow/s detected

if err := os.MkdirAll(dstPath, 0755); err != nil {

Secure Code Warrior Training Material
 
HighInsecure File Permissions

CWE-732

file.go:130

12024-08-16 04:42pm
Vulnerable Code

func (w *FileLogWriter) createLogFile() (*os.File, error) {
// Open the log file
// We can ignore G304 here since we can't unconditionally lock these log files down to be readable only
// by the owner
// nolint:gosec
return os.OpenFile(w.Filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)

1 Data Flow/s detected

return os.OpenFile(w.Filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)

Secure Code Warrior Training Material
 
HighDOM Based Cross-Site Scripting

CWE-79

index.tsx:41

12024-08-16 04:42pm
Vulnerable Code

window.onload = () => {
// the trailing slash breaks relative URL loading
if (window.location.pathname.endsWith('/')) {
const idx = window.location.href.lastIndexOf('/');
window.location.href = window.location.href.substring(0, idx);

1 Data Flow/s detected

window.location.href = window.location.href.substring(0, idx);

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior DOM Based Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior DOM Based Cross-Site Scripting Video

 
HighDOM Based Cross-Site Scripting

CWE-79

AppRootPage.tsx:91

12024-08-16 04:42pm
Vulnerable Code

);
}
const pluginRoot = plugin.root && (
<PluginContextProvider meta={plugin.meta}>
<plugin.root

1 Data Flow/s detected

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior DOM Based Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior DOM Based Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

webhook-listener.go:160

12024-08-16 04:42pm
Vulnerable Code

log.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
w.Header().Add("Content-Type", "application/json")
w.Write(b)

1 Data Flow/s detected

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

webhook-listener.go:135

12024-08-16 04:42pm
Vulnerable Code

log.Printf("got submission from: %s\n", r.RemoteAddr)
b, err := io.ReadAll(r.Body)
if err != nil {
log.Println(err)
w.WriteHeader(http.StatusBadRequest)
return

1 Data Flow/s detected

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

middleware.go:29

12024-08-16 04:42pm
Vulnerable Code

respondWithError(rw, httpError)
return
}
rw.Header().Set("Content-Type", "application/json")
_, err := rw.Write(json)

1 Data Flow/s detected

json, httpError := handleFunc(ctx, pluginContext, reqCtxFactory, req.URL.Query())

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

resource_handler.go:57

12024-08-16 04:42pm
Vulnerable Code

if err != nil {
writeResponse(rw, http.StatusBadRequest, fmt.Sprintf("unexpected error %v", err), logger.FromContext(ctx))
return
}
rw.WriteHeader(http.StatusOK)
_, err = rw.Write(body)

1 Data Flow/s detected

data, err := handleFunc(ctx, pluginContext, req.URL.Query())

body, err := json.Marshal(data)

_, err = rw.Write(body)

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

events_views.py:65

12024-08-16 04:42pm
Vulnerable Code

else:
return HttpResponse(status=405)
def get_data(request):
if 'jsonp' in request.REQUEST:
response = HttpResponse(

1 Data Flow/s detected

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

Findings Overview

Severity Vulnerability Type CWE Language Count
High Cross-Site Scripting CWE-79 Go 4
High Cross-Site Scripting CWE-79 Python 1
High DOM Based Cross-Site Scripting CWE-79 JavaScript / TypeScript* 2
High Insecure Directory Permissions CWE-732 Go 2
High Insecure File Permissions CWE-732 Go 1
Medium Heap Inspection CWE-244 Go 52
Medium Insecure TLS Configuration CWE-295 Go 3
Medium Hardcoded Password/Credentials CWE-798 JavaScript / TypeScript* 1
Medium Sleep Denial of Service CWE-400 Go 1
Medium Weak Pseudo-Random CWE-338 Go 93
Low Log Forging CWE-117 Go 10
Low Weak Hash Strength CWE-916 Go 16
@mend-for-github-com mend-for-github-com bot added the Mend: code security findings Code security findings detected by Mend label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mend: code security findings Code security findings detected by Mend
Projects
None yet
Development

No branches or pull requests

0 participants