Add to GitHub

A security review on every pull request.

Guardrail finds the leaked key, the typosquatted package and the injection path, and puts the fix on the line before anyone merges.

Add to GitHub Three bends, three checks. About 45 seconds.

PR #2214 merged into main

3 issues fixed before merge. 41 seconds.

guardrail/review Successful in 41s. 3 findings resolved, 0 open.

3bends on the drive

Three checks on PR #2214, as they landed in the review.

Each bend in the drive is one finding on a pull request at Fernhill Supply. Open a step to read the comment and the fix the author committed.

  1. 1Leaked secretconfig/prod.env, lines 11 to 12
    config/prod.envResolved
    @@ -8,3 +8,5 @@
    1010SEARCH_INDEX=fernhill-products
    11+AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
    12+AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

    Comment on lines +11 to +12

    theo-lindnowMember

    High · secrets/aws-access-key · flagged by Guardrail

    This commits the search indexer's AWS key pair to a file that ships with every deploy. Read both values from the vault at start-up. Then rotate the key in IAM: it stays in the branch history after this change.

    Suggested change
    11-AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
    12-AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
    11+AWS_ACCESS_KEY_ID=op://prod/search-indexer/access-key-id
    12+AWS_SECRET_ACCESS_KEY=op://prod/search-indexer/secret-key
    Commit suggestionAdd suggestion to batchThis suggestion was applied in 4e1c9b7.
    ohaddadnowAuthor

    Applied in 4e1c9b7. Key rotated, SEC-418 closed.

    ohaddad marked this conversation as resolved.

  2. 2Risky dependencypackage.json, line 23
    package.jsonResolved
    @@ -20,6 +20,7 @@
    2222 "lru-cache": "^10.2.0",
    23+ "left-padder": "^1.3.2",
    2324 "pg": "^8.11.3",

    Comment on line +23

    theo-lindnowMember

    Critical · deps/typosquat · flagged by Guardrail

    left-padder is not left-pad. It was published 2 days ago by an account created the same day, and its postinstall script sends process.env to an outside host. CI ran it on your last push, so treat the CI secrets as exposed.

    Suggested change
    23- "left-padder": "^1.3.2",
    23+ "left-pad": "1.3.0",
    Commit suggestionAdd suggestion to batchThis suggestion was applied in 9a03d5e.

    Pinned exactly, with no caret. Or drop it: String.prototype.padStart does the same job.

    ohaddadnowAuthor

    Applied in 9a03d5e, lockfile regenerated. Rotating the CI secrets now.

    ohaddad marked this conversation as resolved.

  3. 3Injection pathsrc/search.ts, lines 41 to 43
    src/search.tsResolved
    @@ -38,6 +38,9 @@ export async function searchProducts(req: Request) {
    4040 const q = String(req.query.q ?? "");
    41+ const sql = `SELECT id, name, price FROM products
    42+ WHERE name ILIKE '%${q}%' LIMIT 50`;
    43+ const { rows } = await db.query(sql);

    Comment on lines +41 to +43

    theo-lindnowMember

    High · injection/sql · flagged by Guardrail

    q comes straight from the URL, so ?q=%' OR 1=1 -- returns every row. With no parameters, pg uses the simple query protocol, which also runs stacked statements. Send q as a parameter instead.

    Suggested change
    42- WHERE name ILIKE '%${q}%' LIMIT 50`;
    43- const { rows } = await db.query(sql);
    42+ WHERE name ILIKE $1 LIMIT 50`;
    43+ const { rows } = await db.query(sql, [`%${q}%`]);
    Commit suggestionAdd suggestion to batchThis suggestion was applied in c71f2a8.
    ohaddadnowAuthor

    Applied in c71f2a8. Added a test with that exact query string.

    ohaddad marked this conversation as resolved.

1How it works

Forty-one seconds from push to review.

Guardrail is a GitHub App. It reviews every pull request the way a careful security engineer would: it reads what changed, follows where the data goes, and only speaks up when it can point at a line.

A desk at night with a lamp and a monitor full of terminal output
Each review runs in a sandbox with no network and no secrets.
  1. 0 s

    The pull request opens.

    GitHub sends the webhook. Guardrail checks out the merge commit in a fresh sandbox that is deleted when the review ends.

  2. 4 s

    It reads more than the diff.

    It follows each changed function to its callers, reads the lockfile and the CI workflows, and traces where request data can reach a query, a shell or a file path.

  3. 22 s

    Twelve checks run in parallel.

    Secrets, dependencies, injection, access control, infrastructure and CI, plus the rules your team wrote. A finding has to name a line and a way in; nothing is posted on a hunch.

  4. 34 s

    Every finding gets a fix.

    The fix is a suggested change the author can commit from the comment, plus the step a diff cannot make, such as rotating a key that is already in the history.

  5. 41 s

    The review lands, and the gate holds.

    Comments go on the lines. The guardrail/review check stays red until each one is resolved, so your branch protection does the blocking, not a person.

Two engineers reading code together at one monitor in an office

Your security team owns the rules.

Rules live in .guardrail.yml in each repository, so changes to them are reviewed like any other code. In reviewer mode, a person on the team posts each finding with one tap, as Theo does on the drive.

We stopped arguing with a scanner and started fixing things. Every comment points at a line and brings the fix with it.

Theo Lind, security lead at Fernhill Supply

2Checks

Twelve checks on every diff.

Each one knows the difference between a test fixture and production config, and each one ships with the fix it suggests.

  1. 01

    Secrets

    Cloud keys, tokens and private keys in code, config and commit history, with the rotation step when one has already been pushed.

    Bend 1secrets/*
  2. 02

    Dependencies

    Typosquats, packages from brand new publishers, install scripts that reach the network, and known CVEs in the lockfile.

    Bend 2deps/*
  3. 03

    Injection

    SQL, shell, template and path injection, wherever request data reaches a sink without a parameter or an allowlist.

    Bend 3injection/*
  4. 04

    Access control

    New routes without an auth check, and object IDs read from the request with no owner check behind them.

    authz/*
  5. 05

    Server-side requests

    Server code that fetches a URL the user controls, including redirects to internal addresses and cloud metadata.

    ssrf/*
  6. 06

    CI workflows

    pull_request_target jobs that check out untrusted code, actions pinned to a tag instead of a commit, and untrusted input in run steps.

    ci/*
  7. 07

    Infrastructure

    Public buckets, ingress open to 0.0.0.0/0 and wildcard IAM policies in Terraform and Kubernetes files.

    iac/*
  8. 08

    Cryptography

    Fast hashes for passwords, fixed IVs, home-made tokens and TLS verification switched off.

    crypto/*
  9. 09

    Deserialisation

    yaml.load, pickle and Java object streams fed with data from outside.

    deser/*
  10. 10

    Data in logs

    Tokens, card numbers and email addresses written to logs and error trackers.

    logs/*
  11. 11

    Web sessions

    CORS that reflects any origin with credentials, and cookie sessions without CSRF protection.

    web/*
  12. 12

    Your own rules

    Anything your team writes down, for example no new direct calls to the payments API outside billing/.

    policy/*

TypeScript, JavaScript, Python, Go, Java, Kotlin, Ruby and PHP, plus Terraform, Kubernetes, Dockerfiles and GitHub Actions.

3Pricing

Priced per developer who opens pull requests.

Reviewers, bots and people who only read are free.

  • Public repositoriesFree
  • Team$19per developer a month
  • EnterpriseTalk to us

Public repositories

  • All twelve checks
  • Suggested fixes on every finding
  • The merge gate as a status check

Team

  • Private repositories
  • Reviewer mode and your own rules
  • Slack alerts for critical findings

Enterprise

  • Runner inside your network
  • GitHub Enterprise Server, SAML SSO
  • Audit log export, a named security engineer
Add to GitHub

Team starts with 14 days free, no card. Enterprise questions

4Docs

Install in two minutes.

  1. 1

    Add the app to GitHub.

    Pick the repositories. Guardrail asks for read access to code and write access to pull request reviews and checks, nothing else.

  2. 2

    Make the check required.

    In branch protection for main, add guardrail/review as a required status check. That is the merge gate.

  3. 3

    Open a pull request.

    The first review arrives in under a minute. Add .guardrail.yml later, when you want your own rules.

.guardrail.ymloptional
# Every check runs unless you turn it off.checks: allgate: required            # guardrail/review blocks mergereviewer: "@fernhill/security"  # reviewer modeignore:  - "test/fixtures/**"rules:  - id: policy/payments-boundary    deny: "import of @fernhill/payments-client"    outside: "src/billing/**"    severity: high

Questions

Does Guardrail keep our code?

No. Each review runs in a sandbox that is destroyed when it ends. We keep the findings, the file paths and the line numbers for 90 days, and nothing else.

Who posts the comments?

The Guardrail app, by default. In reviewer mode, a person on your security team posts each finding with one tap from Slack or GitHub, as Theo does on the drive above.

What happens with a false positive?

Reply /guardrail ignore with a reason. The reason is written to .guardrail.yml in the same pull request, so the exception gets reviewed like code and nobody has to remember it.

Does it block merges?

Only if you make guardrail/review a required status check. Without that it comments, sets the check, and stays out of the way.

Can it run inside our network?

Yes, on Enterprise. The runner is one container you host next to GitHub Enterprise Server or your own CI, and no code leaves your network.

The road to main has rails now.

Add to GitHubFree for public repositories.