Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oras push/attach should not allow colon in media type only on Windows #697

Closed
qweeah opened this issue Nov 21, 2022 · 0 comments · Fixed by #698
Closed

oras push/attach should not allow colon in media type only on Windows #697

qweeah opened this issue Nov 21, 2022 · 0 comments · Fixed by #698
Assignees
Labels
bug Something isn't working
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Nov 21, 2022

Using oras 0.16.0, I can use below command to upload a layer with colon in the media type on Windows:

oras push localhost:5000/test:path .\KEYS:test:test:test

See layers.mediatype below, this command will generate a layer with test:test:test as an invalid media type

> oras manifest fetch localhost:5000/test:path --pretty
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "config": {
    "mediaType": "application/vnd.unknown.config.v1+json",
    "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
    "size": 2
  },
  "layers": [
    {
      "mediaType": "test:test:test",
      "digest": "sha256:b79b04d85ebb8b289bde13387a5c6f3d98448d5a51937e6f94239303ffc2add8",
      "size": 15020,
      "annotations": {
        "org.opencontainers.image.title": "KEYS"
      }
    }
  ]
}

According to rfc2045 , colon is a special character and should not be in the media type. So the push command should show an error same to linux/darwin build:

> oras push localhost:5000/test:path .\KEYS:test:test:test
Error: failed to stat .KEYS:test:test: stat .KEYS:test:test: no such file or directory
@qweeah qweeah added the bug Something isn't working label Nov 21, 2022
@qweeah qweeah added this to the v0.16.1 milestone Nov 21, 2022
@qweeah qweeah changed the title oras push/attach allows colon in media type only on Windows oras push/attach should not allow colon in media type only on Windows Nov 21, 2022
@qweeah qweeah self-assigned this Nov 24, 2022
shizhMSFT pushed a commit that referenced this issue Dec 23, 2022
Fixes #697 

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@FeynmanZhou FeynmanZhou modified the milestones: v0.16.1, v1.0.0-rc.1 Jan 3, 2023
TerryHowe pushed a commit to TerryHowe/oras that referenced this issue Feb 2, 2023
Fixes oras-project#697 

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants