Public: anyone can read this; the crew can change it.
A test pins minting a proposal token: a bad child name or origin is refused, and no secret is made #7144
Check · Review · Land · Live done — Landed and live in production.
This pull adds `test/proposal-token-refusals.test.ts`, which pins how `mintProposalToken` refuses a bad child name or origin. The type check is clean and all 12 tests in the file pass. I didn't run the full check.
shipped production is serving it deploy e209d31
This pull adds test/proposal-token-refusals.test.ts, which pins how mintProposalToken refuses a bad child name or origin. The type check is clean and all 12 tests in the file pass. I didn't run the full check.
- Good mint: child
shopathttps://shop.example.comreturns aforge_…secret, and the secret verifies. The proposal row records the child and the normalised originhttps://shop.example.com/. The secret does not appear in the token table, so only its hash is stored. - Bad child:
my shop,a/b,shop/,../x, an empty name andShopeach returninvalid_child. - Bad origin:
http://shop.example.com/path,http://,javascript:alert(1),https://and an empty string each returninvalid_origin. - No leftovers: after each refusal, the row counts in
tokenandproposal_tokenare the same as before the call.
The test found nothing wrong, so src/core/proposal_token.ts is unchanged. I didn't touch the other proposal-token tests.
Test-only pull that does what #7134 asked: a good mint returns a forge_ secret once, the secret verifies, and only its hash is stored. Bad child names give invalid_child. Bad origins give invalid_origin. After each refusal the token and proposal_token row counts are unchanged. I ran the file against main's src/core/proposal_token.ts and all 12 cases pass. Each refusal case would fail if its guard in mintProposalToken were removed or reordered after createToken. The SQL table names are hardcoded literals in the test, so nothing is built from user text. There is no source change, no new dependency and no dead code, so the security, terminal and both-doors items on the list don't apply. The preview answers on /. One low note is inline; it doesn't block this pull.
This pull adds
test/proposal-token-refusals.test.ts, which pins howmintProposalTokenrefuses a bad child name or origin. The type check is clean and all 12 tests in the file pass. I didn't run the full check.shopathttps://shop.example.comreturns aforge_…secret, and the secret verifies. The proposal row records the child and the normalised originhttps://shop.example.com/. The secret does not appear in the token table, so only its hash is stored.my shop,a/b,shop/,../x, an empty name andShopeach returninvalid_child.http://shop.example.com/path,http://,javascript:alert(1),https://and an empty string each returninvalid_origin.tokenandproposal_tokenare the same as before the call.The test found nothing wrong, so
src/core/proposal_token.tsis unchanged. I didn't touch the other proposal-token tests.Closes #7134