wiretap icon indicating copy to clipboard operation
wiretap copied to clipboard

wiretap service crashes when trying to send response

Open suneel-lean opened this issue 1 year ago • 5 comments

Description

'"{    \"Data\": {        \"CryptId\": \"****************\",        \"Pyro_transactions\": [        ]    },    \"Links\": {        \"Self\": \"/crypt-information/********/crypt/<uuid>/Pyro_transactions\"    },    \"Meta\": {        \"TotalPages\": 1    }}"'

error:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x68 pc=0x1012b45cc]

goroutine 3914 [running]:
github.com/santhosh-tekuri/jsonschema/v5.(*Schema).validateValue.func1()
        /home/runner/go/pkg/mod/github.com/santhosh-tekuri/jsonschema/[email protected]/schema.go:178 +0x120
panic({0x101cc5aa0?, 0x1025a6b70?})
        /opt/hostedtoolcache/go/1.22.1/x64/src/runtime/panic.go:770 +0x124
github.com/santhosh-tekuri/jsonschema/v5.(*Schema).validate(0x0, {0x0, 0x0, 0x0}, 0x0, {0x0, 0x0}, {0x101cb60c0, 0x1400055fad0}, {0x0, ...})
        /home/runner/go/pkg/mod/github.com/santhosh-tekuri/jsonschema/[email protected]/schema.go:253 +0x43c
github.com/santhosh-tekuri/jsonschema/v5.(*Schema).validateValue(0x0, {0x101cb60c0?, 0x1400055fad0?}, {0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/santhosh-tekuri/jsonschema/[email protected]/schema.go:182 +0x94
github.com/santhosh-tekuri/jsonschema/v5.(*Schema).Validate(...)
        /home/runner/go/pkg/mod/github.com/santhosh-tekuri/jsonschema/[email protected]/schema.go:168
github.com/pb33f/libopenapi-validator/responses.ValidateResponseSchema(0x140006d4b40, 0x140005263f0, 0x14000554508, {0x14000f3e000, 0xfdc5, 0x12000}, {0x14000ff6000, 0x96c6, 0x3?})
        /home/runner/go/pkg/mod/github.com/pb33f/[email protected]/responses/validate_response.go:132 +0x99c
github.com/pb33f/libopenapi-validator/responses.(*responseBodyValidator).checkResponseSchema(0x14000955b00, 0x140006d4b40, 0x140005263f0, {0x140002b00c0?, 0x14000c42190?}, 0x1400063ab40)
        /home/runner/go/pkg/mod/github.com/pb33f/[email protected]/responses/validate_body.go:140 +0x1fc
github.com/pb33f/libopenapi-validator/responses.(*responseBodyValidator).ValidateResponseBody(0x14000955b00, 0x140006d4b40, 0x140005263f0)
        /home/runner/go/pkg/mod/github.com/pb33f/[email protected]/responses/validate_body.go:54 +0x348
github.com/pb33f/libopenapi-validator.(*validator).ValidateHttpResponse(0x140004ec380, 0x140006d4b40, 0x140005263f0)
        /home/runner/go/pkg/mod/github.com/pb33f/[email protected]/validator.go:116 +0xbc
github.com/pb33f/wiretap/daemon.(*WiretapService).ValidateResponse(0x140009f3040, 0x140004e40c0, 0x140005263f0)
        /home/runner/work/wiretap/wiretap/daemon/validate.go:19 +0x6c
created by github.com/pb33f/wiretap/daemon.(*WiretapService).handleHttpRequest in goroutine 3612
        /home/runner/work/wiretap/wiretap/daemon/handle_request.go:196 +0xa54

suneel-lean avatar Apr 03 '24 18:04 suneel-lean

will take a look for you.

daveshanley avatar Apr 04 '24 14:04 daveshanley

any luck in fixing the above?

suneel-lean avatar Apr 14 '24 13:04 suneel-lean

I think we can close this issue as the open api spec was modified wrongly and leading to the app crash, but still an investigation would be good though

suneel-lean avatar Apr 18 '24 16:04 suneel-lean

I have not had a chance to look at this yet.

daveshanley avatar Apr 18 '24 16:04 daveshanley

I am unable to re-create this issue, can you provide a spec sample and the request you're sending?

daveshanley avatar Apr 30 '24 15:04 daveshanley