sgx-jmp

created pr with sgx-jmp/ban-self-parent.1 on 2026-10-25T22:37:45Z · by 9e834e0d
cmds
checkout latest patchset:
ssh pr.pico.sh pull sgx-jmp:ban-self-parent | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull sgx-jmp:ban-self-parent [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh sgx-jmp:ban-self-parent
add comment to patch request:
ssh pr.pico.sh comment sgx-jmp:ban-self-parent "lgtm!"

Patchset sgx-jmp/ban-self-parent.1 on 2026-10-25T22:37:45Z · commit 8713f61

Make sure a customer cannot parent itself
Stephen Paul Weber 2026-10-25T22:36:49Z
Semantic diff summary
0 added, 0 modified, 0 signature changed, 0 removed across 0 analyzed files (2 files skipped: unsupported file type)
+1 -0 lib/customer_plan.rb #
......@@ -71,6 +71,7 @@ class CustomerPlan
7171
7272 def verify_parent!
7373 return unless parent_customer_id
74+ raise "Invalid parent account" if parent_customer_id == customer_id
7475
7576 result = DB.query(<<~SQL, [parent_customer_id])
7677 SELECT plan_name FROM customer_plans WHERE customer_id=$1
+10 -0 test/test_customer.rb #
......@@ -114,6 +114,16 @@ class CustomerTest < Minitest::Test
114114 end
115115 em :test_bill_plan_update
116116
117+ def test_save_plan_rejects_self_parent
118+ error = assert_raises(RuntimeError) do
119+ customer(
120+ plan_name: "test_usd",
121+ parent_customer_id: "test"
122+ ).save_plan!
123+ end
124+ assert_equal "Invalid parent account", error.message
125+ end
126+
117127 def test_stanza_to
118128 Customer::BLATHER.expect(
119129 :<<,
Back to top