trustification / trustify

Apache License 2.0
10 stars 19 forks source link

Enable upload of compressed documents #789

Closed JimFuller-RedHat closed 1 month ago

JimFuller-RedHat commented 1 month ago

For example, we would like to upload compressed SBOM openshift-4.13.json.xz via SBOM ux.

ctron commented 1 month ago

The upload through the UI happens the same way other clients use the API. Now, the question is: how does the backend figure out its a compressed payload?

One way to deal with this would be to sniff for some magic bytes, detecting a compressed data stream.

Another way would be to evaluate the Content-Encoding or Content-Type header. Which would mean that the UI would need to set either header (<- @carlosthe19916). I am actually not sure which header to use in this case, as its not about the encoding of the file being uploaded, but the file itself.

In case of an unsupported type, we should return 415 (Unsupported Media Type).

ctron commented 1 month ago

Or maybe go for a combination: if the Content-Encoding header is present use it. Otherwise fall back to magic detection?

ctron commented 1 month ago

Ok, Content-Encoding seems to be out of the picture, because it doesn't support bz2.

jcrossley3 commented 1 month ago

Not sure it's helpful, but we had this feature in v1

carlosthe19916 commented 1 month ago

From the UI point of view, I think it is more than just uploading a compressed file and detecting its format. There are other aspects we would need to considerer e.g.

We could add that feature on the backend side but I anticipate we will revisit the current UI Upload part of V1 (trustification)

ctron commented 1 month ago

Ok, Content-Encoding seems to be out of the picture, because it doesn't support bz2.

From the UI point of view, I think it is more than just uploading a compressed file and detecting its format. There are other aspects we would need to considerer e.g.

* What if the compressed file contains more than one file?

* What if only a subset of the files within the compressed file are accepted and the rest are rejected due to validation issues?

* Or do we create a constraint so only 1 file should be part of every compressed file? if more than one file is found, then we reject the whole upload?

We could add that feature on the backend side but I anticipate we will revisit the current UI Upload part of V1 (trustification)

This is only about compression. Not archives.

ctron commented 1 month ago

Not sure it's helpful, but we had this feature in v1

Yea, I think it would go in the same direction. Minus the Content-Encoding, as that doesn't seem like a good fit.

ctron commented 1 month ago

Closed by #799