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

[SRI] Clarification regarding "Parse metadata" algorithm #531

Open
hrj opened this issue Jun 24, 2017 · 2 comments
Open

[SRI] Clarification regarding "Parse metadata" algorithm #531

hrj opened this issue Jun 24, 2017 · 2 comments

Comments

@hrj
Copy link

hrj commented Jun 24, 2017

I am confused by the wording in section 3.3.3. To quote the algorithm:

  1. Let result be the empty set.
  2. Let empty be equal to true.
  3. For each token returned by splitting metadata on spaces:
    1. Set empty to false.
    2. If token is not a valid metadata, skip the remaining steps, and proceed to the next token.
    3. Parse token per the grammar in integrity metadata.
    4. Let algorithm be the alg component of token.
    5. If algorithm is a hash function recognized by the user agent, add the parsed token to result.
  4. Return no metadata if empty is true, otherwise return result.

Question:

What is the definition of "valid metadata" mentioned in step 3 ii? Is it just syntactical correctness as per the ABNF grammar or something more? I ask because the parsing step (3 iii) is mentioned after the check for "valid metadata" which seems to imply that there is more to it than just syntax. But I can't find any other criteria for metadata correctness.

Thanks in advance!

@hrj
Copy link
Author

hrj commented Jun 24, 2017

A related question:

If a token parses correctly per the grammar, but doesn't decode correctly as base64 (for example due to wrong padding) is that considered invalid metadata?

@hrj
Copy link
Author

hrj commented Jun 24, 2017

If a token parses correctly per the grammar, but doesn't decode correctly as base64 (for example due to wrong padding) is that considered invalid metadata?

Oops, I just realized that base64 decoding isn't really required. If the the encoded strings don't match then the match fails as per section 3.3.1 and so the case of badly encoded base64 string is adequately covered.

However, this brings us back to the original question: what are the criteria for validity of metadata?

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

1 participant