Central repository for GitHub security infrastructure at Amsterdam UMC. Provides reusable workflows, pre-commit hooks, and shared configuration for preventing accidental data leaks in research repositories.
This repository is the single source of truth for security rules enforced across the organization.
org-security-workflows/
├── .github/
│ └── workflows/
│ ├── check-forbidden-filetypes.yml # Reusable workflow for filetype scanning
│ ├── check-gitleaks.yml # Reusable workflow for secrets detection
│ └── check-personal-info.yml # Reusable workflow for PII scanning
├── actions/
│ ├── filetype-check/
│ │ └── action.yml # Composite action for filetype detection
│ ├── gitleaks-check/
│ │ └── action.yml # Composite action for secrets detection
│ └── personal-info-check/
│ └── action.yml # Composite action for PII detection
├── pre-commit-check/
│ ├── check-filetypes.sh # Pre-commit hook for filetypes
│ └── check-personal-info.sh # Pre-commit hook for PII
├── pre-push-check/
│ ├── check-filetypes-prepush.sh # Pre-push hook for filetypes
│ └── check-personal-info-prepush.sh # Pre-push hook for PII
├── personal-info-lists/
│ ├── common-dutch-firstnames.txt # Dutch first name database
│ ├── common-dutch-surnames.txt # Dutch surname database
│ └── common-dutch-streetnames.txt # Dutch street name database
├── central-gitignore.txt # Forbidden file patterns
├── gitleaks.toml # Secrets detection rules
├── .pre-commit-hooks.yaml # Hook definitions for pre-commit framework
├── LICENSE
└── README.md
This repository provides security checks that run at multiple layers:
| Layer | Location | Trigger | Can Be Bypassed? |
|---|---|---|---|
| Pre-commit hooks | Developer machine | git commit |
Yes (--no-verify) |
| Pre-push hooks | Developer machine | git push |
Yes (--no-verify) |
| GitHub Actions | GitHub servers | Push, PR | No |
The hooks and workflows reference centralized configuration files in this repository, ensuring consistent rules across all Amsterdam UMC projects.
Developer Machine GitHub
──────────────────────────────────────────────────────────────
git add ──> .gitignore ──> blocked silently
git commit ──> pre-commit hooks ──> blocked with message
(filetypes, PII)
git push ──> pre-push hooks ──> blocked with message
(filetypes, PII)
│
│ (if local checks pass or are bypassed)
▼
GitHub Actions ──> blocked, PR fails, alert sent
(filetypes, PII, secrets)
The system performs three primary security checks:
| Check | What It Detects | Hook | Workflow |
|---|---|---|---|
| Forbidden filetypes | Data files, medical imaging, databases | Yes | Yes |
| Personal information | Dutch names, addresses, patient IDs | Yes | Yes |
| Secrets | API keys, tokens, passwords, private keys | No | Yes |
Secrets detection runs only as a GitHub Action (not in local hooks) because gitleaks requires additional tooling that may not be available on all developer machines.
The central-gitignore.txt file defines which file types are blocked:
# BEGIN FORBIDDEN
*.csv
*.xlsx
*.json
!package.json # Exception: allowed
!package-lock.json # Exception: allowed
# END FORBIDDEN
# Everything below is convenience-only (not enforced)
.DS_Store
__pycache__/Only patterns between # BEGIN FORBIDDEN and # END FORBIDDEN are enforced by hooks and workflows. Patterns outside this block are helpful .gitignore suggestions that won't block commits.
Data files
.csv, .tsv, .xlsx, .xls, .ods, .sav, .dta, .RData, .rds, .sas7bdat, .feather, .parquet, .pickle, .h5, .hdf5, .sqlite, .db
Medical and research data
.nii, .nii.gz, .dcm (DICOM), .edf, .bdf, .eeg, .vhdr (biosignals), .fastq, .bam, .vcf, .bed (genomics)
Credentials
.env, .pem, .key, .p12, .pfx
Archives (may contain data)
.zip, .tar.gz, .rar, .7z
Some patterns have exceptions for common safe files:
| Blocked | Exceptions |
|---|---|
*.json |
package.json, package-lock.json, tsconfig.json, composer.json, appsettings.json |
*.xml |
pom.xml, web.xml, *.csproj, *.fsproj, *.vbproj |
.env |
(no exceptions) |
See central-gitignore.txt for the complete list.
The PII scanner detects patterns common in Dutch healthcare research.
Dutch names
- First names from
personal-info-lists/common-dutch-firstnames.txt - Surnames from
personal-info-lists/common-dutch-surnames.txt - Combinations suggesting full names
Dutch addresses
- Street names from
personal-info-lists/common-dutch-streetnames.txt - House number patterns
- Postal codes (1234 AB format)
- City names
Identifiers
- Patient IDs (7-digit MRN patterns)
- BSN (Burgerservicenummer) with checksum validation
- Medical record number formats
The PII detection is tuned for medical research contexts. Common Dutch words that happen to match name patterns are excluded. If you encounter false positives, please report them so we can refine the detection rules.
Secrets scanning uses gitleaks with a custom configuration (gitleaks.toml).
Cloud provider credentials AWS access keys, Azure credentials, GCP service account keys
API keys and tokens GitHub tokens, Slack tokens, Stripe keys, SendGrid keys, OAuth tokens, JWT tokens
Database credentials Connection strings, database passwords
Private keys SSH private keys, PEM files, PKCS12 certificates
Generic secrets High-entropy strings that may be passwords or tokens
The gitleaks.toml file defines detection rules and allowlists. It includes rules for common secret patterns and excludes known safe patterns like example placeholders.
To add security checks to a repository, create a workflow file:
# .github/workflows/security-check.yml
name: Security Check
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
filetype-check:
uses: AmsterdamUMC/org-security-workflows/.github/workflows/check-forbidden-filetypes.yml@main
personal-info-check:
uses: AmsterdamUMC/org-security-workflows/.github/workflows/check-personal-info.yml@main
secrets-check:
uses: AmsterdamUMC/org-security-workflows/.github/workflows/check-gitleaks.yml@mainFor stability, replace @main with a specific version tag (e.g., @v0.2.21).
Add to your repository's .pre-commit-config.yaml:
repos:
- repo: https://github.com/AmsterdamUMC/org-security-workflows
rev: v0.2.21
hooks:
- id: check-forbidden-filetypes
stages: [pre-commit]
- id: check-forbidden-filetypes-prepush
stages: [pre-push]
- id: check-personal-info
stages: [pre-commit]
- id: check-personal-info-prepush
stages: [pre-push]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: ['--maxkb=100']
- id: check-merge-conflictInstall the hooks:
pip install pre-commit
pre-commit install
pre-commit install --hook-type pre-push===============================================================
ERROR: Forbidden file types detected!
===============================================================
The following files match forbidden data patterns:
X data/patients.csv
These file types are blocked to prevent accidental data leaks.
If this is a false positive, contact your data steward.
To bypass (NOT recommended): git commit --no-verify
The workflow fails with a red X and annotates the problematic files. Pull requests cannot be merged until the violation is resolved.
When a violation is detected:
- The workflow fails
- A security alert is sent to the
security-telemetryrepository - An issue may be created for tracking
- The security team is notified
When GitHub Actions detect violations, they send telemetry to the security-telemetry repository via repository dispatch:
{
"event_type": "security_alert",
"client_payload": {
"repository": "AmsterdamUMC/example-repo",
"status": "fail",
"actor": "username",
"sha": "abc123...",
"ref": "refs/heads/main",
"timestamp": "2024-01-15T10:30:00Z",
"run_id": "12345678",
"blocked_files": ["data.csv", "secrets.env"]
}
}This enables centralized monitoring and alerting across all organization repositories.
If the repository is public, immediately make it private and contact your data steward.
To remove files from Git history:
# Install git-filter-repo (recommended over filter-branch)
pip install git-filter-repo
# Remove a specific file from all history
git filter-repo --path data/patients.csv --invert-paths
# Force push (coordinate with collaborators first)
git push --force --allSee GitHub's guide on removing sensitive data for detailed instructions.
If sensitive data may have been exposed:
- Do not open a public GitHub issue
- Contact b.vandervelde@amsterdamumc.nl immediately
- Include: repository name, what was exposed, when it was committed
pre-commit install
pre-commit install --hook-type pre-pushpre-commit clean
pre-commit autoupdate
pre-commit install
pre-commit install --hook-type pre-pushgit commit --no-verify
git push --no-verifyBypassing local hooks does not bypass GitHub Actions. Violations will still be caught on push.
# Create a test file
echo "test" > test.csv
# Try to add it (should be blocked by .gitignore if using template)
git add test.csv
# Force add to bypass .gitignore
git add -f test.csv
# Try to commit (should be blocked by pre-commit)
git commit -m "test"
# Clean up
git reset HEAD test.csv
rm test.csvPre-commit hooks require a Unix-like shell. On Windows:
- Install Git Bash from https://gitforwindows.org/
- In GitHub Desktop: File > Options > Git > Shell > select "Git Bash"
Alternatively, use Git Bash or WSL directly for committing.
Edit central-gitignore.txt and commit. Changes take effect:
- Immediately for new workflow runs
- On next
pre-commit autoupdatefor local hooks
Update files in personal-info-lists/ to add or remove name patterns.
Edit gitleaks.toml to modify detection rules or allowlists.
When making changes:
- Update the relevant configuration files
- Test thoroughly in a non-production repository
- Create a new version tag (e.g.,
v0.2.22) - Update documentation to reference the new version
Repositories using @main receive changes immediately. Repositories pinned to a version tag must update their .pre-commit-config.yaml to receive changes.
| Repository | Purpose |
|---|---|
org-security-workflows |
Security rules and hooks (this repo) |
org-security-scanner |
Organization-wide scanning for violations |
security-telemetry |
Central alerting and logging |
repo-template-secure |
Template for new research repositories |
MIT License - See LICENSE
Technical issues: b.vandervelde@amsterdamumc.nl False positives: Open an issue in this repository Security incidents: See Remediation section above