matusf / openapi-fuzzer

Black-box fuzzer that fuzzes APIs based on OpenAPI specification. Find bugs for free!
GNU Affero General Public License v3.0
526 stars 22 forks source link

compile errors when installing from crates.io #10

Closed xvilo closed 2 years ago

xvilo commented 2 years ago

I'm trying to install this from crates.io with Cargo. When building however it exits with the following error lines:

[...]
   Compiling rustls v0.20.1
   Compiling webpki-roots v0.22.1
   Compiling url v2.2.2
   Compiling serde_yaml v0.8.21
   Compiling ureq v2.3.1
   Compiling openapiv3 v0.5.0
   Compiling openapiv3 v0.3.2
   Compiling openapi_utils v0.2.2
   Compiling openapi-fuzzer v0.1.1
error[E0599]: no method named `to_item_ref` found for reference `&ReferenceOr<PathItem>` in the current scope
  --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/fuzzer.rs:96:40
   |
96 |                 let item = ref_or_item.to_item_ref();
   |                                        ^^^^^^^^^^^ method not found in `&ReferenceOr<PathItem>`

error[E0599]: no method named `to_item_ref` found for reference `&ReferenceOr<Box<openapiv3::Schema>>` in the current scope
  --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/payload.rs:29:35
   |
29 |         let schema_kind = &schema.to_item_ref().schema_kind;
   |                                   ^^^^^^^^^^^ method not found in `&ReferenceOr<Box<openapiv3::Schema>>`

error[E0599]: no method named `to_item_ref` found for enum `ReferenceOr` in the current scope
  --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/payload.rs:36:29
   |
36 |     let items = array.items.to_item_ref();
   |                             ^^^^^^^^^^^ method not found in `ReferenceOr<Box<openapiv3::Schema>>`

error[E0599]: no method named `to_item_ref` found for reference `&ReferenceOr<Parameter>` in the current scope
  --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/payload.rs:89:32
   |
89 |             match ref_or_param.to_item_ref() {
   |                                ^^^^^^^^^^^ method not found in `&ReferenceOr<Parameter>`

error[E0599]: no method named `to_item_ref` found for reference `&ReferenceOr<RequestBody>` in the current scope
   --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/payload.rs:106:44
    |
106 |             let request_body = ref_or_body.to_item_ref();
    |                                            ^^^^^^^^^^^ method not found in `&ReferenceOr<RequestBody>`

error[E0599]: no method named `deref_all` found for struct `OpenAPI` in the current scope
  --> /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi-fuzzer-0.1.1/src/main.rs:83:41
   |
83 |     let openapi_schema = openapi_schema.deref_all();
   |                                         ^^^^^^^^^ method not found in `OpenAPI`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `openapi-fuzzer` due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `openapi-fuzzer v0.1.1`, intermediate artifacts can be found at `/var/folders/0y/42sfx52d50d3g62rxgf9rsxm0000gn/T/cargo-installEUuSl7`

Caused by:
  build failed
Error: `cargo install` didn't work either. Looks like you're on your own.

I have no experience with this, so I would appreciate some help. I noticed there are no tagged versions, so could it be the case that the current version on master is broken?

Environment

rahulahoop commented 2 years ago

also having this issue

building from master compiles fine

S-Coyle commented 2 years ago

Same issue here as well - also tried cloning & installing with cargo install --path . but same errors there as well. Also on macOS Monteray (12.0.1) cargo 1.56.0 rustc 1.56.1

Tested a few commits back (0b8eeb2859e7cb53ad1648c84e5bd6823f033bb1) & same issue

alexspurling commented 2 years ago

I have the same issue both when installing with cargo install openapi-fuzzer and trying to install from master (e9af89a) with cargo install --path .

matusf commented 2 years ago

Thanks for the reports. I'm able to reproduce it. cargo build works fine but cargo install fails. Not sure why it behaves differently.

matusf commented 2 years ago

I bumped the openapiv3 and openapi_utils dependencies and cargo install works for me. A version 0.1.3 is published with this fix.

S-Coyle commented 2 years ago

Verified I can now install from crates.io, thanks for the quick fix!

matusf commented 2 years ago

closed by 225a644bd506226084376a32ffc976db211b5bad