Skip to content

Conversation

@huin
Copy link
Contributor

@huin huin commented Jun 9, 2025

… body

Without this change, if the generated code uses Gosec, it may flag with a message similar to:

G104 (CWE-703): Errors unhandled (Confidence: HIGH, Severity: LOW)
    77: 	)
  > 78: 	io.Copy(io.Discard, req.Body)
    79: 	if err := req.ParseForm(); err != nil {

Have you read the Contributing Guidelines?

Yes. I have regenerated some files following the instructions.

I did have to inject export GOFLAGS=-buildvcs=false && into the bash command run in the first Docker command to avoid an error.

Brief description of what is fixed or changed

When Gosec is used, the generated code generated a warning G104 due to the implicitly ignored error from io.Copy. This seems relatively harmless (aside from potentially ignoring errors from reading the request body), so making the ignore explicit to placate the security checker.

Other comments

@huin huin marked this pull request as ready for review June 9, 2025 13:00
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks!

… body

Without this change, if the generated code uses Gosec, it may flag with
a message similar to:

```
G104 (CWE-703): Errors unhandled (Confidence: HIGH, Severity: LOW)
    77: 	)
  > 78: 	io.Copy(io.Discard, req.Body)
    79: 	if err := req.ParseForm(); err != nil {
```
@huin huin force-pushed the explicitly-ignore-discard-error branch from 2c7e1aa to 711f975 Compare June 10, 2025 07:22
@huin
Copy link
Contributor Author

huin commented Jun 10, 2025

Updated with requested fix.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks!

@johanbrandhorst johanbrandhorst merged commit 520f7f7 into grpc-ecosystem:main Jun 10, 2025
14 checks passed
@huin
Copy link
Contributor Author

huin commented Jun 11, 2025

Thanks for the review!

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.

2 participants