Draft
Conversation
- Created build-sandbox.sh wrapper script with namespace isolation for Linux - Added fallback environment isolation for restricted environments and macOS - Integrated sandbox into Build/Compile and Build/Install in package-defaults.mk - Integrated sandbox into Host/Compile in host-build.mk - Added CONFIG_BUILD_SANDBOX configuration option (default enabled) - Sandbox provides isolation to prevent host system modifications and dependency issues Co-authored-by: aparcar <16000931+aparcar@users.noreply.github.com>
- Created BUILD_SANDBOX.md with comprehensive documentation - Tested sandbox with make commands and compilation - Verified sandbox can be disabled via CONFIG_BUILD_SANDBOX - Confirmed backward compatibility when sandbox is disabled Co-authored-by: aparcar <16000931+aparcar@users.noreply.github.com>
- Fixed environment variable handling: sandbox now preserves all environment properly - Fixed Make syntax when BUILD_SANDBOX is disabled using $(if) conditionals - Added 'env' wrapper to properly handle MAKE_VARS environment variable assignments - Simplified environment isolation to just pass through all arguments - Tested both enabled and disabled sandbox configurations Co-authored-by: aparcar <16000931+aparcar@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add sandbox around package building steps for security
Add build sandboxing for package compilation
Jan 6, 2026
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.
Package builds currently run with full host system access, creating security risks: packages can modify the developer machine and pull incorrect host dependencies.
Implementation
Sandbox wrapper (
scripts/build-sandbox.sh)unsharewhen availableOPENWRT_SANDBOX_METHODenvironment variableBuild system integration
Build/Compile,Build/Install(package-defaults.mk)Host/Compile(host-build.mk)$(if $(BUILD_SANDBOX),$(BUILD_SANDBOX) env)pattern to handle variable assignmentsConfiguration
CONFIG_BUILD_SANDBOXoption in menuconfig (default: enabled)CONFIG_BUILD_SANDBOX=nin .configExample
Before:
After:
When enabled, compilation runs:
build-sandbox.sh env CC=gcc CFLAGS="..." makeWhen disabled, runs normally:
CC=gcc CFLAGS="..." makePlatform Support
No package Makefile changes required.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.