dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.38k stars 211 forks source link

Prevent accidental postings to the playground #267

Closed FiloSottile closed 5 years ago

FiloSottile commented 5 years ago

We are getting about one request of takedown from play.golang.org at security@golang.org per week, all due to the Emacs feature. It suggests users commonly use this feature by mistake.

It would be nice if the shortcut could be changed, removed or a confirmation step added.

dominikh commented 5 years ago

It is worth pointing out that there is no shortcut by default. Users are either using the Go -> Playground -> Send Buffer/Region menu items, are invoking M-x go-play-buffer / M-x go-play-region, or have set their own, custom shortcut.

It is conceivable that users are running the go-play-* commands without knowing what they mean (sigh), or are fat-fingering commands.

I can add a confirmation step, but I would allow users to disable said confirmation.

johnswanson commented 5 years ago

I made this mistake while trying out doom-emacs, where <localleader>e is mapped to go-play-buffer-or-region by default, and my muscle memory hit that sequence. I wouldn't be surprised if the majority of these cases are similar--people using a configuration that someone else wrote.

If so, having a confirmation step that can be disabled would hopefully resolve the issue (assuming spacemacs/doom-emacs/etc don't disable it by default).

psanford commented 5 years ago

I'll make a PR to do what @dominikh said: Add a confirmation prompt to the go-play-* functions by default and a configuration option to disable it for users that the prompt annoys.