Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# semgrep default ignores (a custom .semgrepignore replaces them)
.git/
:include .gitignore

# role "All" read access on events is intentional: public event info
buzz/events/doctype/buzz_event/buzz_event.json
6 changes: 3 additions & 3 deletions buzz/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def process_booking(
booking.append("attendees", attendee_row)

booking.insert(ignore_permissions=True)
frappe.db.commit()
frappe.db.commit() # nosemgrep: frappe-semgrep-rules.rules.frappe-manual-commit

if booking.total_amount == 0:
booking.flags.ignore_permissions = True
Expand Down Expand Up @@ -1059,13 +1059,13 @@ def create_cancellation_request(booking_id: str, ticket_ids: list | None = None)
frappe.throw(frappe._("Not permitted to request cancellation for this booking."))

if not is_cancellation_request_allowed(booking_doc.event):
frappe.throw("Cancellation requests are no longer allowed for this event.")
frappe.throw(_("Cancellation requests are no longer allowed for this event."))

existing_request = frappe.db.exists(
"Ticket Cancellation Request", {"booking": booking_id, "docstatus": 0}
)
if existing_request:
frappe.throw("A cancellation request already exists for this booking.")
frappe.throw(_("A cancellation request already exists for this booking."))

all_tickets = frappe.db.get_all("Event Ticket", filters={"booking": booking_id}, fields=["name"])
cancel_full_booking = not ticket_ids or len(ticket_ids) == len(all_tickets)
Expand Down
3 changes: 2 additions & 1 deletion buzz/events/doctype/event_talk/event_talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# For license information, please see license.txt

import frappe
from frappe import _
from frappe.model.document import Document


Expand All @@ -27,4 +28,4 @@ class EventTalk(Document):

def validate(self):
if frappe.db.exists("Event Talk", {"proposal": self.proposal, "name": ["!=", self.name]}):
frappe.throw("Talk already created for this proposal!")
frappe.throw(_("Talk already created for this proposal!"))
7 changes: 4 additions & 3 deletions buzz/payments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import frappe
from frappe import _
from payments.utils import get_payment_gateway_controller


Expand Down Expand Up @@ -33,7 +34,7 @@ def get_payment_link_for_booking(
if not payment_gateway:
gateways = get_payment_gateways_for_event(booking_doc.event)
if not gateways:
frappe.throw("No payment gateway configured for this event")
frappe.throw(_("No payment gateway configured for this event"))
payment_gateway = gateways[0]
return get_payment_link(
"Event Booking",
Expand All @@ -57,7 +58,7 @@ def get_payment_link_for_sponsorship(
if not payment_gateway:
gateways = get_payment_gateways_for_event(tier_doc.event)
if not gateways:
frappe.throw("No payment gateway configured for this event")
frappe.throw(_("No payment gateway configured for this event"))
payment_gateway = gateways[0]
event_title = frappe.get_cached_value("Buzz Event", tier_doc.event, "title")
frappe.db.set_value(
Expand Down Expand Up @@ -177,7 +178,7 @@ def mark_payment_as_received(reference_doctype: str, reference_docname: str):
},
)

frappe.db.commit()
frappe.db.commit() # nosemgrep: frappe-semgrep-rules.rules.frappe-manual-commit


# TODO: use it later!
Expand Down
1 change: 0 additions & 1 deletion buzz/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ def unpublish_ticket_types_after_last_date():
"is_published",
False,
)
frappe.db.commit()
1 change: 1 addition & 0 deletions buzz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ def generate_ics_file(event_doc, attendee_email: str):
"organizer_email": organizer_email,
}

# nosemgrep: frappe-semgrep-rules.rules.security.frappe-ssti
return frappe.render_template("templates/ics/ics.jinja2", context, is_path=True)
6 changes: 4 additions & 2 deletions buzz/www/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
# See license.txt

import frappe
from frappe import _
from frappe.utils import get_system_timezone

no_cache = 1


def get_context():
csrf_token = frappe.sessions.get_csrf_token()
frappe.db.commit()
frappe.db.commit() # nosemgrep: frappe-semgrep-rules.rules.frappe-manual-commit
context = frappe._dict()
context.boot = get_boot()
context.boot.csrf_token = csrf_token
return context


# nosemgrep: frappe-semgrep-rules.rules.security.guest-whitelisted-method
@frappe.whitelist(methods=["POST"], allow_guest=True)
def get_context_for_dev():
if not frappe.conf.developer_mode:
frappe.throw("This method is only meant for developer mode")
frappe.throw(_("This method is only meant for developer mode"))
return get_boot()


Expand Down
Loading