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

🤔 G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) #168

Closed
renanbastos93 opened this issue Feb 21, 2020 · 3 comments
Closed

Comments

@renanbastos93
Copy link
Member

Based on new pipeline security, we need to treat errors

[/home/runner/work/fiber/fiber/context.go:107] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW)
  > conn.Close()

I saw this message then we need to treat possible error returns method close.
https://github.com/gofiber/fiber/blob/master/context.go#L107

Suggestion

func releaseConn(conn *Conn) {
	if err := conn.Close(); err != nil {
             ...
        }
	conn.params = nil
	conn.values = nil
	conn.Conn = nil
	poolConn.Put(conn)
}
@welcome
Copy link

welcome bot commented Feb 21, 2020

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!

@Fenny
Copy link
Member

Fenny commented Feb 22, 2020

We can remove conn.Close() since releaseConn is only called when the connection already has ended.

@basurohit77
Copy link

Still am getting the issue:

[/Users/rohbas/cloud-sre/osscatalog/mail/mailserver.go:59] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW)
    58: 	if request, err = mailSvc.CreateMailRequest(jsonBody); err != nil {
  > 59: 		debug.WrapError(err, "\n CreatMailService: CreateMailRequest: FAILED to create client request \n")
    60: 		debug.Info(string(types.ColorRed), "==== CreatMailService: FAILED In Client Request =====  ", err, string(types.ColorReset))

Any sugession.

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

No branches or pull requests

3 participants