Update Network Permissions At Runtime#1528
Merged
cooper-grc merged 3 commits intomainfrom Nov 25, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
2 issues found across 14 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="pkg/worker/network.go">
<violation number="1" location="pkg/worker/network.go:831">
Rule violated: **Enforce Early Returns for Error Handling**
UpdateNetworkPermissions ignores the errors from setupAllowList/setupBlockNetwork, so it will return nil even when updating iptables fails. The "Enforce Early Returns for Error Handling" rule requires capturing those errors and returning immediately instead of continuing on the happy path. Please wrap each call with an early return, as is done elsewhere in this file.</violation>
<violation number="2" location="pkg/worker/network.go:839">
Rule violated: **Prevent Redundant Code Duplication**
This helper duplicates the existing removeIPTablesRules logic (iterating tables/chains, parsing rules, stripping quotes, deleting entries) instead of reusing or generalizing it. Please extract the shared code so future iptables changes stay consistent.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
luke-lombardi
approved these changes
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Add a runtime API to update a sandbox’s network permissions without restart. Supports blocking all egress or setting an allowlist; exposed ports remain accessible.
Written for commit 8ab7e1f. Summary will update automatically on new commits.