# GHSA-j4g3-3q8x-jxqp: dbt-core's secret env vars written to package-lock.json in plaintext

> dbt-core leaks Personal Access Tokens in plaintext within package-lock.yml when pulling from private repositories, exposing credentials to anyone with file access.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 8 Dec 2023

## What is GHSA-j4g3-3q8x-jxqp?

GHSA-j4g3-3q8x-jxqp is a vulnerability in dbt-core, published on 8 Dec 2023. 

### Official description

### Impact

When used to pull source code from a private repository using a Personal Access Token (PAT), some versions of dbt-core write a URL with the PAT in plaintext to the `package-lock.yml` file.

### Patches

The bug has been fixed in [dbt-core v1.7.3](https://github.com/dbt-labs/dbt-core/releases/tag/v1.7.3).

### Mitigations

Remove any git URLs with plaintext secrets from `package-lock.yml` file(s) on servers, workstations, or in source control. Rotate any tokens that have been written to version-controlled files.

## Which versions are affected by GHSA-j4g3-3q8x-jxqp?

2 open source packages ship an affected version, including dbt-core.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `dbt-core` | PyPI | From 1.7.0 | 1.7.3 |
| `dbt-core` | PyPI | From 1.7.0 | 1.7.3 |

## How do I fix GHSA-j4g3-3q8x-jxqp?

Upgrade dbt-core to 1.7.3 or later.

## Is GHSA-j4g3-3q8x-jxqp being exploited?

There is no known exploitation of GHSA-j4g3-3q8x-jxqp in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-j4g3-3q8x-jxqp and fix it if it is affected.

What it is: GHSA-j4g3-3q8x-jxqp is a vulnerability in dbt-core, published on 8 Dec 2023. 
Exploitation: There is no known exploitation of GHSA-j4g3-3q8x-jxqp in the wild and no public exploit code.

Affected packages and fixed versions:
- dbt-core (PyPI): affected from 1.7.0; fixed in 1.7.3
- dbt-core (PyPI): affected from 1.7.0; fixed in 1.7.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-j4g3-3q8x-jxqp/ (Markdown: https://insights.sbomify.com/GHSA-j4g3-3q8x-jxqp/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-j4g3-3q8x-jxqp

---
From sbomify Insights: https://insights.sbomify.com/GHSA-j4g3-3q8x-jxqp/
Summaries are generated and may contain mistakes; the official description above is the record.
