The caster knows who to blame
And their anger at someone for damaging them in the moment, and their mental leap to the conclusion of who it was, is what fuels the magic and unlocks the capability to cast Hellish Rebuke. They have to believe their own thought process for the spell to work.
This is a possible narrative interpretation, not implied by the rules, but I think it gives us a framework for deciding which creature(s) are valid targets for the spell at the moment of any given damage source. (And I think it should work well in general, as long as players are ok with limits the DM sets on what their character could reasonable believe and react to in the moment.)
Slightly indirect ways to damage someone, like holding them in fire, are just as threatening and painful as attacking with weapons, and will provoke the same response. (The fight-or-flight response that triggers your ability to cast Hellish Rebuke.)
First of all, the caster has to know who damaged them in order to perform the somatic component; they don't just cast the spell and have the magic decide who's to blame. (Even if using subtle spell, you still need to have a target in mind that you can see.)
You point your finger, and the creature that damaged you is momentarily surrounded by hellish flames.
This is a bit of a stretch in how you read the targeting rule:
Casting Time: 1 reaction, which you take in response to being damaged by a creature within 60 feet of you that you can see
"Being damaged by a creature" most obviously reads as an absolute statement about fact, not belief: something the DM knows is true. But if we read it from the caster's perspective, they don't have any external oracle of facts. At best they have in-character belief about who damaged them, which might or might not be a true belief.
Philosophers have long debated what knowledge is; one of the better definitions is "a justified true belief". I highlight the justified part because we want to prevent the caster from inventing "beliefs" that they can't really justify and reacting against someone they don't like when they stub their own toe, without having a justification for jumping to the conclusion it was Bob who left that anvil on the floor.
The "true" part is what I'm leaving out. In the moment of reacting to damage, the caster must choose a target without benefit of any external decider of truth. Casting based on a "justified belief" seems reasonable to me.
If we set our standard of justification high enough, that would require direct evidence like seeing the creature acting to cause you damage, not just assuming they left a trap.
So yes, you can Hellish Rebuke someone holding you in fire. Just like you could Hellish Rebuke someone who slams you into a wall or into the floor.
The other interpretation is that you have to pick a target, but the magic decides whether your belief is a true belief; if you pick wrong, the spell would fail due to invalid target. I'm suggesting that if you have a valid justification for belief that they caused you damage, the spell just works. (But some parts of this answer could work even if the magic is checking for "truth" independently.)
If you do want the magic to verify truth, it's a warlock spell, so you might argue that the patron can do the checking. But Tieflings also get it as a racial, and Oathbreaker paladins get it. Bards can also get it via Magical Secrets. So it can be cast with no involvement from a patron. Possibly Asmodeus or the Nine Hells do the checking, if the rebuke literally comes from the fire of Hell? The Nine Hells are a place of Law, so it's appropriate. It's only Hellish, though.
Corner cases created by this interpretation:
Multiple creatures conspired to damage you: you can choose which one to cast at, as long as they all meet a sufficient blame threshold. e.g. multiple people grappling you in fire.
You can only react once to a trigger, so you have to pick. But you do indeed have multiple valid options of who to target.
You're damaged by a trap you thought was set by someone, but it was actually set by someone else. (e.g. you're walking along and get ambushed by 1 creature. You rush toward or away from the ambusher, and run into a fire trap). So you can potentially be tricked into rebuking the "wrong" person.
I think in this case, you haven't met the threshold of justification for your belief about who damaged you, so no valid target. Unless for some reason you think they cast a spell in the moment that caused damage, not realizing there was a trap at all.
If someone pushed you into a trap, that would be different. It gets tricky again with a corner case like them startling you into falling.
Insane characters who believe false things, or extremely petty or vindictive over minor slights. (Justified belief, but only in their own mind). Probably unlikely to come up; we're talking about short term beliefs about immediate events.
Illusions / hallucinating characters (e.g. from phantasmal force) who see evidence they don't realize is false: This is another tricky case. If a Phantasmal Force illusion of a lightning bolt coming from a creature fools you, you might well cast Hellish Rebuke on the real creature. (The illusion was only of a spell effect, not an illusory creature.) If that's a city guard or worse a palace guard, whoever cast Phantasmal Force on you just got you in big trouble.
I'm inclined to say that this should be allowed. A creature of sound mind could get angry and retaliate in response to damage, potentially doing damage to a creature that you weren't already fighting if you're that trigger-happy with Hellish Rebuke during what seems to be an ambush.
If you can get a creature to believe someone else cast a lightning bolt at them, you've probably started a fight whether Hellish Rebuke is involved or not. Creatures aren't going to assume that their allies or most other creatures they know just attacked them out of nowhere. So I don't expect it to create exploits or world-building problems. And it's certainly interesting story-wise.
Magic could check for truth if you want it to. But it's interesting if it doesn't. The reasoning about someone damaging you "in the moment" in a way that makes the rebuker mad actually works whether or not the magic verifies truth, and in hindsight that's the actually important part of this answer as far as deciding what makes a valid target.