Trashing attacks like that have an inherent problem of being either too weak or too strong in a way that doesn't balance out. This one will typically be on the weak side, going so far as to be beneficial to opponents. It's pretty much Bishop in that regard. But if the kingdom already has strong trashing, this not only forces opponents to trash a good card but also cause acts as a discard attack.
Note how the only trashing attacks in the game (Swindler, Saboteur, Rogue and Knights) all attack the deck rather than the hand, and they all have effects that make the attack stronger while preventing it from being too crazy. The first two give the other players a replacement card while the latter two have a max cost and small search space. Swindler hurts a lot when it trashes Copper and is only a small help when it hits Estate. The latter three all have minimum costs so that they don't help opponents trash junk.
Weapons Dealer
$4 Action-Reaction
Gain a card costing up to $4. Put it on the bottom of your deck.
--
When an attack affects you, you may reveal this from your hand and discard it. If you do, gain a copy of that attack.
(I think gaining to the bottom is a cute little gimmick, and makes it just good enough that you could conceivably buy it on some attack-less boards. I can't decide how strong the reaction is, but I feel like it would at least be interesting.)
Cards that rely on other type of cards being in the game but don't bring that type of card into the game (through pulling in a separate pile or being that type themselves) are something I don't think can work. I do like the "put on the bottom of your deck" thing, but as is this card is pretty similar to Armory. I'd take off the top part, replace it with an attack, and, if you want to, you could put that "bottom of your deck" onto the Reaction so that it'll read "If you do, gain a copy of that attack, putting it onto the bottom of your deck".
Wow. That last sentence had a lot of commas.
Sure they can work.
Most reactions fall into this category, and there's also Conspirator and Peddler which really need +action cards.
My criticism of Weapons Dealer is that the top is boring. I'm biased against Workshop variants in general, just from personal preference. The reaction could be interesting, but I'm not sure why it says "when an attack affects you" rather than the standard, "when another player plays an Attack card". With the current wording, it makes the reaction much weaker against discard attacks because the discard attack will affect you first before you can use the reaction, meaning you will end up with a 2 card hand (or 3 cards vs. Urchin).