Skip to content

chore(deps): patch runtime security vulns and fix flaky username test - #50

Merged
diangogav merged 2 commits into
mainfrom
chore/deps-security-and-flaky-test
Jun 19, 2026
Merged

chore(deps): patch runtime security vulns and fix flaky username test#50
diangogav merged 2 commits into
mainfrom
chore/deps-security-and-flaky-test

Conversation

@diangogav

Copy link
Copy Markdown
Owner

Summary

  • Patch runtime security vulnerabilities: bun audit drops from 50 to 21
    findings, eliminating every high/critical runtime CVE (axios, form-data,
    follow-redirects, elysia, file-type).
  • Fix a pre-existing flaky test in UserUsernameUpdater caused by
    UserMother generating domain-invalid usernames.

Security changes

The worst CVEs (axios prototype pollution, SSRF, credential leaks) reached the
tree transitively through @sendgrid/mail. A plain bun update left the
vulnerable nested copies in place and promoted transitives to direct deps, so
this uses a package.json overrides block to force patched versions across
the whole tree without polluting direct dependencies. SendGrid pins axios
^1.12.0, so 1.18.0 stays within its contract — no breakage.

Package Before After How
elysia 1.4.23 1.4.29 direct bump
axios 1.13.5 1.18.0 override
form-data 4.0.5 4.0.6 override
follow-redirects 1.15.11 1.16.0 override

The remaining 21 findings are dev-only tooling (eslint / commitlint /
lint-staged) plus low-impact transitives where forcing overrides would risk
breaking typeorm/svix for near-zero real gain.

Test fix

UserMother built users via User.from() (no validation) with
faker.internet.username(), which often exceeds the domain's 14-char username
limit. The "keep own username" test fed that value into updateUsername()
which does validate length and threw — so the test failed ~50% of runs.
Switched to faker.string.sample({ min: 1, max: 14 }), matching the pattern
already used by UserUsernameUpdaterRequestMother.

Changes

File Change
package.json bump elysia + new overrides block
bun.lock regenerated, deduped vulnerable nested copies
tests/unit/modules/users/mothers/UserMother.ts domain-valid username generation

Test plan

  • bun audit — 50 → 21 findings, no runtime high/critical left
  • bun test — 244 pass / 0 fail
  • Flaky test stress: 20 consecutive runs, 0 failures

Bump elysia to ^1.4.29 and force patched axios (^1.18.0), form-data
(^4.0.6) and follow-redirects (^1.16.0) through a package.json
"overrides" block.

The critical CVEs (axios prototype pollution, SSRF and credential
leaks) reached the tree transitively via @sendgrid/mail. Overrides
dedupe the vulnerable nested copies across the whole dependency tree
without promoting these transitives to direct dependencies.

bun audit drops from 50 to 21 findings; the remainder are dev-only
tooling and low-impact. All 244 tests pass.
UserMother built users with faker.internet.username(), which often
exceeds the domain's 14-char username limit. Built via User.from()
(no validation), the invalid entity was created silently; the
"keep own username" test then fed it to updateUsername(), which
validates length and threw, making the test fail intermittently.

Use faker.string.sample({ min: 1, max: 14 }), matching the pattern
already used by UserUsernameUpdaterRequestMother so the mother yields
entities that respect the domain invariant. Verified flake-free
across 20 consecutive runs.
@diangogav
diangogav merged commit 3f315f5 into main Jun 19, 2026
1 check passed
@diangogav
diangogav deleted the chore/deps-security-and-flaky-test branch June 19, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant