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

Update references and clarify section 3.5 in the current version of the spec #112

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

baek9
Copy link
Contributor

@baek9 baek9 commented Jan 25, 2022

I am submitting a new pull request according to the comments(#84 (comment), #84 (comment)) from @annevk. It updates the CSP reference and modifies the 3.5 The integrity attribute to be clear in the current version of the spec where options are not defined.

Issue Number: #84


Preview | Diff

@annevk
Copy link
Member

annevk commented Jan 25, 2022

Do we need to define hash-with-options as conforming at all? We need to deal with ? in the processing model, but I don't see why it needs to be listed here, if this is only about conformance requirements for web developers.

@baek9
Copy link
Contributor Author

baek9 commented Jan 25, 2022

Do we need to define hash-with-options as conforming at all? We need to deal with ? in the processing model, but I don't see why it needs to be listed here, if this is only about conformance requirements for web developers.

The purpose is to rule out hash-with-options, but at the same time suggest that future versions of the spec may extend it. So, as you said, it might seem like a conformance requirement for web developers.

So, going further than suggested, you're saying that dealing with options in the new 3.3.2 Parsed metadata is enough, so items like hash-with-options could be removed, right?

Then, even if hash-with-options is deleted, I think it is necessary to add an additional explanation that some of the contents of 3.5 Integrity metadata may change in the future.

@annevk
Copy link
Member

annevk commented Jan 25, 2022

Yeah, exactly. @mozfreddyb does that seem reasonable to you?

@@ -451,24 +451,21 @@ spec: SHA2; urlPrefix: http://csrc.nist.gov/publications/fips/fips180-4/fips-180
valid metadata as described by the following ABNF grammar:

<pre dfn-type="grammar" link-type="grammar">
<dfn>integrity-metadata</dfn> = *<a>WSP</a> <a>hash-with-options</a> *(1*<a>WSP</a> <a>hash-with-options</a> ) *<a>WSP</a> / *<a>WSP</a>
Copy link
Contributor Author

@baek9 baek9 Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.2 Grammatical Concepts defines WSP with reference to 2.4.1 Common parser idioms. The link is broken and redirects to https://html.spec.whatwg.org. On the other hand, Terms defined by reference defines WSP and VCHAR with reference to RFC5234:ABNF.

Therefore, in 2.2 Grammatical Concepts, it seems that WSP should be modified to refer to RFC5234:ABNF as well as VCHAR.

@mozfreddyb
Copy link
Collaborator

Yeah, exactly. @mozfreddyb does that seem reasonable to you?

Yeah, it's probably fine if the Parse metadata discards them..


<a>WSP</a> (white space) characters are defined in <a href="http://www.w3.org/TR/html5/infrastructure.html#space-character">Section 2.4.1 Common parser idioms</a> of the HTML 5 specification as
<code>White_Space characters</code>. [[!HTML5]]
[[!ABNF]] defines <a>VCHAR</a> (printing characters) and <a>WSP</a> (white space).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the previous text makes no sense, but I wonder if it was meant to match https://infra.spec.whatwg.org/#ascii-whitespace? That would be LWSP / %x0C.

This also seems like a problem with the parser. It references https://infra.spec.whatwg.org/#strictly-split but doesn't define spaces. I suspect it meant to reference https://infra.spec.whatwg.org/#split-on-ascii-whitespace?

Are there tests for this?

Copy link
Contributor Author

@baek9 baek9 Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you said, ASCII whitespace seems to be equivalent to LWSP. And the implementation, Chromium, use ASCIISpace defined as follows.

inline bool IsASCIISpace(CharType c) {
  return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9));
}

In this situation, as you said, I think it would be better to refer to split-on-ascii-whitespace rather than strictly-split for the parser. And it seems fitting to use LWSP, which refers to ASCII whitespace, instead of WSP. The ABNF in Section 3.5 will also need to be modified accordingly. Does it make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Chrome's definition also counts U+000B as whitespace if I'm reading that correctly. That seems wrong.

And note that LWSP excludes U+000C (which is why I added that above).

I think we should use ASCII whitespace here and file a bug on Chrome for them including U+000B. And use LWSP / %x0C in ABNF.

Note: Since no `options` are not defined (see the
[[#integrity-metadata-description]]), the above ABNF syntax does not consider
them. If `options` are defined in a future version, the ABNF syntax should be
modified accordingly.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be ok this way? @annevk

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo nits, I think so.


<a>WSP</a> (white space) characters are defined in <a href="http://www.w3.org/TR/html5/infrastructure.html#space-character">Section 2.4.1 Common parser idioms</a> of the HTML 5 specification as
<code>White_Space characters</code>. [[!HTML5]]
[[!ABNF]] defines <a>VCHAR</a> (printing characters) and <a>WSP</a> (white space).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the previous text makes no sense, but I wonder if it was meant to match https://infra.spec.whatwg.org/#ascii-whitespace? That would be LWSP / %x0C.

This also seems like a problem with the parser. It references https://infra.spec.whatwg.org/#strictly-split but doesn't define spaces. I suspect it meant to reference https://infra.spec.whatwg.org/#split-on-ascii-whitespace?

Are there tests for this?

will define a more specific syntax for options, so it is defined here as broadly
as possible.

Note: Since no `options` are not defined (see the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note: Since no `options` are not defined (see the
Note: Since no `options` are defined (see the


Note: Since no `options` are not defined (see the
[[#integrity-metadata-description]]), the above ABNF syntax does not consider
them. If `options` are defined in a future version, the ABNF syntax should be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
them. If `options` are defined in a future version, the ABNF syntax should be
them. If `options` are defined in a future version, the ABNF syntax will be

Note: Since no `options` are not defined (see the
[[#integrity-metadata-description]]), the above ABNF syntax does not consider
them. If `options` are defined in a future version, the ABNF syntax should be
modified accordingly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo nits, I think so.

@domfarolino
Copy link
Member

@baek9 Just curious, do you still plan on working on this PR / #84 further?

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

Successfully merging this pull request may close these issues.

4 participants