Skip to content
New issue

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

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

Already on GitHub? # to your account

authres: parse() function can't get correct quoted-string value #32

Open
anhdowastaken opened this issue Jun 3, 2020 · 3 comments · May be fixed by #53
Open

authres: parse() function can't get correct quoted-string value #32

anhdowastaken opened this issue Jun 3, 2020 · 3 comments · May be fixed by #53

Comments

@anhdowastaken
Copy link

Arcoding to https://tools.ietf.org/html/rfc8601:

     reasonspec = "reason" [CFWS] "=" [CFWS] value
                ; a free-form comment on the reason the given result
                ; was returned
   The "value" is as defined in Section 5.1 of [MIME], with
   "quoted-string" updated as specified in [RFC6532].

For example:

var parseTests = []msgauthTest{
...
	{
		value: "example.com;" +
			"dkim=pass reason=\"good signature\" header.i=@mail-router.example.net;",
		identifier: "example.com",
		results: []Result{
			&DKIMResult{Value: ResultPass, Reason: "good signature", Identifier: "@mail-router.example.net"},
		},
	},
}

Instead of good signature, value of Reason is "good.

@emersion
Copy link
Owner

emersion commented Jun 3, 2020

Ah. This means the whole parsing logic will need to be reworked, since quoted-strings can contain ;.

parts := strings.Split(v, ";")

@emersion emersion added the bug label Jun 3, 2020
@anhdowastaken
Copy link
Author

Thanks for your confirmation.

Btw, I think this line instead:

parts := strings.Fields(s)

@emersion
Copy link
Owner

emersion commented Jun 4, 2020

Well, this one too indeed.

konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authenctication-Results header parser for full RFC
7601 compliance. Ignore any header comments in parenthesis. Allow escape
sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authenctication-Results header parser for full RFC
7601 compliance. Ignore any header comments in parenthesis. Allow escape
sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authenctication-Results header parser for full RFC
7601 compliance. Ignore any header comments in parenthesis. Allow escape
sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authenctication-Results header parser for full RFC
7601 compliance. Ignore any header comments in parenthesis. Allow escape
sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authentication-Results header parser for a complete RFC
7601 implementation. Ignore any header comments in parenthesis. Allow
escape sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
@konimarti konimarti linked a pull request Jun 3, 2022 that will close this issue
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authentication-Results header parser for a complete RFC
8601 implementation. Ignore any header comments in parenthesis. Allow
escape sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
konimarti added a commit to konimarti/go-msgauth that referenced this issue Jun 3, 2022
Rewrite of the Authentication-Results header parser for a complete RFC
8601 implementation. Ignore any header comments in parenthesis. Allow
escape sequences and semi-colons in comments and quoted strings as values.

Fixes: emersion#32
@emersion emersion changed the title Parse() function can't get correct quoted-string value authres: parse() function can't get correct quoted-string value Nov 20, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants