StackShield + GitHub Actions: Security Scans in Your CI/CD Pipeline
Run StackShield security scans as part of your GitHub Actions workflow. Catch misconfigurations before they reach production.
Integrate StackShield into your GitHub Actions workflows to automatically run security scans on every push, pull request, or deployment. By triggering a scan via the StackShield API endpoint, your CI pipeline can verify that your Laravel application passes all security checks before merging or deploying. Failed checks can block the pipeline, ensuring that exposed debug pages, missing security headers, or leaked environment files never make it to production.
Features
- Trigger StackShield scans from any GitHub Actions workflow using a simple cURL step or the StackShield API
- Gate deployments by failing the workflow if critical or high-severity findings are detected
- Scan staging or preview environments automatically after deployment to catch issues before promoting to production
- View scan results directly in the GitHub Actions log output with links to your StackShield dashboard for details
- Support for matrix builds to scan multiple sites or environments in a single workflow run
Setup Guide
-
1
Generate a StackShield API Token
In your StackShield dashboard, go to Settings and then API. Generate a new API token with scan permissions. Copy the token and the site-specific trigger URL.
-
2
Add the Token as a GitHub Secret
In your GitHub repository, go to Settings, then Secrets and variables, then Actions. Create a new secret called STACKSHIELD_API_TOKEN and paste your API token. Create another secret called STACKSHIELD_TRIGGER_URL with your scan trigger URL.
-
3
Add the Scan Step to Your Workflow
Add a step to your GitHub Actions workflow YAML that calls the StackShield trigger endpoint using cURL. Pass the API token as a Bearer token in the Authorization header. The endpoint returns the scan results as JSON, which you can parse to determine pass or fail status.
-
4
Configure Failure Thresholds
Decide which severity levels should cause the workflow to fail. You can parse the JSON response and use a conditional step to fail the job if findings exceed your threshold (for example, fail on any critical or high-severity finding).
Ideal Use Case
GitHub Actions integration is essential for teams practicing continuous deployment with Laravel applications. By running a StackShield scan after deploying to a staging environment, you catch security regressions before they reach production. This is particularly valuable when multiple developers are pushing changes frequently, as it provides an automated safety net that does not rely on anyone remembering to check the security dashboard manually.
Frequently Asked Questions
Does StackShield provide an official GitHub Action?
StackShield provides a CI/CD trigger endpoint that works with a simple cURL command in any CI system. You can call this endpoint from a GitHub Actions step without needing a custom action from the marketplace.
Can I scan a preview or staging URL that changes with each pull request?
Yes. You can pass the target URL dynamically to the StackShield API. If your staging URL changes per branch or PR (for example, with Vercel preview deployments), pass it as a variable in your workflow.
How long does a scan take in the CI pipeline?
A typical StackShield scan completes in 15 to 45 seconds depending on the number of checks and the response time of your application. The trigger endpoint can run synchronously (waiting for results) or asynchronously (returning immediately with a status URL to poll).
Related Integrations
GitLab CI/CD
Add StackShield security scans to your GitLab CI/CD pipelines. Automatically verify Laravel security posture on every merge request.
Bitbucket Pipelines
Integrate StackShield scans into Bitbucket Pipelines. Run automated security checks on your Laravel app with every deployment.
Vercel
Monitor the security of Laravel applications deployed on Vercel. Scan preview and production deployments automatically.
Try StackShield Free for 14 Days
Start monitoring your Laravel application security in minutes. No installation required.
Start Free Trial