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

yaml reader does not consider quoted strings #39

Open
jwrosewell opened this issue Apr 4, 2024 · 1 comment
Open

yaml reader does not consider quoted strings #39

jwrosewell opened this issue Apr 4, 2024 · 1 comment
Assignees
Labels
type: bug Something isn't working

Comments

@jwrosewell
Copy link
Contributor

The yaml file reader does not remove quotes from strings. This results in invalid evidence being provided when used in tests and examples impacting the results.

The reader can also miss identify the end of a document and return fewer evidence pairs than expected. This also impacts the results of examples and tests that use the feature.

@Jamesr51d
Copy link
Contributor

Jamesr51d commented Apr 10, 2024

Background

51Degrees uses the YAMLDotNet YAML serializer when generating a test evidence file. Below are some transformations the serializer makes during serialization:

‘hello world“’hello world” (wraps in double quotes)

hello’ worldhello’ world (leaves as plain)

hello world’hello world’ (leaves as plain)

‘hello world“ ‘hello world” (wraps in double quotes)

“hello world”‘”hello world”’ (wraps in single quotes)

Notice the double quotes are used to wrap the string only when the single quote is the first non-whitespace character in the string.
51Degrees receives, in comparatively low volume, unique HTTP Headers that present in this format. The merge above deals with wrapping single quotes but, after further testing, the YAML Parser did not deal with the scenario where the string is wrapped in double quotes. This is due to the nature of Client Hint headers' format being wrapped in double quotes and those double quotes should not be stripped out.

Objective

When the YAML parser is processing evidence headers, it should account for the scenario where a useragent's first non -whitespace character is a single quote and has then been wrapped in double quotes by a YAML serializer.
f.e “’hello world”

Tests

  1. Test that a useragent wrapped in double quotes has those double quotes properly stripped out.
  2. Test that client hint evidence is left untouched and treated as plain(double quotes not stripped).
  3. Test that single quote positions other than as the first non-whitespace character are not affected.

Documentation

  1. Document the feature as part of the spec
  2. Document the feature as part of the API readme
  3. Properly add comments in the implementation.
  4. Documentation added to the website.

@Tracy51D Tracy51D added the type: bug Something isn't working label Apr 12, 2024
@justadreamer justadreamer self-assigned this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants