feat(security): reusable SAST and secrets scanning workflows (batch 1)#12
Merged
NORSAIN-AI merged 1 commit intomainfrom Apr 22, 2026
Merged
feat(security): reusable SAST and secrets scanning workflows (batch 1)#12NORSAIN-AI merged 1 commit intomainfrom
NORSAIN-AI merged 1 commit intomainfrom
Conversation
Introduces the first batch of org-shared security workflows referenced by the layered security plan (hvordan-kan-vi-bygge-magical-hinton.md): - .github/workflows/security-sast.yml: Semgrep SAST with graceful degradation. Uses `semgrep ci` when SEMGREP_APP_TOKEN is present (Platform org norsain_com, native PR comments), falling back to OSS `semgrep scan` (p/trailofbits, p/owasp-top-ten, p/security-audit, auto) piped through reviewdog rdjson for inline PR comments. Fails on findings at/above `fail-severity` (default ERROR). Uploads semgrep.json as a workflow artifact. - .github/workflows/security-secrets.yml: gitleaks per PR/push with PR comments and fail-on-find, plus a weekly TruffleHog deep sweep (Mon 06:00 UTC, --only-verified) that opens a tracked issue via peter-evans/create-issue-from-file on verified findings. Also supports workflow_dispatch. - .gitleaks.toml: NORSAIN baseline extending gitleaks defaults with AWS/GCP/GitHub/Slack/OpenAI/Anthropic key rules and an allowlist for test fixtures, lockfiles, docs examples, and canonical AWS sample keys. - README.md: documents the new security workflows and caller usage. After merge, tag `v1` to activate consumers.
|
|
There was a problem hiding this comment.
Pull request overview
Denne PR-en introduserer første batch med gjenbrukbare sikkerhets-workflows i org-repoet NORSAIN-AI/.github, slik at downstream-repoer kan få en felles baseline for SAST (Semgrep) og secrets scanning (Gitleaks/TruffleHog). I tillegg legges en repo-root .gitleaks.toml baseline og dokumentasjon i README for forventet caller-oppsett.
Changes:
- Legger til reusable Semgrep SAST-workflow med Platform-mode og OSS fallback.
- Legger til reusable secrets-scanning workflow med Gitleaks + planlagt TruffleHog deep sweep.
- Legger til
.gitleaks.tomlbaseline-konfig og dokumenterer “Security Workflows” i README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| README.md | Dokumenterer nye security-workflows og caller-eksempel |
| .gitleaks.toml | Innfører sentral gitleaks baseline (regler + allowlist) |
| .github/workflows/security-secrets.yml | Reusable secrets-scanning (gitleaks + trufflehog + issue) |
| .github/workflows/security-sast.yml | Reusable Semgrep SAST med artifacts og reviewdog-basert kommentering |
This was referenced Apr 22, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First batch of reusable security workflows implementing layer 1 of the
NORSAIN layered security strategy (plan:
hvordan-kan-vi-bygge-magical-hinton.md).security-sast.yml— reusable Semgrep workflow. Runssemgrep ciwhen
SEMGREP_APP_TOKENis available (Platform orgnorsain_com,native PR comments, dashboard), otherwise falls back to OSS
semgrep scanwithp/trailofbits,p/owasp-top-ten,p/security-audit,auto. Findings are converted tordjsonandposted as inline PR comments via
reviewdog/action-setup@v1. Failsthe job on findings at or above the configurable
fail-severity(default
ERROR). Uploadssemgrep.json/semgrep.sarifas aworkflow artifact because SARIF-to-Security-tab is blocked on
GHAS-less private callers.
security-secrets.yml— two-job reusable workflow.gitleaksrunson every call (PR/push) using repo-root
.gitleaks.toml, posts PRcomments, and fails on any detected secret.
trufflehogruns onlyon
schedule(weekly, Mon 06:00 UTC) orworkflow_dispatchwith--only-verifiedand opens a tracked GitHub issue viapeter-evans/create-issue-from-file@v5on verified findings, thenfails the job.
.gitleaks.toml— NORSAIN baseline: extends gitleaks defaults withrules for AWS, GCP, GitHub (classic/fine-grained/app/OAuth), Slack,
OpenAI, and Anthropic keys. Allowlist covers test fixtures,
lockfiles,
.env.example, docs examples, and canonical AWS samplekeys.
README.md— new "Security Workflows" section with caller usageexample (uses
secrets: inherit).Scope (in)
security-sast.yml,security-secrets.yml).gitleaks.tomlScope (out, deferred to later batches per plan)
security-iac.yml(Checkov)security-deps.yml(OSV-Scanner)security-python.yml(Ruff--select S)codeql-selfhost.yml(CodeQL dogfood on this public repo)semgrep/norsain-rules.ymlcustom rulesetworkflow-templates/security-full.ymlstarterFollow-up after merge
After review + merge, tag
v1so consumer repos can pin@v1. The tag is intentionally not created in this PR.Verification
yamllint -c .yamllint.yaml .github/workflows/security-sast.yml .github/workflows/security-secrets.yml— only the pre-existing repo-widedocument-startwarning remains (no existing workflow uses---).actionlint(viarhysd/actionlint:latestcontainer) — clean, no findings.Test plan
v1.agentic-orchestratorwithsecrets: inherit.eval()of user input) — expect inline Semgrep comment on exact line; PR fails.SEMGREP_APP_TOKENfrom org secrets — expect OSS fallback to run with Reviewdog comments; PR still fails.AKIAIOSFODNN7EXAMPLEoutsidefixtures/— expect gitleaks fail + PR comment. Move undertests/fixtures/— expect allowlisted.security-secrets.ymlviaworkflow_dispatchagainst a repo with a known verified secret — expect an issue to be created withsecurity,secrets,priority-highlabels.