refactor(security-practices): port security article code samples to Tolk, adjust dangling Tact stdlib references#2134
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Warning Review limit reached
More reviews will be available in 58 minutes and 26 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughConverts security best-practice code samples in documentation from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the detailed security documentation updates in Per-comment submission: 9 posted, 2 failed. Unposted inline comments (raw text):
|
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (1)
contract-dev/techniques/security.mdx (1)
544-552:⚠️ Potential issue | 🟠 MajorThis section is not fully ported to Tolk yet.
The vulnerable snippet still uses a
funcfence (Line 546) while the paired secure snippet istolk. For this PR’s objective (“port code samples to Tolk”), this section should be fully converted for consistency.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@contract-dev/techniques/security.mdx` around lines 544 - 552, The vulnerable snippet uses a `func` code fence while the paired secure snippet is `tolk`, so update the vulnerable example to use a `tolk` fence and ensure both examples are fully ported to Tolk; locate the snippet containing `infoDict.delete(index);` and replace the surrounding fence language from `func` to `tolk`, then verify the secure implementation block is also a complete Tolk block (matching fence type and content) so the section is fully converted and consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@contract-dev/techniques/security.mdx`:
- Around line 340-342: The Vote struct's votes field is declared as a signed int
(Vote.votes : int32) but Storage.votes is unsigned (Storage.votes : uint32),
causing a signed/unsigned mismatch at the addition site (storage.votes +=
msg.votes); change Vote.votes to uint32 to match Storage.votes and ensure the
addition uses the same unsigned type throughout (update the Vote struct
declaration and any references to Vote.votes accordingly).
- Around line 95-103: The Tolk external-message handlers (function
onExternalMessage and similar examples) call the wrong API: replace the call to
acceptMessage() with the documented acceptExternalMessage() to correctly accept
incoming external messages; update each usage in the Tolk code blocks that
currently call acceptMessage() so they call acceptExternalMessage() instead
(e.g., inside onExternalMessage and the two other external-message examples).
- Around line 270-277: The example uses msg.send(128) which is
SendRemainingBalance and will drain the contract; update the example to use a
non-draining send mode (e.g., msg.send(0) for a regular send or msg.send(3) to
forward fees) or explicitly document why draining is intended; locate the
createMessage call and the msg.send(128) invocation (and note the presence of
seqno replay protection) and replace the 128 mode or add a clear comment
explaining the deliberate use of SendRemainingBalance.
- Around line 64-71: The secure-example snippets use the outdated Tolk signature
onInternalMessage(msgValue: int, inMsgFull: cell, inMsgBody: slice) and the bare
sender variable; update both occurrences (the snippets handling empty message
and the later similar block) to the modern entrypoint signature fun
onInternalMessage(in: InMessage) and replace any use of sender with
in.senderAddress; adjust any references to message parts to use fields on the
InMessage (e.g., in.body or in.raw) so sendRawMessage is called with the correct
in-derived values and types (keep the same destruction logic but sourced from
in).
---
Duplicate comments:
In `@contract-dev/techniques/security.mdx`:
- Around line 544-552: The vulnerable snippet uses a `func` code fence while the
paired secure snippet is `tolk`, so update the vulnerable example to use a
`tolk` fence and ensure both examples are fully ported to Tolk; locate the
snippet containing `infoDict.delete(index);` and replace the surrounding fence
language from `func` to `tolk`, then verify the secure implementation block is
also a complete Tolk block (matching fence type and content) so the section is
fully converted and consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ca165394-0a02-4b9f-90ad-50f083258940
📒 Files selected for processing (1)
contract-dev/techniques/security.mdx
|
Thanks for the updates in Per-comment submission: 1 posted, 1 failed. Unposted inline comments (raw text):
|
|
note to self: also check for Tact-specific functions/structs on pages in foundations, tvm, contract-dev, and standard sections — replace each occurance with idiomatic Tolk equivalents |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
closes #1186
Summary by CodeRabbit