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

Header "typ" syntax check #211

Open
sschulz-t opened this issue Jan 24, 2025 · 3 comments
Open

Header "typ" syntax check #211

sschulz-t opened this issue Jan 24, 2025 · 3 comments
Assignees

Comments

@sschulz-t
Copy link

I was wondering if the check for HeaderLabelType might be to strict.

go-cose/headers.go

Lines 514 to 517 in 92fbe95

// We don't check the precise definition though (RFC 6838 Section 4.2).
if strings.Count(v, "/") != 1 {
return errors.New("header parameter: type: require text of form type/subtype")
}

This line enforces having a / syntax. However I can not figure out if this is really required.

RFC9596 (https://www.rfc-editor.org/rfc/rfc9596) says it has the ContentType syntax, but refers to the names in https://www.iana.org/assignments/media-types which do not have that format.

My use case is implementing statuslists which requires the type label to be "statuslist+cwt"
https://datatracker.ietf.org/doc/html/draft-ietf-oauth-status-list-06#name-status-list-in-json-format

@shizhMSFT
Copy link
Contributor

RFC 9596 Section 2 defines typ is either an uint CoAP Content-Format or a string content type value.

RFC 6838 Section 4.2 states that

All registered media types MUST be assigned top-level type and subtype names.

In other words, a string typ must be <type-name>/<subtype-name>. That is, a / is required.

The value statuslist+cwt does not meet name requirement and thus cannot be registered, and thus is not a valid value of typ as defined by RFC 9596.

@shizhMSFT
Copy link
Contributor

Further reference can be found for the definition of the media type type "/" subtype *(";" parameter):

@sschulz-t
Copy link
Author

Thanks for your detailed reply! You were right. I forwarded the feedback and the statuslist draft was updated to use application/statuslist+cwt 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants