sigstore / rekor

Software Supply Chain Transparency Log
https://sigstore.dev
Apache License 2.0
904 stars 164 forks source link

Error while using file as artifact with `rekor-cli upload`. #2138

Open rajeev-0 opened 6 months ago

rajeev-0 commented 6 months ago

Description I want to use rekor-cli version 1.3.6 for uploading artifact and signature using below command. $ rekor-cli upload --artifact payload.json --signature payload.json.sig --public-key pubkey.pem --pki-format x509 But I am getting invalid argument error. invalid argument "payload.json" for "--artifact" flag: URL must be for http or https scheme.

In help section it states it could be a file. --artifact fileOrURL path or URL to artifact file

Version rekor-cli: Rekor CLI

GitVersion: v1.3.6 GitCommit: a6788566cd62facb0fb0450e9d2c2867f551e37c GitTreeState: clean BuildDate: 2024-04-02T04:16:36Z GoVersion: go1.21.8 Compiler: gc Platform: linux/amd64

bobcallaway commented 6 months ago

Can you try prepending ./ to payload.json as a workaround?

bobcallaway commented 6 months ago

also, that error message is (incorrectly) printed if the argument to --artifact doesn't exist, so can you please also verify the filename?

rajeev-0 commented 6 months ago

prepending ./ also doesn't work, Just got added to error message. $ rekor-cli upload --artifact ./payload.json --signature payload.json.sig --public-key pubkey.pem --pki-format x509 Error: invalid argument "./payload.json" for "--artifact" flag: './payload.json' is not a valid url

And I also confirmed that file payload.json exists. $ cat payload.json {"critical":{"identity":{"docker-reference":"cr.example.com/ranjan.rajeev/test-container/hello-world"},"image":{"docker-manifest-digest":"sha256:8d3b740ac4f8c8d84d71b67e18127cd380d6e224956f2daa5d99f28a9fad155a"},"type":"cosign container image signature"},"optional":null}

bobcallaway commented 5 months ago

prepending ./ also doesn't work, Just got added to error message. $ rekor-cli upload --artifact ./payload.json --signature payload.json.sig --public-key pubkey.pem --pki-format x509 Error: invalid argument "./payload.json" for "--artifact" flag: './payload.json' is not a valid url

And I also confirmed that file payload.json exists. $ cat payload.json {"critical":{"identity":{"docker-reference":"cr.example.com/ranjan.rajeev/test-container/hello-world"},"image":{"docker-manifest-digest":"sha256:8d3b740ac4f8c8d84d71b67e18127cd380d6e224956f2daa5d99f28a9fad155a"},"type":"cosign container image signature"},"optional":null}

I'm only able to recreate this error if the file doesn't exist in the current working directory. Can you confirm that is the case for you?