Skip to content

NEXUS-38651 - Missing sha256 and sha512 checksums when uploading to raw repository with curl #221

Description

@matejsp
  • What problem are you trying to solve?
    There is difference if you upload a file via nexus UI or via curl. The difference is in missing sha256 and sha512 hashes.
    I would like to have sha256 and sha512 automatically generated.
for f in * **/* ; do
    if [[ -f "$f" ]]; then
        echo "$f uploading to ${NEXUS_REPOSITORY_URL}/${HOSTED_REPOSITORY}/${PACKAGE_NAME}/${PACKAGE_VERSION}/${f}"
        curl -u ${NEXUS_USERNAME}:${NEXUS_PASSWORD} --upload-file ./${f} ${NEXUS_REPOSITORY_URL}/${HOSTED_REPOSITORY}/${PACKAGE_NAME}/${PACKAGE_VERSION}/${f}
    fi
done

Via CURL:
image

Via UI:
image

  • Do you have a workaround you are using at present?
    No.

  • What feature or behavior is this required for?
    In our CI we pin sha256 checksum so we know that the file was not altered on nexus.

  • How could we solve this issue? (Not knowing is okay!)

One way is to always automatically calculate Sha256 and Sha512.

Alternative is how Artifactory does this (https://jfrog.com/help/r/jfrog-rest-apis/deploy-artifact-by-checksum):

for file in $(find a_folder -type f)
do
    ARTIFACT_MD5_CHECKSUM=$(md5sum $file | awk '{print $1}')
    ARTIFACT_SHA1_CHECKSUM=$(shasum -a 1 $file | awk '{ print $1 }')
    ARTIFACT_SHA256_CHECKSUM=$(shasum -a 256 $file | awk '{ print $1 }')

    echo curl --upload-file $file \
            --header "X-Checksum-MD5:${ARTIFACT_MD5_CHECKSUM}" \
            --header "X-Checksum-Sha1:${ARTIFACT_SHA1_CHECKSUM}" \
            --header "X-Checksum-Sha256:${ARTIFACT_SHA256_CHECKSUM}" \
            -u "admin:${APIKEY}" \
            -v http://URL/$file
done
  • Tell us about your Nexus Repository deployment: what version, operating system, and database are you using?
    Sonatype Nexus Repository OSS 3.52.0-01

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions