bulwark icon indicating copy to clipboard operation
bulwark copied to clipboard

Screenshot uploaded is not showing up in vulnerability preview or report

Open cxzero opened this issue 3 years ago • 1 comments

Describe the bug Screenshot uploaded in an existing or new vulnerability is not showing up in vulnerability preview or report generation.

Problem Locations Running the application locally with docker. Go to Organization -> Asset -> Assessment -> Edit Vulnerability -> Upload image (ex.: http://localhost:5000/#/organization/1/asset/1/assessment/1/vuln-form/1)

Steps to Reproduce Steps to reproduce the behavior:

  1. Click on an existing 'organization'
  2. Click on an existing 'asset'
  3. Click on an existing 'assessment'
  4. Click to edit an existing 'vulnerability'
  5. Upload an image. Message "Screenshot Upload" appears
  6. Click on "Submit". Message "Vulnerability patched successfully" appears.
  7. Click on "Preview report"; image is not showing up
  8. Click on "Generate report"; image is not showing up
  9. Go back to 4, ans scroll down to the image section and see that the image is not there.

Expected behavior Screenshot image uploaded and showing up preview or report generation.

Desktop (please complete the following information):

Log errors: Watching at the logs I see:

bulwark       | query failed: INSERT INTO `file`(`id`, `fieldName`, `originalname`, `encoding`, `mimetype`, `buffer`, `size`, `vulnerabilityId`) VALUES (DEFAULT, DEFAULT, ?, ?, ?, ?, ?, ?) -- PARAMETERS: ["a.jpeg","7bit","image/jpeg",{"type":"Buffer","data":[] (...)
bulwark       | error: Error: ER_NO_DEFAULT_FOR_FIELD: Field 'fieldName' doesn't have a default value
bulwark       |     at Query.Sequence._packetToError (/bulwark/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
bulwark       |     at Query.ErrorPacket (/bulwark/node_modules/mysql/lib/protocol/sequences/Query.js:79:18)
bulwark       |     at Protocol._parsePacket (/bulwark/node_modules/mysql/lib/protocol/Protocol.js:291:23)
bulwark       |     at Parser._parsePacket (/bulwark/node_modules/mysql/lib/protocol/Parser.js:433:10)
bulwark       |     at Parser.write (/bulwark/node_modules/mysql/lib/protocol/Parser.js:43:10)
bulwark       |     at Protocol.write (/bulwark/node_modules/mysql/lib/protocol/Protocol.js:38:16)
bulwark       |     at Socket.<anonymous> (/bulwark/node_modules/mysql/lib/Connection.js:88:28)
bulwark       |     at Socket.<anonymous> (/bulwark/node_modules/mysql/lib/Connection.js:526:10)
bulwark       |     at Socket.emit (events.js:376:20)
bulwark       |     at addChunk (internal/streams/readable.js:309:12)
bulwark       |     at readableAddChunk (internal/streams/readable.js:284:9)
bulwark       |     at Socket.Readable.push (internal/streams/readable.js:223:10)
bulwark       |     at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
bulwark       |     --------------------
bulwark       |     at Protocol._enqueue (/bulwark/node_modules/mysql/lib/protocol/Protocol.js:144:48)
bulwark       |     at PoolConnection.query (/bulwark/node_modules/mysql/lib/Connection.js:198:25)
bulwark       |     at MysqlQueryRunner.<anonymous> (/bulwark/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:208:44)
bulwark       |     at step (/bulwark/node_modules/typeorm/node_modules/tslib/tslib.js:143:27)
bulwark       |     at Object.next (/bulwark/node_modules/typeorm/node_modules/tslib/tslib.js:124:57)
bulwark       |     at fulfilled (/bulwark/node_modules/typeorm/node_modules/tslib/tslib.js:114:62)
bulwark       |     at runMicrotasks (<anonymous>)
bulwark       |     at processTicksAndRejections (internal/process/task_queues.js:95:5) {
bulwark       |   code: 'ER_NO_DEFAULT_FOR_FIELD',
bulwark       |   errno: 1364,
bulwark       |   sqlMessage: "Field 'fieldName' doesn't have a default value",

cxzero avatar Jun 09 '21 14:06 cxzero

For what it's worth, this issue only exists on the Docker build. I tried on a local install and it is working:

query: INSERT INTO file(id, fieldName, originalname, encoding, mimetype, buffer, size, vulnerabilityId) VALUES (DEFAULT, DEFAULT, ?, ?, ?, ?, ?, ?) -- PARAMETERS: ["test.png","7bit","image/png",{"type":"Buffer","data":[]

waterweasel4 avatar Jun 24 '21 12:06 waterweasel4