https://github.com/aboutcode-org/purlvalidator-go
Offline Package URL validator using a prebuilt FST of known packages.
https://github.com/aboutcode-org/purlvalidator-go
airgapped fst packageurl purl sbom-tool
Last synced: 12 days ago
JSON representation
Offline Package URL validator using a prebuilt FST of known packages.
- Host: GitHub
- URL: https://github.com/aboutcode-org/purlvalidator-go
- Owner: aboutcode-org
- License: apache-2.0
- Created: 2025-11-12T15:37:51.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-03-26T01:49:28.000Z (23 days ago)
- Last Synced: 2026-03-26T07:05:36.520Z (23 days ago)
- Topics: airgapped, fst, packageurl, purl, sbom-tool
- Language: Go
- Homepage: https://pkg.go.dev/github.com/aboutcode-org/purlvalidator-go
- Size: 1.06 GB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# purlvalidator
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/aboutcode-org/purlvalidator-go/releases)
[](https://github.com/aboutcode-org/purlvalidator-go/actions)
**purlvalidator** is a Go library for validating [Package-URLs (PURLs)](https://github.com/package-url/purl-spec). It works fully offline, including in **air-gapped** or **restricted environments**, and answers one key question: **Does the package this PURL represents actually exist?**
## How It Works?
**purlvalidator** is shipped with a pre-built FST (Finite State Transducer), a set of compact automata containing latest Package-URLs mined by the MineCode[^1]. Library uses this FST to perform lookups and confirm whether the **base PURL**[^2] exists.
## Currently Supported Ecosystems
- **apk**
- **cargo**
- **composer**
- **conan**
- **cpan**
- **cran**
- **debain**
- **maven**
- **npm**
- **nuget**
- **pypi**
- **swift**
## Usage
Add `purlvalidator` as dependency in your go.mod
```bash
require github.com/aboutcode-org/purlvalidator-go v1.0.0
```
Use it in your code like this:
```go
import "github.com/aboutcode-org/purlvalidator-go"
func main() {
result, e := purlvalidator.Validate("pkg:nuget/FluentValidation");
if err != nil {
panic(err)
}
}
```
Examples and errors:
```go
// This will return: true
purlvalidator.Validate("pkg:nuget/FluentValidation");
// This will return: false
purlvalidator.Validate("pkg:nuget/non-existent-foo-bar");
// This will return an error: "only base PURL is supported (no version, qualifiers, or subpath)"
purlvalidator.Validate("pkg:nuget/FluentValidation@10.2.3");
// This will return an error: "purl scheme is not \"pkg\": \"test\""
purlvalidator.Validate("test:nuget/FluentValidation");
```
## How to get latest Package-URL data?
A patch release is published daily with the latest FST generated from newly mined package-urls.
## Contribution
We welcome contributions from the community! If you find a bug or have an idea for a new feature, please open an issue on the GitHub repository. If you want to contribute code, you can fork the repository, make your changes, and submit a pull request.
* Please try to write a good commit message, see [good commit message wiki](https://aboutcode.readthedocs.io/en/latest/contributing/writing_good_commit_messages.html).
* Add DCO `Sign Off` to your commits.
## Development Setup
Run these commands, starting from a git clone of [https://github.com/aboutcode-org/purlvalidator-go.git](https://github.com/aboutcode-org/purlvalidator-go.git)
Generate FST:
```bash
make build-fst
```
Run tests:
```bash
make test
```
Fix formatting and linting:
```bash
make valid
```
## License
SPDX-License-Identifier: Apache-2.0
purl-validator is licensed under Apache License version 2.0.
```text
You may not use this software except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
[^1]: MineCode continuously collects package metadata from various package ecosystems to maintain an up-to-date catalog of known packages.
[^2]: A Base Package-URL is a Package-URL without a version, qualifiers or subpath.