OP, please pass my condolences to your friend.
You won't want to pass all this info to your friend, but my experience has shown me that a manipulative person will continue to manipulate so I'm glad that she has you there to support her.
I've said upthread that my DH left his ex after he found out she'd spent the night with her younger Affair Partner.
She convinced the kids that their friendship had eventually blossomed into love. Easy for her to do - they weren't at home when the "friend" was visiting. Yes, I got my husband's side of the story, but others then corroborated this.
By the time the AP died (rather suddenly), the kids were into their 40s. Naturally, the kids attended to support their mother. They sat down the front of the crematorium chapel with her and the AP's siblings. Mutual friends who attended told my husband this. What my husband didn't expect was that the friends queried why he hadn't attended that funeral. (By that point, the ex was behaving in a civilised manner with my husband - less so with me.)
He told me that his baffled response was "I hated the man!"
The next partner (acquired about a year after the death of the AP) was a widower who was also a friend of my husband's. Thanks to him, the relationships all round became less strained, though the ex was still adept at throwing barbs in my direction when no one else could hear.
When the widower died, he and the ex had been living together for a few years and I genuinely felt sorry for her - to the extent of offering to drive her to and from hospital when she had an outpatient op. (To my knowledge, the kids hadn't offered.) I recall feeling a bit uneasy when I discovered that she'd put my name down as her next of kin at the hospital.
My husband and I attended the widower's funeral. DH was ill by then, so I had to do the driving.
To our surprise, the ex and the kids sat halfway back through the congregation. The DIL told me that the ex had been treated shamefully. The widower's children and grandchildren had "refused" to have her named as the widower's "partner" in the funeral notice, only agreeing to "companion". So upset was the funeral director, that he'd unilaterally changed it to "loving companion". [Something didn't add up about that, I later realised - it was the ex who'd dealt with the funeral director. The widower had known that he was dying and had organised and prepaid his own funeral. However, according to the ex, it was she who had signed off the arrangements.] We were given to understand that the ex had been denied a place at the front of the funeral chapel.
After the funeral, one of the widower's daughters came up to me: "I don't know what to do with that woman - we offered her a place up the front, but she wouldn't take it!" She was about to say more, but just then the ex and the kids came up to us.
Less than a year later, the ex had acquired another friend. Immediately prior to my husband's funeral, I was being told that the ex was "devastated". A handful of days after the funeral, the kids were referring to the new friend as their mother's "partner".
I think that what I'm trying to say is that it's very easy for people to believe the wicked stepmother trope but - believe it or not - there are some wicked mothers out there too. They might well be women who wouldn't think of harming their children, but they'll think nothing of riding roughshod over anyone else to get their own way and promulgate their own narrative.
I don't want to go on and on about my experience, but - to sum up - the OP's friend is stuck between a rock and a hard place. She'll have to allow the ex to attend the funeral to keep the peace, but I hope that the OP will have a group of friends ready to head off trouble at the pass.
I found out after my husband's funeral that my cousins were ready to do the needful for me if there was trouble. My husband's nephew was also there and ready to help. Fortunately, they didn't have to step in.