Skip to content

feat: add wildcard accept ["*"] for write-sink guards#1868

Merged
lpcox merged 2 commits intomainfrom
fix/write-sink-accept-wildcard
Mar 13, 2026
Merged

feat: add wildcard accept ["*"] for write-sink guards#1868
lpcox merged 2 commits intomainfrom
fix/write-sink-accept-wildcard

Conversation

@lpcox
Copy link
Collaborator

@lpcox lpcox commented Mar 13, 2026

Summary

Adds WildcardTag ("*") support to DIFC label subset checks, enabling accept: ["*"] in write-sink guard configuration.

Problem

When DIFC guards are enabled, output servers like safeoutputs need a write-sink guard to prevent noop guard integrity violations. For repos="all" and repos="public" configurations (where the agent has no secrecy tags), there was no clear accept value to use — the write-sink is needed purely to classify operations as writes.

Solution

  • DIFC wildcard: When the superset side of a flow check contains "*", the subset check passes unconditionally. This is implemented in checkFlowHelper, SecrecyLabel.CanFlowTo, and IntegrityLabel.CanFlowTo.
  • Validation: accept: ["*"] is accepted as a sole entry; "*" mixed with other entries is rejected.
  • Updated rules: repos="all" / repos="public" now map to accept: ["*"] (previously documented as "not required").
  • Documentation: Write-sink is now documented as required for ALL output servers when DIFC guards are enabled.

Accept Rules Table (updated)

allow-only.repos Agent secrecy write-sink.accept
"all" [] (none) ["*"] (wildcard)
"public" [] (none) ["*"] (wildcard)
["owner/repo"] ["private:owner/repo"] ["private:owner/repo"]
["owner/*"] ["private:owner"] ["private:owner"]
["owner/prefix*"] ["private:owner/prefix*"] ["private:owner/prefix*"]

Changes

  • internal/difc/labels.goWildcardTag constant + wildcard logic in flow checks
  • internal/difc/labels_test.go — 20+ wildcard flow tests
  • internal/config/guard_policy.go — Validation for ["*"], updated godoc
  • internal/config/config_guardpolicies_test.go — Wildcard validation tests
  • internal/guard/write_sink.go — Updated docstring
  • internal/guard/write_sink_test.go — Wildcard DIFC evaluation tests
  • README.md — Updated accept rules table and key rules

Testing

All existing + new tests pass via make agent-finished.

Add WildcardTag ("*") support to DIFC label subset checks. When the
superset side of a flow check contains "*", the check passes regardless
of what tags the other side has.

This enables write-sink accept=["*"] for repos="all" and repos="public"
configurations where the agent has no secrecy tags but still needs a
write-sink to prevent noop guard integrity violations.

Changes:
- Add WildcardTag constant and wildcard logic to checkFlowHelper,
  SecrecyLabel.CanFlowTo, and IntegrityLabel.CanFlowTo
- Update ValidateWriteSinkPolicy to accept ["*"] as sole entry
- Reject "*" mixed with other accept entries
- Update WriteSinkAcceptRules godoc and WriteSinkGuard docstring
- Update README accept rules table: repos="all"/"public" → ["*"]
- Add 20+ tests: DIFC wildcard flow checks, write-sink evaluation
  with wildcard accept, and validation edge cases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 13, 2026 18:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds wildcard tag ("*") support to DIFC label subset checks, enabling accept: ["*"] in write-sink guard configuration for repos="all" and repos="public" scenarios where agents have no secrecy tags but still need write-sink guards to prevent noop guard integrity violations.

Changes:

  • Introduces WildcardTag constant and wildcard logic in DIFC flow checks (checkFlowHelper, SecrecyLabel.CanFlowTo, IntegrityLabel.CanFlowTo)
  • Adds validation that ["*"] is accepted as sole entry in write-sink accept config, rejecting mixed usage
  • Updates documentation and tests to reflect that write-sink is now required for all output servers

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/difc/labels.go Adds WildcardTag constant and wildcard bypass in flow checks
internal/difc/labels_test.go 20+ tests for wildcard tag behavior in secrecy/integrity flows
internal/config/guard_policy.go Validation for ["*"] wildcard accept + updated godoc
internal/config/config_guardpolicies_test.go Validation tests for wildcard accept
internal/guard/write_sink.go Updated docstring with wildcard examples
internal/guard/write_sink_test.go Updated tests to use wildcard accept for repos="all"/"public"
README.md Updated accept rules table and key rules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

…ions

Update README and config.example.toml to document that write-sink is
required for ALL output servers when DIFC guards are enabled, not just
for scoped repos. Add examples showing correct accept values for every
GitHub guard policy option:

- repos="all" / repos="public" → accept=["*"] (wildcard)
- repos=["owner/*"] → accept=["private:owner"]
- repos=["owner/repo"] → accept=["private:owner/repo"]
- repos=["owner/prefix*"] → accept=["private:owner/prefix*"]

README changes:
- Rewrite write-sink section to lead with "required for ALL" emphasis
- Add separate JSON/TOML examples for scoped vs broad access
- Add "*" wildcard as first entry in accept format list
- Update "When to use" to say required, not optional

config.example.toml changes:
- Add "IMPORTANT: Write-sink is REQUIRED" note
- Show both wildcard and scoped accept examples
- Add quick reference table mapping repos → accept

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox merged commit fa53c11 into main Mar 13, 2026
13 checks passed
@lpcox lpcox deleted the fix/write-sink-accept-wildcard branch March 13, 2026 18:29
@lpcox lpcox restored the fix/write-sink-accept-wildcard branch March 13, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants