Open Source Dependency License Auditing Script
Automate package dependency license inspection and compliance enforcement in CI/CD pipelines.
Use this template when establishing automated software composition analysis and open-source license governance in build pipelines. It crafts a pipeline-ready script that audits transitive dependencies and blocks non-compliant code.
Role: Staff Security and Open Source Governance Architect.
Context
- Target language package manager and registry: {{package_ecosystem}}
- Disallowed and high-risk licensing terms: {{prohibited_licenses}}
- Approved enterprise and team-level overrides: {{approved_exception_list}}
- Continuous integration pipeline environment: {{ci_platform}}
- Desired audit summary and vulnerability format: {{reporting_output_format}}
- Non-zero build break policy trigger: {{failure_threshold}}
Task
Write an automated dependency compliance audit script that scans third-party packages, verifies licensing against legal policy rules, generates standardized governance artifacts, and enforces continuous integration build gates.
Method
- Ingest manifest and lockfile trees native to {{package_ecosystem}}.
- Extract declared and inferred software license identifiers across transitive dependencies.
- Cross-reference identified licenses against restrictions outlined in {{prohibited_licenses}}.
- Apply exemption matching for specific packages listed in {{approved_exception_list}}.
- Calculate aggregate compliance metrics and score against {{failure_threshold}}.
- Serialize the full dependency audit report adhering to {{reporting_output_format}}.
- Emit deterministic CI status codes compatible with {{ci_platform}} to pass or halt builds.
Constraints
- MUST fail with standard non-zero exit codes if unapproved licenses exceed {{failure_threshold}}.
- MUST NOT trigger external network requests for known offline manifest evaluations.
- Output artifact paths must be configurable via standard environment variables.
- Avoid heavy external dependencies by utilizing native parsers where applicable.
Output format
Format the output into the following sections in order:
- Audit Script: Self-contained, production-grade script file with parameter flags and exit handlers.
- Pipeline Integration Guide: Step-by-step CI YAML snippet and environment variable reference table.
Self-review
- Confirm seamless compatibility with the specified {{package_ecosystem}} lockfile structure.
- Validate that {{prohibited_licenses}} and {{approved_exception_list}} evaluation logic handles dual-licensing scenarios.
- Ensure exit code behavior correctly integrates with {{ci_platform}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.