Skip to content

Commit 13f4f6c

Browse files
M7mdiskCopilotCopilot
authored
add honeypot to snap reports (#5589)
* add honeypot to snap reports * Add aria-hidden attribute to honeypot field for screen reader accessibility (#5590) * Initial plan * Add aria-hidden attribute to honeypot field for accessibility Co-authored-by: M7mdisk <43501040+M7mdisk@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: M7mdisk <43501040+M7mdisk@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * allow urls in comments * fix: remove inline styling --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3458caf commit 13f4f6c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

templates/store/snap-details/_report_snap_modal.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ <h5 class="p-notification__title">
5050

5151
<label for="report-snap-email">Your email (optional)</label>
5252
<input id="report-snap-email" type="email" name="email" placeholder="email@example.com" />
53+
<div class="u-off-screen">
54+
<label for="report-snap-confirm" aria-hidden="true">I agree</label>
55+
<input id="report-snap-confirm" type="checkbox" name="confirm" aria-hidden="true" />
56+
</div>
5357
<p>In submitting this form, I confirm that I have read and agree to <a href="https://ubuntu.com/legal/data-privacy/contact">Canonical’s Privacy Notice</a> and <a href="https://ubuntu.com/legal/data-privacy">Privacy Policy</a>.</p>
5458
<div class="u-align--right">
5559
<button type="button" class="js-modal-close u-no-margin--bottom">Cancel</button>

webapp/store/snap_details_views.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,10 @@ def report_snap():
561561

562562
fields = flask.request.form
563563

564+
# If the honeypot is activated (hidden field populated
565+
# silently reject to avoid spam
566+
if "confirm" in fields:
567+
return flask.jsonify({"ok": True}), 200
564568
payload = {
565569
"snap_name": fields.get("snap_name", ""),
566570
"reason": fields.get("reason", ""),

0 commit comments

Comments
 (0)