Skip to content

Add initial support for the rules_fuzzing Bazel library.#14834

Merged
htuch merged 8 commits intoenvoyproxy:mainfrom
stefanbucur:rules-fuzzing-phase-one
Feb 2, 2021
Merged

Add initial support for the rules_fuzzing Bazel library.#14834
htuch merged 8 commits intoenvoyproxy:mainfrom
stefanbucur:rules-fuzzing-phase-one

Conversation

@stefanbucur
Copy link
Copy Markdown
Contributor

Commit Message: Introduce the new https://github.com/bazelbuild/rules_fuzzing library for fuzz testing support.

Additional Description: The new library provides new functionality (support for testing the fuzz test locally) and simplifies existing fuzzing tasks. This is the first PR in the series. See #14675 for the detailed rollout plan.

Risk Level: High (new dependencies and major change to the existing envoy_cc_fuzz_test macro)

Testing: The changes consist of either (a) code that should be a drop-in replacement to the existing functionality, or (b) new targets marked as "manual". For (a), the Envoy regression tests should catch deviations from the original behavior. The new functionality in (b) is either tested manually, or through the OSS-Fuzz integration (changes coming in future PR).

Docs Changes: None (this is test-only functionality).

Release Notes: N/A

Platform Specific Features: The fuzz tests run on Linux platforms only.

@repokitteh-read-only
Copy link
Copy Markdown

Hi @stefanbucur, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #14834 was opened by stefanbucur.

see: more, trace.

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Jan 27, 2021
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #14834 was opened by stefanbucur.

see: more, trace.

Signed-off-by: Stefan Bucur <sbucur@google.com>
@stefanbucur stefanbucur force-pushed the rules-fuzzing-phase-one branch from 30acee0 to 573c239 Compare January 27, 2021 04:54
Signed-off-by: Stefan Bucur <sbucur@google.com>
@stefanbucur
Copy link
Copy Markdown
Contributor Author

@asraa As discussed in #14675, this is the first PR in the series. PTAL.

Signed-off-by: Stefan Bucur <sbucur@google.com>
Copy link
Copy Markdown
Contributor

@asraa asraa left a comment

Choose a reason for hiding this comment

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

Thanks! Just minor comments
/wait

@asraa
Copy link
Copy Markdown
Contributor

asraa commented Jan 27, 2021

/assign htuch
For deps

Signed-off-by: Stefan Bucur <sbucur@google.com>
Signed-off-by: Stefan Bucur <sbucur@google.com>
Copy link
Copy Markdown
Contributor Author

@stefanbucur stefanbucur left a comment

Choose a reason for hiding this comment

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

PTAL.

@stefanbucur
Copy link
Copy Markdown
Contributor Author

I've just checked the failures and they don't seem to be fuzzing related. For the ASAN failure I also see there is a separate PR to address it (#14844).

asraa
asraa previously approved these changes Jan 28, 2021
Copy link
Copy Markdown
Contributor

@asraa asraa left a comment

Choose a reason for hiding this comment

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

Thanks so much! LGTM

Signed-off-by: Stefan Bucur <sbucur@google.com>
@asraa
Copy link
Copy Markdown
Contributor

asraa commented Jan 29, 2021

@moderation could you please take a look for deps please?

Copy link
Copy Markdown
Contributor

@moderation moderation left a comment

Choose a reason for hiding this comment

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

Question on sha256 pinning of Python dep

Comment on lines +102 to +109
requirements = "@rules_fuzzing//fuzzing:requirements.txt",

# project_name = "Abseil Python Common Libraries",
# project_url = "https://github.com/abseil/abseil-py",
# version = "0.11.0",
# release_date = "2020-10-27",
# use_category = ["test"],
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a little different from our existing Python dependencies that normally have a requirements.txt file. The requirements.txt file allows us to pin to sha256 hashes with extra_pip_args = ["--require-hashes"],.

From what I can tell this is referring to https://github.com/bazelbuild/rules_fuzzing/blob/master/fuzzing/requirements.txt. Is there a way to pull in this dependency and pin to the sha256 hash (which is required by policy)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've just created bazel-contrib/rules_fuzzing#121 to address that.

Do you mean to keep using the requirements.txt file from the @rules_fuzzing dependency, or make a copy in this repository?

If it's the former, I will update the dependency version to incorporate this change and enable the --require-hashes flag here.

If it's the latter, I think a good location for this file would be //test/fuzz:rules_fuzzing_requirements.txt. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've just created bazelbuild/rules_fuzzing#121 to address that.

Do you mean to keep using the requirements.txt file from the @rules_fuzzing dependency, or make a copy in this repository?

If it's the former, I will update the dependency version to incorporate this change and enable the --require-hashes flag here.

This part is done - let me know if you'd prefer to go with the second approach instead.

Comment on lines +48 to +63
rules_fuzzing = dict(
project_name = "Fuzzing Rules for Bazel",
project_desc = "Bazel rules for fuzz tests",
project_url = "https://github.com/bazelbuild/rules_fuzzing",
version = "2c97fcd74f20dce950c77129b9b9b31cc63a4c8e",
sha256 = "6764e198db6f84bd1f6bf9565ebd7bb532a73b5f99cfe19126a279f67cc9b633",
strip_prefix = "rules_fuzzing-{version}",
urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/{version}.tar.gz"],
release_date = "2021-01-28",
use_category = ["test_only"],
implied_untracked_deps = [
# This is a repository rule generated to define an OSS-Fuzz fuzzing
# engine target from the CFLAGS/CXXFLAGS environment.
"rules_fuzzing_oss_fuzz",
],
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a great OSSF score but this is test only. Looks OK to me. @htuch?

scorecard --repo=https://github.com/bazelbuild/rules_fuzzing
RESULTS                    
-------                    
Active: Pass 10            
Branch-Protection: Fail 0  
CI-Tests: Pass 10          
CII-Best-Practices: Fail 10
Code-Review: Pass 10       
Contributors: Fail 10      
Frozen-Deps: Fail 5        
Fuzzing: Pass 10           
Packaging: Fail 10         
Pull-Requests: Pass 10     
SAST: Fail 10              
Security-Policy: Fail 10   
Signed-Releases: Fail 0    
Signed-Tags: Fail 0        

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TIL about Scorecard, this is awesome! :) Just as a heads-up, we are planning to improve upon a number of these items in the short term, and will update the Envoy dependencies when this happens.

Signed-off-by: Stefan Bucur <sbucur@google.com>
htuch
htuch previously approved these changes Jan 29, 2021
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM! I think since this is test-only we will not block on OSSF Scorecard, but it would be ideal to see whatever practical steps taken here as a nice-to-have.

.bazelrc Outdated
build:oss-fuzz --linkopt=-fno-sanitize=vptr
build:oss-fuzz --define=tcmalloc=disabled
build:oss-fuzz --define=signal_trace=disabled
build:oss-fuzz --define=ENVOY_CONFIG_ASAN=1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: this is in the base fuzzing config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch - fixed.

It seems the last push has undone the previous LGTM. Could you approve again?

Signed-off-by: Stefan Bucur <sbucur@google.com>
@htuch
Copy link
Copy Markdown
Member

htuch commented Feb 2, 2021

/lgtm deps

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.

4 participants