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

Fix Invalid header line for Content-Disposition string - incomplete continuation #108

Merged
merged 8 commits into from
Dec 31, 2020

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Aug 19, 2020

Q A
Bugfix yes
Critical yes

Description

https://tools.ietf.org/html/rfc2231 allows the sequence (internally $count) being missing:

        Content-Type: application/x-stuff;
         title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A

However ContentDisposition expected it to be number, and failed to cast empty string to numeric index. This resulted in throwing InvalidArgumentException(code: 0): Invalid header line for Content-Disposition string - incomplete continuation

Additionally, seems similar logic is needed ion ContentType class, but it's partly duplicated, ContentDisposition has more logic, and the exception is presented only in ContentDisposition class.

@glensc glensc marked this pull request as draft August 19, 2020 10:09
@glensc glensc force-pushed the header-wrapping branch 5 times, most recently from 9e1c00d to a5b5d62 Compare August 20, 2020 08:55
@glensc
Copy link
Contributor Author

glensc commented Aug 20, 2020

WDYT of having @codingStandardsIgnoreStart equivalent enabled for all tests? or set the line lenght limit to 512 or something biggger than 120, that 120 quota is very easy to reach:

➔ grep -r @codingStandardsIgnoreStart test/|wc -l
19

@glensc glensc marked this pull request as ready for review August 20, 2020 08:57
@glensc
Copy link
Contributor Author

glensc commented Aug 20, 2020

I don't know how to fight coverage, it says coverage increased, but still making status check failed

COVERAGE INCREASED (+0.09%) TO 62.259%

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
@glensc
Copy link
Contributor Author

glensc commented Aug 21, 2020

@weierophinney how to indicate it's ready for merge from the developer? I removed draft status, but seems can't request a review as that probably requires being project member.

@froschdesign
Copy link
Member

@glensc

but seems can't request a review as that probably requires being project member.

Which is correct:

Note: Pull request authors can't request reviews unless they are either a repository owner or collaborator with write access to the repository.

https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review

(But there is a bug here on GitHub so sometimes you can add a reviewer without special permissions.)

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
@glensc
Copy link
Contributor Author

glensc commented Aug 21, 2020

Updated, DCO & Travis pass.

@glensc
Copy link
Contributor Author

glensc commented Aug 24, 2020

ping!

@glensc
Copy link
Contributor Author

glensc commented Aug 31, 2020

another ping!

I'd like this to be in the next patch release. it's critical for us, and keeping production patched (hot fixed) is not very sustainable solution.

and maintaining a fork again its something I'd really like to avoid!

@glensc
Copy link
Contributor Author

glensc commented Sep 17, 2020

@weierophinney @froschdesign @samsonasik ping

https://outlook.office.com/mail/inbox seems to create such mails, so it's pretty common and wild.

@glensc
Copy link
Contributor Author

glensc commented Sep 18, 2020

and apparently Apple Mail as well: #111

@glensc glensc changed the title Fix InvalidArgumentException for optional empty count for rfc2231 parameter wrapping Fix Invalid header line for Content-Disposition string - incomplete continuation Sep 18, 2020
@glensc glensc closed this Oct 4, 2020
@glensc glensc reopened this Oct 4, 2020
@glensc
Copy link
Contributor Author

glensc commented Oct 4, 2020

@boesing seeing you active in this project (#113), can you do something to get this PR (#108) moving? waiting for the fix to be released for almost 50 days is depressive...

Chunk from PR#111 by Cédric Anne <cedric.anne@gmail.com>

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
@boesing
Copy link
Member

boesing commented Oct 4, 2020

@glensc I've created issues in every package today. ;-)

TBH, I am not that familiar with all that mail standards, e.g.
Furthermore, we voted to mark this package as security-only as (you can also see) we do not focus on this package anymore.

Laminas has a huge amount of packages (including all mezzio and laminas-api-tools) while we are just a bunch of people to maintain all these packages (most of us are volunteering tho).

I'd like to have another one have a look on this and then we probably get to merge this. Thanks for your patience and sorry that it might take some time to get things merged (as we are focussing on other packages currently).

@boesing
Copy link
Member

boesing commented Oct 4, 2020

From my perspective, this PR is fine. However, as I stated that I don't know much about all this stuff, I try to get someone to review this aswell.

Copy link
Contributor

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

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

I had the same problem and applying this fix solves it.

@glensc
Copy link
Contributor Author

glensc commented Nov 13, 2020

Can this be merged and released, please?

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

Sorry that it went under the radar 😱

@Ocramius Ocramius added this to the 2.12.5 milestone Dec 31, 2020
@Ocramius Ocramius added the Bug Something isn't working label Dec 31, 2020
@Ocramius Ocramius self-assigned this Dec 31, 2020
@Ocramius Ocramius merged commit fdea3c4 into laminas:2.12.x Dec 31, 2020
@Ocramius
Copy link
Member

Thanks @glensc - going out for release right now

@glensc glensc deleted the header-wrapping branch December 31, 2020 11:41
@glensc
Copy link
Contributor Author

glensc commented Dec 31, 2020

It took a while, but at least still fixed in the same year :)

throw new Exception\InvalidArgumentException(sprintf(
"Invalid header line for Content-Disposition string".
" - count expected to be numeric, got %s with value %s",
$type,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the $type is always string|null as explode and list can't return anything else.

artemii-karkusha pushed a commit to artemii-karkusha/laminas-mail that referenced this pull request May 24, 2023
Fix Invalid header line for Content-Disposition string - incomplete continuation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants