ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 152 forks source link

[Fuzzing] oss-fuzz support for fuzzing #387

Closed 0x34d closed 1 year ago

0x34d commented 1 year ago

Adding Go Fuzzing support to identify bugs. These files can be used in Go-lang OSS-Fuzz integration.

Running fuzzing locally:

go test -fuzz=FuzzUnmarshal -parallel=4 $PWD/internal/legacy/credentials
go test -fuzz=FuzzNewParser -parallel=4 $PWD/pkg/message/parser
go test -fuzz=FuzzReadHeaderBody -parallel=4 $PWD/pkg/message
go test -fuzz=FuzzDecodeHeader -parallel=4 $PWD/pkg/mime
go test -fuzz=FuzzDecodeCharset -parallel=4 $PWD/pkg/mime
LBeernaertProton commented 1 year ago

@0x34d thank you for your contribution, we will merge this as soon as we are able.

Is there a way for go test to automatically run all fuzzing tests rather than having to manual specify each individual test?

0x34d commented 1 year ago

Is there a way for go test to automatically run all fuzzing tests rather than having to manual specify each individual test?

No, there is no such way.

But I can do something like this in Makefile:

fuzz:
    @go test -fuzz=FuzzUnmarshal -parallel=4 -fuzztime=1800s $PWD/internal/legacy/credentials
    @go test -fuzz=FuzzNewParser -parallel=4 -fuzztime=1800s $PWD/pkg/message/parser
    @go test -fuzz=FuzzReadHeaderBody -parallel=4 -fuzztime=1800s $PWD/pkg/message
    @go test -fuzz=FuzzDecodeHeader -parallel=4 -fuzztime=1800s $PWD/pkg/mime
    @go test -fuzz=FuzzDecodeCharset -parallel=4 -fuzztime=1800s $PWD/pkg/mime
0x34d commented 1 year ago

@LBeernaertProton ping. Makefile is also updated now, can you merge?

LBeernaertProton commented 1 year ago

@0x34d sorry for the silence on this, I have been busy with more pressing matter. I'll try to get this in by end of day tomorrow.

LBeernaertProton commented 1 year ago

@0x34d Thanks for your contribution. Your changes have been merged in our internal repository.

0x34d commented 1 year ago

@0x34d Thanks for your contribution. Your changes have been merged in our internal repository.

Just a question, when will this update be available on the public repository?

LBeernaertProton commented 1 year ago

Yes. Apologies if I didn't make this clear. It may take a while, but should become available in 1 or 2 releases.