Overview
Auto-approval allows Data Owners to define rules for automatically approving:- Jobs - Based on script hash, filenames, and submitter
- Peers - Based on email domain whitelist
Job Auto-Approval
JobApprovalHandler
Parameters:
client: SyftboxManager- Authenticated client fromsc.login_do()config: JobApprovalConfig- Approval criteria configurationstate: Optional[StateManager]- State tracker to prevent duplicateson_approve: Optional[Callable]- Callback function when job approvedverbose: bool = True- Print approval activity
Check all pending jobs and approve those matching criteriaReturns:
list[JobInfo] - List of approved jobsAutomatically calls client.process_approved_jobs() after approvals.JobApprovalConfig
Enable/disable job auto-approval (default:
False)Only approve jobs from approved peers (default:
True)When enabled, jobs from non-peers are skipped regardless of other criteria.Exact filenames that must be present (default: Job must contain exactly these files, no more, no less. Extra files cause rejection.
[])Filename to hash mapping for content validation (default: Validates file content matches expected hash. Use
{})syft-bg hash <file> to generate hashes.Whitelist of user emails (default:
[])Empty list = allow all approved peers (when peers_only=True)Approval Criteria
A job is approved if ALL conditions match:- Status - Job must be in “inbox” status
- Allowed Users - If specified, submitter must be in list
- Peers Only - If enabled, submitter must be approved peer
- Script Hashes - All required scripts must match expected hash
- Filenames - Job must contain exactly the required files (no extras)
Generating Script Hashes
Peer Auto-Approval
PeerApprovalHandler
Parameters:
client: SyftboxManager- Authenticated client fromsc.login_do()config: PeerApprovalConfig- Approval criteriastate: Optional[StateManager]- State trackeron_approve: Optional[Callable]- Callback when peer approvedverbose: bool = True- Print approval activity
Check all pending peers and approve those matching criteriaReturns:
list[str] - List of approved peer emailsAutomatically shares configured datasets with newly approved peers.PeerApprovalConfig
Enable/disable peer auto-approval (default:
False)Email domain whitelist (default: Approves peers with email addresses ending in these domains.
[])Datasets to automatically share with approved peers (default:
[])After approval, calls client.share_dataset(name, peer_email) for each dataset.Configuration File
config.yaml Structure
CLI Configuration
Background Service
Starting Auto-Approval Service
Service Management
Example Output
State Management
Prevents re-approving the same jobs/peers:Callbacks
Custom Actions on Approval
Security Considerations
Script Hash Validation
Why it matters: Prevents malicious code executionPeers-Only Mode
Why it matters: Prevents unknown users from running jobsDomain Whitelisting
Why it matters: Prevents impersonation attacksBest Practices
- Always use script hash validation - Don’t approve jobs based on filename alone
- Enable peers-only mode - Require mutual peering before running jobs
- Use short check intervals - 5 seconds recommended for approval service
- Monitor approval logs - Review
syft-bg logs approveregularly - Start with restrictive rules - Gradually relax as trust increases
- Combine with notifications - Get email alerts for approved jobs
Headless Mode
For automated deployments without user interaction:Systemd Integration
Auto-start on boot (Linux):See Also
- Monitoring Services - Job and peer monitors
- Notifications - Email notification system