# Julia

Point Julia's Pkg at the Package Firewall's Pkg server and authenticate it with a bearer token.

| | |
|---|---|
| Pkg server | `https://packages.vulnes.is/julia` |
| Ecosystem ID | `julia` |
| Plan | Add-on |
| Mode | gate: `/registries` is streamed unchanged; `/registry`, `/package` and `/artifact` tarballs are checked |
| Cooldown | no |
| Default mirror | `https://pkg.julialang.org` |
| Automatic setup | none: `vulnetix package-firewall julia` exits 1 |

## Configuration

Set the server before Julia starts:

```bash
export JULIA_PKG_SERVER="https://packages.vulnes.is/julia"
```

Pkg sends the `access_token` from the server's `auth.toml` as a bearer token, and the firewall accepts a bearer token of `base64("<orgUUID>:<apiKey>")`. Write it to the depot's server directory, which is named after the server host:

```bash
mkdir -p ~/.julia/servers/packages.vulnes.is
TOKEN=$(printf '%s:%s' "$VULNESIS_ORG_ID" "$VULNESIS_API_KEY" | base64 -w0)
printf 'access_token = "%s"\n' "$TOKEN" > ~/.julia/servers/packages.vulnes.is/auth.toml
chmod 600 ~/.julia/servers/packages.vulnes.is/auth.toml
```

This file was derived from the proxy's accepted header forms. Pkg has no CLI writer for it yet, so confirm with the commands below before relying on it in CI.

## Use and verify

```julia
using Pkg
Pkg.Registry.update()
Pkg.add("Example")
```

## Curation keys

Julia requests name packages by UUID and versions by git tree hash, so the firewall evaluates and logs them that way. An allow or deny entry for Julia uses the package UUID (for example `7876af07-990d-54b4-ab0e-23690620f79a` for Example.jl), not the package name. Generic artifacts are keyed as `_artifact`.
