opentaint
OpenTaint skills extend built-in security rules and code models for your dependencies and frameworks, then find vulnerabilities with whole-program static taint analysis
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/seqra/opentaint with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/seqra/opentaint'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/seqra--opentaint)HTML
<a href="/listings/seqra--opentaint"><img src="/api/listings/seqra--opentaint/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
These steps run a script from the network that findsafeskills does not scan.
**Install script (Linux/macOS)**
curl -fsSL https://opentaint.org/install.sh | bash
**Install via Homebrew (Linux/macOS):**
brew install --cask seqra/tap/opentaint
**Install script (Windows PowerShell)**
irm https://opentaint.org/install.ps1 | iex
**Install via npm (Linux/macOS/Windows):**
npm install -g @seqra/opentaint
**Or run instantly with npx — no install required (needs Node.js):**
npx @seqra/opentaint scan
**Scan your project:**
opentaint scan
**Or use Docker:**
docker run --rm -v $(pwd):/project -v $(pwd):/output \ ghcr.io/seqra/opentaint:latest \ opentaint scan --output /output/results.sarif /project
For more options, see [Installation](docs/README.md#installation) and [Usage](docs/README.md#usage).
---
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/marketplace.json · Manifest · 24 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- {
- "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
- "name": "opentaint",
- "description": "OpenTaint skills extend built-in security rules and code models for your dependencies and frameworks, then find vulnerabilities with whole-program static taint analysis",
- "owner": {
- "name": "Seqra",
- "url": "https://opentaint.org/"
- },
- "plugins": [
- {
- "name": "appsec-workflow",
- "source": "./",
- "description": "Find application-specific vulnerabilities with whole-program static taint analysis and write rules and dependency models for future scans",
- "version": "0.3.0",
- "author": {
- "name": "Seqra"
- },
- "license": "Apache-2.0",
- "category": "security",
- "homepage": "https://opentaint.org/",
- "repository": "https://github.com/seqra/opentaint"
- }
- ]
- }
README.md · README · 223 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="logos/opentaint-logo-dark.svg">
- <source media="(prefers-color-scheme: light)" srcset="logos/opentaint-logo-light.svg">
- <img src="logos/opentaint-logo-light.svg" alt="OpenTaint" height="100">
- </picture>
- </p>
- <h3 align="center">The open source taint analysis engine for the AI era</h3>
- <p align="center">
- Formal taint analysis for application security — finds what AST-pattern matchers miss, lets LLM agents enact rules from vulnerabilities, scales where neither can alone.
- </p>
- <p align="center">
- <a href="https://github.com/seqra/opentaint/releases"><img src="https://img.shields.io/github/release/seqra/opentaint.svg" alt="GitHub release"></a>
- <a href="LICENSE.md"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
- <a href="https://golang.org/"><img src="https://img.shields.io/badge/Go-1.25+-00ADD8?logo=go" alt="Go Version"></a>
- <a href="https://discord.gg/6BXDfbP4p9"><img src="https://img.shields.io/discord/1403357427176575036?logo=discord&label=Discord" alt="Discord"></a>
- </p>
- <p align="center">
- <a href="README.md">English</a> | <a href="docs/translations/README.zh.md">简体中文</a> | <a href="docs/translations/README.zht.md">繁體中文</a> | <a href="docs/translations/README.ko.md">한국어</a> | <a href="docs/translations/README.de.md">Deutsch</a> | <a href="docs/translations/README.es.md">Español</a> | <a href="docs/translations/README.fr.md">Français</a> | <a href="docs/translations/README.it.md">Italiano</a> | <a href="docs/translations/README.da.md">Dansk</a> | <a href="docs/translations/README.ja.md">日本語</a> | <a href="docs/translations/README.pl.md">Polski</a> | <a href="docs/translations/README.ru.md">Русский</a> | <a href="docs/translations/README.bs.md">Bosanski</a> | <a href="docs/translations/README.ar.md">العربية</a> | <a href="docs/translations/README.no.md">Norsk</a> | <a href="docs/translations/README.sv.md">Svenska</a> | <a href="docs/translations/README.br.md">Português (Brasil)</a> | <a href="docs/translations/README.th.md">ไทย</a> | <a href="docs/translations/README.tr.md">Türkçe</a> | <a href="docs/translations/README.ua.md">Українська</a> | <a href="docs/translations/README.bn.md">বাংলা</a> | <a href="docs/translations/README.hi.md">हिन्दी</a> | <a href="docs/translations/README.gr.md">Ελληνικά</a> | <a href="docs/translations/README.vi.md">Tiếng Việt</a> | <a href="docs/translations/README.id.md">Bahasa Indonesia</a>
- </p>
- <p align="center">
- <a href="http://opentaint.org/">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-demo-dark.gif">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-demo-light.gif">
- <img src="public/opentaint-demo-light.gif" alt="OpenTaint taint analysis demo">
- </picture>
- </a>
- </p>
- <p align="center"><b>Supported technologies and integrations</b></p>
- <p align="center">
- <img src="logos/java-logo.svg" alt="Java" height="60">
- <img src="logos/kotlin-logo.svg" alt="Kotlin" height="60">
- <img src="logos/spring-boot-logo.svg" alt="Spring" height="60">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="logos/github-logo-dark.svg">
- <source media="(prefers-color-scheme: light)" srcset="logos/github-logo-light.svg">
- <img src="logos/github-logo-light.svg" alt="GitHub" height="60">
- </picture>
- <img src="logos/gitlab-logo.svg" alt="GitLab" height="60">
- </p>
- <p align="center"><i>The most thorough taint analysis engine for Spring apps</i></p>
- <p align="center"><b>Roadmap</b></p>
- <p align="center">
- <img src="logos/python-logo.svg" alt="Python" height="60">
- <img src="logos/go-logo.svg" alt="Go" height="60">
- <img src="logos/csharp-logo.svg" alt="C#" height="60">
- <img src="logos/javascript-logo.svg" alt="JavaScript" height="60">
- <img src="logos/typescript-logo.svg" alt="TypeScript" height="60">
- </p>
- <div align="center">
- <details>
- <summary><b>More screenshots</b></summary>
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-frame-dark-1.png">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-frame-light-1.png">
- <img src="public/opentaint-frame-light-1.png" alt="OpenTaint scan output">
- </picture>
- </p>
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-frame-dark-2.png">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-frame-light-2.png">
- <img src="public/opentaint-frame-light-2.png" alt="OpenTaint summary output">
- </picture>
- </p>
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-frame-dark-3.png">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-frame-light-3.png">
- <img src="public/opentaint-frame-light-3.png" alt="OpenTaint summary output">
- </picture>
- </p>
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-frame-dark-4.png">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-frame-light-4.png">
- <img src="public/opentaint-frame-light-4.png" alt="OpenTaint summary output">
- </picture>
- </p>
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="public/opentaint-frame-dark-5.png">
- <source media="(prefers-color-scheme: light)" srcset="public/opentaint-frame-light-5.png">
- <img src="public/opentaint-frame-light-5.png" alt="OpenTaint summary output">
- </picture>
- </p>
- </details>
- </div>
- ---
- ## Why OpenTaint?
- > OpenTaint is an open-source alternative to *Semgrep Pro* and *CodeQL* — a formal inter-procedural taint engine you can customize and self-host, built so AI agents drive your security analysis without burning tokens on every scan.
- AI generates production code faster than security teams can keep up with, and the two kinds of tooling built to catch what it gets wrong each force a bad trade-off:
- - **AST-pattern matchers** (Semgrep OSS, ast-grep, linters) are free and fast, but they match syntax, not data flow — untrusted input that crosses a function boundary or a persistence layer slips right past. The deeper, inter-procedural analysis that *does* catch it has long been locked inside proprietary tools.
- - **LLM security agents** find what pattern matchers miss, but they re-read your code on every run. The tokens add up with every file, every commit, every CI build — and a probabilistic model still can't promise it caught everything.
- OpenTaint gives you the depth of an LLM agent at the cost of a static analyzer:
- - **Find what AST-pattern matchers miss.** A formal inter-procedural dataflow engine tracks untrusted data across function boundaries, persistence layers, aliases, and async code.
- - **Pay the model once, not on every scan.** Let an agent distill a single finding into a taint rule. The deterministic engine then replays that rule across the entire codebase — and every commit after it — in minutes of CPU, at zero token cost.
- - **Open source, batteries included.** Engine, rules, and CI integrations come as one stack under Apache 2.0 and MIT.
- ## Quick Start
- **Install script (Linux/macOS)**
- ```
- curl -fsSL https://opentaint.org/install.sh | bash
- ```
- **Install via Homebrew (Linux/macOS):**
- ```bash
- brew install --cask seqra/tap/opentaint
- ```
- **Install script (Windows PowerShell)**
- ```
- irm https://opentaint.org/install.ps1 | iex
- ```
- **Install via npm (Linux/macOS/Windows):**
- ```bash
- npm install -g @seqra/opentaint
- ```
- **Or run instantly with npx — no install required (needs Node.js):**
- ```bash
- npx @seqra/opentaint scan
- ```
- **Scan your project:**
- ```bash
- opentaint scan
- ```
- **Or use Docker:**
- ```bash
- docker run --rm -v $(pwd):/project -v $(pwd):/output \
- ghcr.io/seqra/opentaint:latest \
- opentaint scan --output /output/results.sarif /project
- ```
- For more options, see [Installation](docs/README.md#installation) and [Usage](docs/README.md#usage).
- ---
- ## AI Agent Workflows
- OpenTaint includes agent skills that turn static analysis into an end-to-end application-security workflow.
- <details>
- <summary><strong>Install for Codex</strong></summary>
- ```bash
- codex plugin marketplace add seqra/opentaint
- codex plugin add appsec-workflow@opentaint
- ```
- </details>
- <details>
- <summary><strong>Install for Claude Code</strong></summary>
- ```bash
- claude plugin marketplace add seqra/opentaint
- claude plugin install appsec-workflow@opentaint
- ```
- </details>
- Or install the skills directly for any supported agent:
- ```bash
- npx skills add https://github.com/seqra/opentaint
- ```
- The `appsec-agent` skill orchestrates a full project assessment: build the project, run OpenTaint, discover the attack surface, add targeted rules, model missing library data flows, triage findings, and optionally generate dynamic proof-of-concept checks for confirmed vulnerabilities.
- Included skills cover the common security-analysis loop:
- - **Scan and triage:** `build-project`, `run-scan`, `analyze-findings`, `generate-poc`
- - **Coverage expansion:** `triage-dependencies`, `discover-attack-surface`, `create-test-project`, `create-rule`, `assemble-lib-rules`
- - **Dataflow modeling:** `analyze-external-methods`, `create-pass-through-model`, `create-dataflow-model`, `debug-rule`, `report-analyzer-issue`
- ---
- ## Documentation
- Full guides — installation, usage, configuration, CI/CD integration: **[Documentation](docs/README.md)**.
- ## Support
- - **Issues:** [GitHub Issues](https://github.com/seqra/opentaint/issues)
- - **Community:** [Discord](https://discord.gg/6BXDfbP4p9)
- - **Email:** [seqradev@gmail.com](mailto:seqradev@gmail.com)
- ## Star History
- <a href="https://github.com/seqra/opentaint/stargazers">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="https://github.com/seqra/opentaint/releases/download/star-history/latest/star-history-dark.png" />
- <source media="(prefers-color-scheme: light)" srcset="https://github.com/seqra/opentaint/releases/download/star-history/latest/star-history-light.png" />
- <img alt="Star History Chart" src="https://github.com/seqra/opentaint/releases/download/star-history/latest/star-history-light.png" width="900" />
- </picture>
- </a>
- ## License
- The [core analysis engine](core/) is released under the [Apache 2.0 License](LICENSE.md). The [CLI](cli/), [GitHub Action](github/), [GitLab CI template](gitlab/), and [rules](rules/) are released under the [MIT License](cli/LICENSE).
scripts/install/install.ps1 · Bundled script · 266 lines · 1 finding marked
- # OpenTaint installer for Windows (PowerShell)
- # Usage:
- # irm https://raw.githubusercontent.com/seqra/opentaint/main/scripts/install/install.ps1 | iex
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 3 on GitHub
- # & ([scriptblock]::Create((irm .../install.ps1))) -Version v0.4.5 # exact version ('v' optional)
- # & ([scriptblock]::Create((irm .../install.ps1))) -Version v0 # newest v0.x.y
- # & ([scriptblock]::Create((irm .../install.ps1))) -Version v0.4 # newest v0.4.x
- param(
- [string]$Version = "latest"
- )
- $ErrorActionPreference = 'Stop'
- $Repo = if ($env:OPENTAINT_REPOSITORY) { $env:OPENTAINT_REPOSITORY } else { "seqra/opentaint" }
- # Resolves a floating major/minor selector (e.g. v0 or v0.2) to the newest
- # matching exact vX.Y.Z release tag via the GitHub releases API. Only exact
- # vX.Y.Z tags are considered, mirroring scripts/resolve_opentaint_version.py.
- function Resolve-FloatingSelector {
- param(
- [string]$Selector # e.g. v0 or v0.2
- )
- $headers = @{ "Accept" = "application/vnd.github+json" }
- $token = if ($env:OPENTAINT_GITHUB_TOKEN) { $env:OPENTAINT_GITHUB_TOKEN } elseif ($env:GITHUB_TOKEN) { $env:GITHUB_TOKEN } else { $null }
- if ($token) { $headers["Authorization"] = "Bearer $token" }
- $releases = @()
- $page = 1
- while ($true) {
- $apiUrl = "https://api.github.com/repos/$Repo/releases?per_page=100&page=$page"
- try {
- $pageReleases = @(Invoke-RestMethod -Uri $apiUrl -Headers $headers -UseBasicParsing)
- } catch {
- [Console]::Error.WriteLine("Error: failed to query the GitHub releases API to resolve '$Selector'.")
- exit 2
- }
- $releases += $pageReleases
- if ($pageReleases.Count -lt 100) { break }
- $page++
- }
- # v0 must match v0.*, not v0.* only after a dot boundary; the trailing dot
- # ensures v1 does not match v10.x and v0.1 does not match v0.10.x.
- $prefix = "$Selector."
- $best = $null
- foreach ($release in $releases) {
- $tag = $release.tag_name
- if ($tag -notmatch '^v[0-9]+\.[0-9]+\.[0-9]+$') { continue }
- if (-not $tag.StartsWith($prefix)) { continue }
- $ver = [version]($tag.Substring(1))
- if (-not $best -or $ver -gt $best.Ver) {
- $best = @{ Ver = $ver; Tag = $tag }
- }
- }
- if (-not $best) {
- [Console]::Error.WriteLine("Error: no release found matching selector '$Selector'.")
- exit 2
- }
- return $best.Tag
- }
- function Test-Version {
- param([string]$Raw)
- if (-not $Raw -or $Raw -eq "latest") {
- return @{ PathSegment = "latest/download"; Tag = "latest" }
- }
- if ($Raw -match '^(v)?(?<ver>[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._-]+)?)$') {
- $normalized = $Matches['ver']
- return @{ PathSegment = "download/v$normalized"; Tag = "v$normalized" }
- }
- if ($Raw -match '^(v)?(?<ver>[0-9]+\.[0-9]+)$') {
- $selector = "v$($Matches['ver'])"
- Write-Host "Resolving $selector to an exact release..."
- $tag = Resolve-FloatingSelector -Selector $selector
- return @{ PathSegment = "download/$tag"; Tag = $tag }
- }
- if ($Raw -match '^(v)?(?<ver>[0-9]+)$') {
- $selector = "v$($Matches['ver'])"
- Write-Host "Resolving $selector to an exact release..."
- $tag = Resolve-FloatingSelector -Selector $selector
- return @{ PathSegment = "download/$tag"; Tag = $tag }
- }
- [Console]::Error.WriteLine("Error: Invalid version '$Raw'. Expected 'latest', 'X', 'X.Y', or 'X.Y.Z' (optionally prefixed with 'v').")
- exit 2
- }
- function Test-HomebrewInstall {
- $cmd = Get-Command opentaint -ErrorAction SilentlyContinue
- if (-not $cmd) {
- return $null
- }
- $path = $cmd.Source
- try {
- $resolved = (Resolve-Path -LiteralPath $path -ErrorAction Stop).Path
- $path = $resolved
- } catch { }
- # Patterns target POSIX-style Homebrew paths; meaningful only when pwsh runs
- # on macOS/Linux. Native Windows paths use backslashes and will not match.
- $lower = $path.ToLower()
- if ($lower -match '/cellar/' -or $lower -match '/caskroom/' -or $lower -match '/homebrew/') {
- return $path
- }
- return $null
- }
- function Get-Architecture {
- $arch = $env:PROCESSOR_ARCHITECTURE
- switch ($arch) {
- "AMD64" { return "amd64" }
- "ARM64" { return "arm64" }
- default {
- [Console]::Error.WriteLine("Error: Unsupported architecture: $arch")
- [Console]::Error.WriteLine("See https://github.com/seqra/opentaint/blob/main/docs/installation.md for alternatives.")
- exit 1
- }
- }
- }
- function Invoke-Download {
- param(
- [string]$Url,
- [string]$OutFile,
- [bool]$ShowProgress = $false
- )
- $previous = $ProgressPreference
- if (-not $ShowProgress) {
- $ProgressPreference = 'SilentlyContinue'
- }
- try {
- Invoke-WebRequest -Uri $Url -OutFile $OutFile -UseBasicParsing
- }
- finally {
- $ProgressPreference = $previous
- }
- }
- function Verify-Checksum {
- param(
- [string]$ArchivePath,
- [string]$ArchiveName,
- [string]$BaseUrl
- )
- $checksumsUrl = "$BaseUrl/checksums.txt"
- $checksumsFile = Join-Path ([System.IO.Path]::GetDirectoryName($ArchivePath)) "checksums.txt"
- Write-Host "Verifying checksum..."
- try {
- Invoke-Download -Url $checksumsUrl -OutFile $checksumsFile -ShowProgress $false
- } catch {
- Write-Warning "Could not download checksums.txt, skipping verification."
- return
- }
- $line = Get-Content $checksumsFile | Where-Object { $_ -match " $([regex]::Escape($ArchiveName))$" } | Select-Object -First 1
- if (-not $line) {
- Write-Warning "No checksum found for $ArchiveName, skipping verification."
- return
- }
- $expected = ($line -split " ")[0].ToLower()
- $actual = (Get-FileHash -Path $ArchivePath -Algorithm SHA256).Hash.ToLower()
- if ($expected -ne $actual) {
- [Console]::Error.WriteLine("Error: Checksum verification failed!")
- [Console]::Error.WriteLine(" Expected: $expected")
- [Console]::Error.WriteLine(" Actual: $actual")
- exit 1
- }
- Write-Host "Checksum verified."
- }
- function Get-InstallDir {
- if ($env:OPENTAINT_INSTALL_DIR) {
- return $env:OPENTAINT_INSTALL_DIR
- }
- return Join-Path $env:LOCALAPPDATA "opentaint"
- }
- function Main {
- $existingBrew = Test-HomebrewInstall
- if ($existingBrew -and $env:OPENTAINT_FORCE -ne "1") {
- [Console]::Error.WriteLine("Error: opentaint is already installed via Homebrew at $existingBrew.")
- [Console]::Error.WriteLine("Run 'brew upgrade --cask opentaint' to update, or set")
- [Console]::Error.WriteLine("`$env:OPENTAINT_FORCE='1' to install side-by-side anyway.")
- exit 3
- }
- $versionInfo = Test-Version -Raw $Version
- $baseUrl = if ($env:OPENTAINT_DOWNLOAD_BASE_URL) {
- $env:OPENTAINT_DOWNLOAD_BASE_URL
- } else {
- "https://github.com/$Repo/releases/$($versionInfo.PathSegment)"
- }
- $arch = Get-Architecture
- Write-Host "Architecture: $arch"
- $archiveName = "opentaint-full_windows_${arch}.zip"
- $url = "$baseUrl/$archiveName"
- $installDir = Get-InstallDir
- Write-Host "Install directory: $installDir"
- $tmpDir = Join-Path ([System.IO.Path]::GetTempPath()) "opentaint-install-$([System.Guid]::NewGuid())"
- New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
- try {
- $archivePath = Join-Path $tmpDir $archiveName
- Write-Host "Downloading $archiveName..."
- Invoke-Download -Url $url -OutFile $archivePath -ShowProgress $true
- Verify-Checksum -ArchivePath $archivePath -ArchiveName $archiveName -BaseUrl $baseUrl
- Write-Host "Extracting..."
- Expand-Archive -Path $archivePath -DestinationPath $tmpDir -Force
- Write-Host "Installing to $installDir..."
- New-Item -ItemType Directory -Path $installDir -Force | Out-Null
- $binDir = Join-Path $installDir "install"
- New-Item -ItemType Directory -Path $binDir -Force | Out-Null
- Copy-Item -Path (Join-Path $tmpDir "opentaint.exe") -Destination (Join-Path $binDir "opentaint.exe") -Force
- $libSrc = Join-Path $tmpDir "lib"
- if (Test-Path $libSrc) {
- $libDst = Join-Path $binDir "lib"
- if (Test-Path $libDst) { Remove-Item -Recurse -Force $libDst }
- Copy-Item -Recurse -Path $libSrc -Destination $libDst
- }
- $jreSrc = Join-Path $tmpDir "jre"
- if (Test-Path $jreSrc) {
- $jreDst = Join-Path $binDir "jre"
- if (Test-Path $jreDst) { Remove-Item -Recurse -Force $jreDst }
- Copy-Item -Recurse -Path $jreSrc -Destination $jreDst
- }
- $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
- if ($userPath -notlike "*$binDir*") {
- [Environment]::SetEnvironmentVariable("Path", "$binDir;$userPath", "User")
- Write-Host ""
- Write-Host "Added $binDir to user PATH."
- Write-Host "Please restart your terminal for changes to take effect."
- }
- Write-Host ""
- Write-Host "opentaint installed successfully!"
- Write-Host "OPENTAINT_BINARY_PATH=$binDir\opentaint.exe"
- Write-Host "Run 'opentaint --version' to verify the installation."
- }
- finally {
- Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
- }
- }
- Main
scripts/install/install.sh · Bundled script · 391 lines · 1 finding marked
- #!/usr/bin/env bash
- set -euo pipefail
- # OpenTaint installer for Linux and macOS
- # Usage:
- # curl -fsSL https://raw.githubusercontent.com/seqra/opentaint/main/scripts/install/install.sh | bash
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 6 on GitHub
- # curl -fsSL .../install.sh | bash -s -- v0.4.5 # exact version ('v' optional)
- # curl -fsSL .../install.sh | bash -s -- v0 # newest v0.x.y
- # curl -fsSL .../install.sh | bash -s -- v0.4 # newest v0.4.x
- REPO="${OPENTAINT_REPOSITORY:-seqra/opentaint}"
- INSTALL_DIR="${OPENTAINT_INSTALL_DIR:-}"
- DOWNLOADER=""
- # Populated by validate_version(): one of latest|exact|major|minor.
- VERSION_SELECTOR_KIND=""
- # Floating selector (e.g. v0 or v0.1) when kind is major|minor; resolved later.
- VERSION_SELECTOR=""
- # Populates VERSION_SELECTOR_KIND, VERSION_SELECTOR, VERSION_PATH_SEGMENT and
- # VERSION_TAG from the raw version argument.
- # Accepts:
- # (empty) -> latest
- # latest
- # X / vX (floating major, resolved to newest vX.Y.Z)
- # X.Y / vX.Y (floating minor, resolved to newest vX.Y.Z)
- # X.Y.Z / vX.Y.Z (exact, optionally with -suffix)
- # For floating selectors VERSION_PATH_SEGMENT is left empty and filled in later
- # by resolve_floating_selector() once a downloader is available.
- # Exits 2 on invalid input.
- validate_version() {
- local raw="${1:-latest}"
- if [ "$raw" = "latest" ] || [ -z "$raw" ]; then
- VERSION_SELECTOR_KIND="latest"
- VERSION_PATH_SEGMENT="latest/download"
- VERSION_TAG="latest"
- return
- fi
- if [[ "$raw" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._-]+)?$ ]]; then
- local normalized="${raw#v}"
- VERSION_SELECTOR_KIND="exact"
- VERSION_PATH_SEGMENT="download/v${normalized}"
- VERSION_TAG="v${normalized}"
- return
- fi
- if [[ "$raw" =~ ^v?[0-9]+\.[0-9]+$ ]]; then
- VERSION_SELECTOR_KIND="minor"
- VERSION_SELECTOR="v${raw#v}"
- VERSION_TAG="$VERSION_SELECTOR"
- return
- fi
- if [[ "$raw" =~ ^v?[0-9]+$ ]]; then
- VERSION_SELECTOR_KIND="major"
- VERSION_SELECTOR="v${raw#v}"
- VERSION_TAG="$VERSION_SELECTOR"
- return
- fi
- echo "Error: invalid version '$raw'." >&2
- echo "Expected 'latest', 'X', 'X.Y', or 'X.Y.Z' (optionally prefixed with 'v')." >&2
- exit 2
- }
- # Fetches a URL to stdout using the selected downloader. Adds a GitHub token
- # header when OPENTAINT_GITHUB_TOKEN or GITHUB_TOKEN is set (avoids API rate
- # limits). Returns non-zero on failure.
- fetch_stdout() {
- local url="$1"
- local token="${OPENTAINT_GITHUB_TOKEN:-${GITHUB_TOKEN:-}}"
- case "$DOWNLOADER" in
- curl)
- if [ -n "$token" ]; then
- curl -fsSL -H "Authorization: Bearer $token" "$url"
- else
- curl -fsSL "$url"
- fi
- ;;
- wget)
- if [ -n "$token" ]; then
- wget -qO- --header="Authorization: Bearer $token" "$url"
- else
- wget -qO- "$url"
- fi
- ;;
- *)
- return 1
- ;;
- esac
- }
- # Resolves a floating major/minor selector (e.g. v0 or v0.1) to the newest
- # matching exact vX.Y.Z release tag by querying the GitHub releases API. Only
- # exact vX.Y.Z tags are considered (floating and prefixed tags are ignored),
- # mirroring scripts/resolve_opentaint_version.py. Prints the resolved tag.
- resolve_floating_selector() {
- local selector="$1"
- local page=1
- local bodies=""
- while true; do
- local api_url="https://api.github.com/repos/${REPO}/releases?per_page=100&page=${page}"
- local body
- if ! body="$(fetch_stdout "$api_url")"; then
- echo "Error: failed to query the GitHub releases API to resolve '$selector'." >&2
- exit 2
- fi
- if [[ "$body" =~ ^[[:space:]]*\[[[:space:]]*\][[:space:]]*$ ]]; then
- break
- fi
- bodies+=$'\n'"$body"
- page=$((page + 1))
- done
- # Match e.g. ^v0\. (major) or ^v0\.1\. (minor) against vX.Y.Z tags.
- local pattern
- if [ "$VERSION_SELECTOR_KIND" = "minor" ]; then
- pattern="^${selector//./\\.}\\."
- else
- pattern="^${selector}\\."
- fi
- local best
- best="$(printf '%s' "$bodies" \
- | grep -oE '"tag_name"[[:space:]]*:[[:space:]]*"v[0-9]+\.[0-9]+\.[0-9]+"' \
- | sed -E 's/.*"(v[0-9]+\.[0-9]+\.[0-9]+)"$/\1/' \
- | grep -E "$pattern" \
- | sed 's/^v//' \
- | sort -t. -k1,1n -k2,2n -k3,3n \
- | tail -1 || true)"
- if [ -z "$best" ]; then
- echo "Error: no release found matching selector '$selector'." >&2
- exit 2
- fi
- echo "v${best}"
- }
- # Prints the resolved path of an existing opentaint binary if it appears to
- # belong to a Homebrew installation (mirrors cli/internal/utils/updater.go
- # classification). Prints nothing otherwise.
- detect_homebrew_install() {
- if ! command -v opentaint >/dev/null 2>&1; then
- return 0
- fi
- local path resolved
- path="$(command -v opentaint)"
- # Resolve symlinks so we can compare against the real location.
- # readlink -f is GNU-only; fall back to realpath on macOS/BSD.
- if resolved="$(readlink -f "$path" 2>/dev/null)" && [ -n "$resolved" ]; then
- path="$resolved"
- elif resolved="$(realpath "$path" 2>/dev/null)" && [ -n "$resolved" ]; then
- path="$resolved"
- fi
- case "$(printf '%s' "$path" | tr '[:upper:]' '[:lower:]')" in
- */cellar/*|*/caskroom/*|*/homebrew/*)
- echo "$path"
- ;;
- esac
- }
- pick_downloader() {
- if command -v curl >/dev/null 2>&1; then
- DOWNLOADER="curl"
- return
- fi
- if command -v wget >/dev/null 2>&1; then
- DOWNLOADER="wget"
- return
- fi
- echo "Error: curl or wget is required but neither is installed." >&2
- echo "Install curl or wget and re-run the installer." >&2
- exit 1
- }
- download() {
- local url="$1"
- local output="$2"
- local progress="${3:-0}"
- case "$DOWNLOADER" in
- curl)
- if [ "$progress" = "1" ]; then
- curl -fSL --progress-bar -o "$output" "$url"
- else
- curl -fsSL -o "$output" "$url"
- fi
- ;;
- wget)
- if [ "$progress" = "1" ]; then
- wget --show-progress --progress=bar:force:noscroll -q -O "$output" "$url"
- else
- wget -q -O "$output" "$url"
- fi
- ;;
- *)
- echo "Error: no downloader configured." >&2
- exit 1
- ;;
- esac
- }
- detect_platform() {
- local os arch
- os="$(uname -s)"
- case "$os" in
- Linux) os="linux" ;;
- Darwin) os="darwin" ;;
- *)
- echo "Error: Unsupported operating system: $os" >&2
- echo "See https://github.com/seqra/opentaint/blob/main/docs/installation.md for alternatives." >&2
- exit 1
- ;;
- esac
- arch="$(uname -m)"
- case "$arch" in
- x86_64|amd64) arch="amd64" ;;
- arm64|aarch64) arch="arm64" ;;
- *)
- echo "Error: Unsupported architecture: $arch" >&2
- echo "See https://github.com/seqra/opentaint/blob/main/docs/installation.md for alternatives." >&2
- exit 1
- ;;
- esac
- # Rosetta-2: a shell running as amd64 under Rosetta on Apple Silicon
- # should download the native arm64 archive instead.
- if [ "$os" = "darwin" ] && [ "$arch" = "amd64" ]; then
- if [ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]; then
- arch="arm64"
- fi
- fi
- echo "${os}_${arch}"
- }
- verify_checksum() {
- local archive_path="$1"
- local archive_name="$2"
- local checksums_url="${DOWNLOAD_BASE_URL}/checksums.txt"
- echo "Verifying checksum..."
- if ! download "$checksums_url" "$tmp_dir/checksums.txt" 2>/dev/null; then
- echo "Warning: Could not download checksums.txt, skipping verification." >&2
- return 0
- fi
- local expected
- expected="$(grep " ${archive_name}$" "$tmp_dir/checksums.txt" | awk '{print $1}')"
- if [ -z "$expected" ]; then
- echo "Warning: No checksum found for ${archive_name}, skipping verification." >&2
- return 0
- fi
- local actual
- if command -v sha256sum >/dev/null 2>&1; then
- actual="$(sha256sum "$archive_path" | awk '{print $1}')"
- elif command -v shasum >/dev/null 2>&1; then
- actual="$(shasum -a 256 "$archive_path" | awk '{print $1}')"
- else
- echo "Warning: No SHA256 tool found, skipping verification." >&2
- return 0
- fi
- if [ "$expected" != "$actual" ]; then
- echo "Error: Checksum verification failed!" >&2
- echo " Expected: $expected" >&2
- echo " Actual: $actual" >&2
- exit 1
- fi
- echo "Checksum verified."
- }
- get_install_dir() {
- if [ -n "$INSTALL_DIR" ]; then
- echo "$INSTALL_DIR"
- return
- fi
- if [ "$(id -u)" = "0" ]; then
- echo "/usr/local/lib/opentaint"
- else
- echo "$HOME/.opentaint/install"
- fi
- }
- main() {
- local platform archive_name url install_dir bin_dir
- validate_version "${1:-}"
- pick_downloader
- local existing_brew
- existing_brew="$(detect_homebrew_install)"
- if [ -n "$existing_brew" ] && [ "${OPENTAINT_FORCE:-0}" != "1" ]; then
- echo "Error: opentaint is already installed via Homebrew at $existing_brew" >&2
- echo "Run 'brew upgrade --cask opentaint' to update, or set" >&2
- echo "OPENTAINT_FORCE=1 to install side-by-side anyway." >&2
- exit 3
- fi
- # Floating major/minor selectors are resolved to an exact tag, unless the
- # caller already pinned a fully-resolved download base URL (e.g. CI).
- if [ -z "${OPENTAINT_DOWNLOAD_BASE_URL:-}" ] && \
- { [ "$VERSION_SELECTOR_KIND" = "major" ] || [ "$VERSION_SELECTOR_KIND" = "minor" ]; }; then
- echo "Resolving ${VERSION_SELECTOR} to an exact release..."
- local resolved_tag
- resolved_tag="$(resolve_floating_selector "$VERSION_SELECTOR")"
- VERSION_PATH_SEGMENT="download/${resolved_tag}"
- VERSION_TAG="$resolved_tag"
- fi
- DOWNLOAD_BASE_URL="${OPENTAINT_DOWNLOAD_BASE_URL:-https://github.com/${REPO}/releases/${VERSION_PATH_SEGMENT}}"
- echo "Version: $VERSION_TAG"
- echo "Detecting platform..."
- platform="$(detect_platform)"
- echo "Platform: $platform"
- archive_name="opentaint-full_${platform}.tar.gz"
- url="${DOWNLOAD_BASE_URL}/${archive_name}"
- install_dir="$(get_install_dir)"
- echo "Install directory: $install_dir"
- tmp_dir="$(mktemp -d)"
- trap 'rm -rf "$tmp_dir"' EXIT
- echo "Downloading ${archive_name}..."
- download "$url" "$tmp_dir/$archive_name" 1
- verify_checksum "$tmp_dir/$archive_name" "$archive_name"
- echo "Extracting..."
- tar -xzf "$tmp_dir/$archive_name" -C "$tmp_dir"
- echo "Installing to $install_dir..."
- mkdir -p "$install_dir"
- cp "$tmp_dir/opentaint" "$install_dir/opentaint"
- chmod +x "$install_dir/opentaint"
- # Install bundled lib and jre if present (next to the binary)
- if [ -d "$tmp_dir/lib" ]; then
- mkdir -p "$install_dir/lib"
- cp -r "$tmp_dir/lib/"* "$install_dir/lib/"
- fi
- if [ -d "$tmp_dir/jre" ]; then
- mkdir -p "$install_dir/jre"
- cp -r "$tmp_dir/jre/"* "$install_dir/jre/"
- fi
- # For root installs, symlink into /usr/local/bin so the binary is in PATH
- # while keeping lib/jre next to the actual binary for bundled path resolution
- bin_dir="$install_dir"
- if [ "$(id -u)" = "0" ] && [ -z "$INSTALL_DIR" ]; then
- ln -sf "$install_dir/opentaint" /usr/local/bin/opentaint
- bin_dir="/usr/local/bin"
- fi
- echo ""
- echo "opentaint installed successfully!"
- echo ""
- echo "OPENTAINT_BINARY_PATH=$bin_dir/opentaint"
- echo ""
- # Check if bin_dir is in PATH
- case ":$PATH:" in
- *":$bin_dir:"*)
- echo "Run 'opentaint --version' to verify the installation."
- ;;
- *)
- echo "Add the following to your shell profile to use opentaint:"
- echo ""
- echo " export PATH=\"$bin_dir:\$PATH\""
- echo ""
- echo "Then restart your shell or run the export command above."
- ;;
- esac
- }
- main "$@"
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.