Laravel-Excel icon indicating copy to clipboard operation
Laravel-Excel copied to clipboard

Allow phpoffice/phpspreadsheet 2.0+ also

Open mwikberg-virta opened this issue 1 year ago • 22 comments

1️⃣ Why should it be added? What are the benefits of this change? Newer versions of phpoffice/phpspreadsheet (2.x) exist and someone might need to use those

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out. No.

3️⃣ Does it include tests, if possible? Some tests were modified as needed for different behavior on 1.x and 2.x

4️⃣ Any drawbacks? Possible breaking changes? None detected nor expected.

5️⃣ Mark the following tasks as done:

  • [X] Checked the codebase to ensure that your feature doesn't already exist.
  • [X] Take note of the contributing guidelines.
  • [X] Checked the pull requests to ensure that another person hasn't already submitted a fix.
  • [X] Added tests to ensure against regression.

6️⃣ Thanks for contributing! 🙌

mwikberg-virta avatar Jul 10 '24 07:07 mwikberg-virta

Yes, there are no major differences between 1.x and 2.x. I've been using this workaround in composer.json for months now:

"require": {
    "phpoffice/phpspreadsheet": "^2.1.0",
},
"provide": {
    "phpoffice/phpspreadsheet": "1.29"
},

Will test this pull request too, but so far it seems good!

saulens22 avatar Jul 31 '24 13:07 saulens22

I think I hit one compatibility issue:

Declaration of Maatwebsite\Excel\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, $value) must be compatible with PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, mixed $value): bool 

underdpt avatar Aug 06 '24 08:08 underdpt

Is there any update on this @patrickbrouwers?

JamesFreeman avatar Aug 27 '24 06:08 JamesFreeman

No update, as I mentioned in previous PR attempts and questions. This will be done in the 4.0 release which has no eta

patrickbrouwers avatar Aug 27 '24 06:08 patrickbrouwers

Understood, thanks for the update. :)

JamesFreeman avatar Aug 27 '24 07:08 JamesFreeman

https://github.com/advisories/GHSA-ghg6-32f9-2jp7 https://github.com/advisories/GHSA-wgmf-q9vr-vww6

emargareten avatar Aug 29 '24 18:08 emargareten

I have same compatibility issue:

Declaration of Maatwebsite\Excel\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, $value) must be compatible with PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::bindValue(PhpOffice\PhpSpreadsheet\Cell\Cell $cell, mixed $value): bool 

roc26002w avatar Aug 30 '24 03:08 roc26002w

No update, as I mentioned in previous PR attempts and questions. This will be done in the 4.0 release which has no eta

@patrickbrouwers given that there are two reported vulnerabilities with the version being used currently, is it possible to just put in a patch for this package while the rest wait for v4?

The cross-site scripting vulnerability is considered moderate (5.4/10) but the bug where bypassing the filter allows an XXE-attack is classified with a high severity (8.8/10) and is only patched in v2.2.1 and above...

Is there some work required to get this fix in? we can help out with that.

geneowak avatar Aug 30 '24 08:08 geneowak

We'll first see if the backport https://github.com/PHPOffice/PhpSpreadsheet/pull/4154 gets merged

patrickbrouwers avatar Aug 30 '24 08:08 patrickbrouwers

Solution if your pipelines depend on this to be resolved. It seems it will not be done so soon. So just use proper composer.config.audit.ignore like this in your composer.json:

    "config": {
        "audit": {
            "ignore": {
                "CVE-2024-45048": "https://github.com/SpartnerNL/Laravel-Excel/pull/4164",
                "CVE-2024-45046": "https://github.com/SpartnerNL/Laravel-Excel/pull/4164"
            }
        }
    },

prialgauskaslt avatar Aug 30 '24 09:08 prialgauskaslt

Do we have any progress on this?

kieranbarlow avatar Sep 01 '24 18:09 kieranbarlow

Kinda crazy this is ongoing IMO. I had a pretty important app. using this package with two exports. Decided to migrate them to a simple .CSV file. Unfortunately I couldn't get the above composer.json solutions working.

ultrono avatar Sep 01 '24 19:09 ultrono

Kinda crazy this is ongoing IMO. I had a pretty important app. using this package with two exports. Decided to migrate them to a simple .CSV file. Unfortunately I couldn't get the above composer.json solutions working.

Our CI/CD was stuck on composer audit —locked as it failed due to CVE. The solution I provided should be good for most checks during pipelines. Maybe if you’d share how your release/deployment is breaking due to active CVE, we can find a solution for that too. Sorry that I can’t provide more help without a context.

prialgauskaslt avatar Sep 02 '24 00:09 prialgauskaslt

Ignoring the CVEs does not work for me because I have roave/security-advisories in require-dev (it will cause conflicts), I ended up using OP's forked repo temporarily with

"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/mwikberg-virta/Laravel-Excel.git"
        }
    ]

So far it is working fine, will only switch back to main repo after the CVEs fixed (hope that we do not need to wait for v4 :)

ykchan97 avatar Sep 02 '24 03:09 ykchan97

https://github.com/PHPOffice/PhpSpreadsheet/pull/4154#issuecomment-2325731356

nuernbergerA avatar Sep 03 '24 06:09 nuernbergerA

PHPOffice/PhpSpreadsheet#4154 (comment)

Yeah I tried this before, it conflicts with roave/security-advisories unfortunately image

ykchan97 avatar Sep 03 '24 07:09 ykchan97

Because v2 contains breaking changes (https://github.com/PHPOffice/PhpSpreadsheet/blob/master/CHANGELOG.md#breaking-change) that I want to check. Just don't have the time for it right now. The security fix will be backported to v1, that means all people using it including people on older php versions (v2 is >8.1) will get the fix.

patrickbrouwers avatar Sep 03 '24 08:09 patrickbrouwers

Yeah I tried this before, it conflicts with roave/security-advisories unfortunately image

Same problem here. Would be nice when this can be handled prioritized.

quaddy avatar Sep 03 '24 15:09 quaddy

It's being handled by phpspreadsheet: https://github.com/PHPOffice/PhpSpreadsheet/pull/4154#issuecomment-2326727459 Please be patient, it's open source, nobody is paying PhpSpreadsheet to handle this with priority or even having to do the backport.

patrickbrouwers avatar Sep 03 '24 15:09 patrickbrouwers

PHPOffice/PhpSpreadsheet#4154 (comment)

Yeah I tried this before, it conflicts with roave/security-advisories unfortunately image

you need to disable/remove roave/security-advisories till its updated but at least you have a secure version installed

nuernbergerA avatar Sep 03 '24 18:09 nuernbergerA

Laravel Excel now requires 1.29.1 which has the security fix

patrickbrouwers avatar Sep 04 '24 07:09 patrickbrouwers

@patrickbrouwers Thank you!!!!

PanchoDP avatar Sep 04 '24 14:09 PanchoDP

This bug report has been automatically closed because it has not had recent activity. If this is still an active bug, please comment to reopen. Thank you for your contributions.

stale[bot] avatar Nov 09 '24 01:11 stale[bot]