

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Managing Secrets
incomplete
2: Injecting Secrets at Runtime
incomplete
3: Protecting Secrets
incomplete
4: Build Artifacts and Deployment Hygiene
incomplete
5: Limiting Build Context
incomplete
6: Source Code and Config Leaks
incomplete
7: Public File Leaks
incomplete
8: Server-Side Request Forgery
incomplete
9: Defending Against SSRF
incomplete
10: Open Redirects
incomplete
11: Risks of Dependencies
incomplete
12: Auditing Dependencies
incomplete
13: Dependency Maintenance
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A security check only helps when it runs regularly and someone actually responds to its results. Developers often remember to keep security in mind in production, but forget about their CI servers!
Say we have this GitHub Actions workflow that runs on every push and pull request:
name: Dependency audit
on: [push, pull_request]
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
cache: npm
- run: npm ci --ignore-scripts
- run: npm run audit:security
There are a few good practices here:
actions/checkout and actions/setup-node to full-length commit SHAs, so a moved tag can't silently change the code our workflow runs.GITHUB_TOKEN only contents: read permission, which is the minimum required for this workflow.npm ci instead of npm install to install the exact dependency tree in package-lock.json.--ignore-scripts when installing dependencies, which prevents any lifecycle scripts from running during installation, reducing the risk of executing potentially malicious code from dependencies.npm run audit:security afterward, so --ignore-scripts doesn't prevent the audit itself from running.Bearly Secure's dependency audit currently depends on someone remembering to run it. Add a GitHub Actions workflow that enforces the audit policy on pushes and pull requests.
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
npm ci --ignore-scripts
npm run audit:security
actionlint .github/workflows/dependency-audit.yml
Run and submit the CLI tests from the project root.