Skip to content

(feat) Add embedded external policies for third-party dependency support#67

Merged
nknize merged 1 commit intomainfrom
feature/cpThirdPartyDiscovery
Jan 30, 2026
Merged

(feat) Add embedded external policies for third-party dependency support#67
nknize merged 1 commit intomainfrom
feature/cpThirdPartyDiscovery

Conversation

@nknize
Copy link
Contributor

@nknize nknize commented Jan 30, 2026

Description

Modules can now ship policies for their runtime dependencies (e.g., Netty, Reactor) by placing them in src/main/jguard/. These policies are compiled to META-INF/jguard/external/*.bin in the JAR and automatically discovered by the agent alongside embedded policies.

This enables applications to define capabilities for third-party libraries without requiring manual -Djguard.policy.override configuration at runtime. Same signing requirements apply as embedded policies.

Changes:

  • Agent: Add external policy discovery from META-INF/jguard/external/*.bin in both JARs and directories (for development)
  • JarSignatureVerifier: Add findExternalPolicyEntries(), isEntrySigned(), and make hasSignatures() public
  • Gradle plugin: Default externalPoliciesSourceDir to src/main/jguard/ (mirrors src/test/jguard/ for test policies)
  • Gradle plugin: Output external policies to build/jguard-policy/META-INF/ jguard/external/ so they're packaged in JARs
  • Gradle plugin: Add compileTestJava dependency on compileExternalPolicies to fix Gradle task dependency validation error
  • Add comprehensive tests for external policy discovery

…upport

Modules can now ship policies for their runtime dependencies (e.g., Netty,
Reactor) by placing them in src/main/jguard/. These policies are compiled
to META-INF/jguard/external/*.bin in the JAR and automatically discovered
by the agent alongside embedded policies.

This enables applications to define capabilities for third-party libraries
without requiring manual -Djguard.policy.override configuration at runtime.
Same signing requirements apply as embedded policies.

Changes:
- Agent: Add external policy discovery from META-INF/jguard/external/*.bin
  in both JARs and directories (for development)
- JarSignatureVerifier: Add findExternalPolicyEntries(), isEntrySigned(),
  and make hasSignatures() public
- Gradle plugin: Default externalPoliciesSourceDir to src/main/jguard/
  (mirrors src/test/jguard/ for test policies)
- Gradle plugin: Output external policies to build/jguard-policy/META-INF/
  jguard/external/ so they're packaged in JARs
- Gradle plugin: Add compileTestJava dependency on compileExternalPolicies
  to fix Gradle task dependency validation error
- Add comprehensive tests for external policy discovery

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize nknize merged commit 5277974 into main Jan 30, 2026
8 checks passed
@nknize nknize deleted the feature/cpThirdPartyDiscovery branch January 30, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant