{"id":21602726,"url":"https://github.com/codeintelligencetesting/bazel-example","last_synced_at":"2026-02-13T09:36:14.371Z","repository":{"id":257756130,"uuid":"859229713","full_name":"CodeIntelligenceTesting/bazel-example","owner":"CodeIntelligenceTesting","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-08T14:16:25.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-04T16:41:04.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodeIntelligenceTesting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-18T10:03:18.000Z","updated_at":"2025-05-08T14:16:30.000Z","dependencies_parsed_at":"2024-09-18T13:41:48.124Z","dependency_job_id":null,"html_url":"https://github.com/CodeIntelligenceTesting/bazel-example","commit_stats":null,"previous_names":["codeintelligencetesting/bazel-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodeIntelligenceTesting/bazel-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIntelligenceTesting%2Fbazel-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIntelligenceTesting%2Fbazel-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIntelligenceTesting%2Fbazel-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIntelligenceTesting%2Fbazel-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeIntelligenceTesting","download_url":"https://codeload.github.com/CodeIntelligenceTesting/bazel-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeIntelligenceTesting%2Fbazel-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29400518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T19:14:10.034Z","updated_at":"2026-02-13T09:36:14.325Z","avatar_url":"https://github.com/CodeIntelligenceTesting.png","language":"Starlark","readme":"# cifuzz bazel example\n\nThis is a simple bazel based project, already configured with\n**cifuzz**. It should quickly produce a finding, but slow enough to\nsee the progress of the fuzzer.\n\nTo start make sure you installed **cifuzz** and all prerequesites\n(see [docs](https://docs.code-intelligence.com/get-started/setup-ci-fuzz/c-cpp/bazel)).\n\nYou can start the fuzzing with\n\n```bash\ncifuzz run //src:explore_me_fuzz_test\n```\n\n## Create regression test\n\nAfter you have discovered a finding, you may want to include this as\npart of a regression test. To replay findings from the\n`src/explore_me_fuzz_test_inputs` directory:\n\n```bash\nbazel test --config=cifuzz-replay //src:explore_me_fuzz_test --test_output=streamed\n```\n\nNote that this requires these lines in your `.bazelrc`:\n\n```bash\n# Replay cifuzz findings (C/C++ only)\nbuild:cifuzz-replay --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan-ubsan\nbuild:cifuzz-replay --compilation_mode=opt\nbuild:cifuzz-replay --copt=-g\nbuild:cifuzz-replay --copt=-U_FORTIFY_SOURCE\nbuild:cifuzz-replay --test_env=UBSAN_OPTIONS=halt_on_error=1\n```\n\n## C++ Toolchain\n\nThis project uses\n[toolchains_llvm](https://github.com/bazel-contrib/toolchains_llvm) to configure\nthe cc toolchain used by bazel to compile fuzz tests. To ensure hermetic\nbuilds a [chromium sysroot](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/sysroot.md)\nis used.\n\nThe toolchain can be tested using the provided `Dockerfile` which installs\nminimal dependencies to run this example project. Note, that no compiler and no\nC++ library headers are installed since they are provided with the cc toolchain.\n\nStart by building the docker image\n\n```\nexport CIFUZZ_DOWNLOAD_TOKEN=\u003cdownload token from https://downloads.code-intelligence.com\u003e\ndocker build --tag bazel-example --build-arg CIFUZZ_DOWNLOAD_TOKEN .\n```\n\nWarning: Don't push this docker image to a public repository since it could leak\n         your personal download token. This image is intended for local\n         experimentation.\nWarning: This docker image can become quite large because it populates the bazel\n         cache with all dependencies and the hermetic toolchain.\n\nRun the docker image\n\n```\ndocker run --rm -it bazel-example\n```\n\nInside the docker image you need to set `CC` and `CXX` to the toolchain clang\ncompiler. This can be done with the `set_env.sh` script:\n\n```\n$ source set_env.sh\n$ $CC --version\nclang version 15.0.6\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /root/.cache/bazel/_bazel_root/1e0bb3bee2d09d2e4ad3523530d3b40c/execroot/_main/external/toolchains_llvm~~llvm~llvm_toolchain_llvm/bin\n```\n\nNow you can run cifuzz commands on the example project. For `cifuzz run` and\n`cifuzz coverage` you should get output similar to this:\n\n```\n$ cifuzz run\n🚀 Running //src:explore_me_fuzz_test_bin...\n ✅  Building... Done.\nLog can be found here:\n    /work/.cifuzz-build/logs/build-src_explore_me_fuzz_test.log\n ✅  Initializing... Done.\nFuzz testing will be performed for 10m. Use '--max-fuzzing-duration' to change the duration.\n ✅  Testing code...\n34 Unique Test Cases and 2 Findings detected in 0s.\n\nCRITICAL\n  💥 NEW [quirky_okapi] heap_buffer_overflow in exploreMe (src/explore_me.cpp:18:11)\nLOW\n  💥 NEW [stoic_jay] undefined behavior in exploreMe (src/explore_me.cpp:13:11)\n```\n\n```\n$ cifuzz coverage --format lcov\n ✅  Building //src:explore_me_fuzz_test_bin... Done.\n ✅  Generating lcov report for //src:explore_me_fuzz_test_bin... Done.\n ✅  Creating coverage report... Done.\n\n                        File | Functions Hit/Found |  Lines Hit/Found | Branches Hit/Found\n          src/explore_me.cpp |      1 / 1 (100.0%) | 15 / 15 (100.0%) |     8 / 8 (100.0%)\nsrc/explore_me_fuzz_test.cpp |      2 / 2 (100.0%) |   8 / 8 (100.0%) |     0 / 0 (100.0%)\n                             |                     |                  |\n                             | Functions Hit/Found |  Lines Hit/Found | Branches Hit/Found\n                       Total |      3 / 3 (100.0%) | 23 / 23 (100.0%) |     8 / 8 (100.0%)\n\nLCOV report can be found here:\n    --src:explore_me_fuzz_test_bin.lcov.info\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeintelligencetesting%2Fbazel-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeintelligencetesting%2Fbazel-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeintelligencetesting%2Fbazel-example/lists"}