Commit Graph

22 Commits

Author SHA1 Message Date
Katerina Skroumpelou d6cd8a6627 chore: add workflow to block merging (#147) 2026-09-04 17:37:35 +01:00
Katerina Skroumpelou f05307ff4a fix: declare pg and keep it out of the root CJS bundle (#122) 2026-08-25 11:22:02 +03:00
Katerina Skroumpelou c8fd9de39e test(e2e): cover edge functions on the real Deno edge runtime (#111)
* test(e2e): cover edge functions on the real Deno edge runtime

* fix(e2e): work around CLI import-scanner crash on vendored JSDoc examples
2026-08-13 12:11:32 +03:00
Katerina Skroumpelou 9e45b42a49 fix: apply Injectable programmatically so NestJS adapter loads in raw Node (#107)
* fix: apply Injectable programmatically so NestJS adapter loads in raw Node

The @Injectable() decorator on the guard in withSupabase() shipped
untranspiled (tsdown/oxc does not lower legacy decorators), crashing
`require`/`import` of the adapter with SyntaxError under plain Node.
Apply it as Injectable()(SupabaseAuthGuard) instead, and add a raw-Node
load smoke test (pnpm smoke) in CI to catch this class of regression.

Fixes #87

* fix: fail smoke test when no entrypoints are found in exports
2026-07-22 17:08:52 +03:00
Katerina Skroumpelou 09a67506db test: add E2E tests for all four adapters against a local Supabase stack (#99)
* test: add E2E tests for all four adapters against a local Supabase stack

Adds an e2e vitest project (SDK-1143) covering what the mocked unit tests
cannot: real GoTrue-issued JWTs verified against the live JWKS endpoint,
real Supabase client operations via supabaseAdmin, resolveEnv() reading
process.env, and imports from dist/ so packaging regressions fail here.

One scenario set (auth + data access + isolation) runs over real HTTP
against minimal Hono, H3, Elysia, and NestJS apps. Elysia runs behind a
node:http server (srvx) so CI needs no Bun. A separate E2E workflow
starts the local stack with the Supabase CLI, builds, and runs the suite.

* test: grant explicit table privileges in the e2e notes migration

Newer Supabase stacks make new tables private by default — the API roles
(anon/authenticated/service_role) no longer receive DML grants on table
creation. CI installs the latest CLI, so all supabaseAdmin queries failed
with "permission denied for table notes" while JWT scenarios passed.
Reproduced locally on CLI 2.109.1; explicit grants fix it on both old and
new stacks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: align NestJS missing-body handling and cover it in the scenarios

The NestJS app silently inserted an empty note when the body was missing,
while the other three adapters returned 400 — and no scenario exercised
those 400 branches. NestJS now throws BadRequestException like the rest,
and a shared missing-body scenario keeps all four aligned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: cover forged JWTs, the RLS-scoped client, and optional-auth rejection

Closes the three gaps from PR review: the garbage-token scenario failed at
header decode without ever reaching signature verification, ctx.supabase
(the RLS-scoped client) was never exercised, and nothing pinned that a
present-but-invalid token on an optional route is rejected rather than
downgraded to anonymous.

- Mint a well-formed JWT with the live JWKS kid but a wrong signing key in
  global setup; every adapter must 401 it — proving signature verification
  end-to-end, not just structure checks.
- Add GET /my-notes reading through ctx.supabase with no WHERE clause,
  backed by a user_id = auth.uid() select policy — proving the caller's
  token reaches PostgREST and Postgres RLS scopes the rows.
- Assert GET /me-optional with an invalid token → 401.

10 → 14 scenarios per adapter (56 tests).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: add core-wrapper app, admin-bypass proof, and sign-in readability

Addresses PR review comments:

- New fifth app on the core withSupabase(config, handler) fetch wrapper —
  the exact programming model Supabase Edge Functions deploy — running the
  full scenario set behind node:http. A real Deno runtime e2e via
  `supabase functions serve` is tracked in SDK-1280.
- New GET /all-notes route (admin client, no filter) + scenario: user2's
  request sees user1's rows through supabaseAdmin, directly proving the
  admin client is not scoped to the caller's identity.
- Replace the `;({ data, error } = ...)` destructuring-reassignment in the
  sign-in helper with a plain result variable.

15 scenarios × 5 apps (75 tests).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 10:36:13 +03:00
Katerina Skroumpelou 04276d015c fix: add ./peer/supabase-js to jsr.json exports (#94)
* fix: add ./peer/supabase-js to jsr.json exports

* fix: restore JSR publish — add id-token permission and remove silent error suppression
2026-07-03 14:34:13 +03:00
Katerina Skroumpelou e1e2b72e81 feat: add attw type export checking to CI (#93) 2026-07-03 14:21:55 +03:00
Katerina Skroumpelou 744105b458 fix(test): correct sub claim in remote JWKS token fixture and wire tests into CI (#89)
* fix(test): correct sub claim in remote JWKS token fixture

* fix(test): wire test into ci
2026-07-03 13:54:05 +03:00
Katerina Skroumpelou ea17d2fdf1 chore(ci): split publish from build, drop Actions cache from privileged workflows (#62)
Splits release.yml into two jobs to close the OIDC-theft path that the
TanStack/router compromise (2026-05-11) exploited:

- `build` job: contents: write + pull-requests: write (release-please).
  Runs install/build/pack and uploads the .tgz as an artifact. NO id-token.
- `publish-npm` job: needs build, id-token: write only. Downloads the
  tarball into a scratch dir and runs `npm publish --provenance`. Never
  executes pnpm install or any third-party code.

JSR publish and GH pre-release stay in the build job (JSR uses its own
OIDC binding scoped to JSR, not npm).

Also drops `cache: pnpm` from docs.yml and ci.yml. Per
adnanthekhan.com/2024/05/06/the-monsters-in-your-build-cache, GitHub
Actions cache poisoning lets a compromised dep on a main-branch workflow
steal the cache token and poison entries that other privileged workflows
on main will restore. release.yml never used cache; docs.yml has
id-token: write for Pages OIDC and is the main remaining target. ci.yml
is low impact but dropped for consistency. preview-release.yml runs in
fork cache scope and is unaffected.

All `\${{ ... }}` substitutions in inline shell scripts moved to env:
blocks (GHSL Part 2 defense in depth, even though upstream values are
regex-validated).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 13:41:45 +02:00
Katerina Skroumpelou 8b9a84a1cb chore(security): harden supply chain and CI workflows (#61)
* chore(security): harden supply chain and CI workflows

* chore(repo): add codeowners
2026-05-12 11:21:49 +02:00
Ali Waseem f2759071fd fix(ci): update node packages (#57)
* fix(ci): update node packages

* fix(ci): remove latest changes
2026-05-08 11:30:12 -06:00
Katerina Skroumpelou eda6d73f69 docs: setup typedoc and gh pages (#45) 2026-04-30 10:50:20 +03:00
Katerina Skroumpelou 0bd1e6d5ca ci: setup jsr publishing (#37) 2026-04-22 16:39:23 +03:00
Etienne Stalmans 91580d11fd fix: release action (#29) 2026-04-01 12:03:14 +03:00
Etienne Stalmans 68228cbc88 chore: pin actions to sha (#25)
* chore: pin actions to sha

* fix: typo
2026-04-01 11:04:01 +03:00
Katerina Skroumpelou 0366b1d044 ci: add functionality for rc releases (#14) 2026-03-24 16:44:41 +02:00
Katerina Skroumpelou 2ebbc71e21 fix: remove provenance until repo is public 2026-02-24 19:10:38 +02:00
supabase-releaser[bot] fc00cf124e chore(main): release edge-functions 0.1.0 (#2)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-02-24 19:07:28 +02:00
Katerina Skroumpelou 8352bda35c feat: set initial release version 2026-02-24 19:02:19 +02:00
Katerina Skroumpelou ea63894622 chore: set up lint and typecheck 2026-02-24 18:34:12 +02:00
Katerina Skroumpelou 6c37086ecf chore: git hooks 2026-02-24 18:25:54 +02:00
Katerina Skroumpelou 6fccf2f716 ci: set up release-please 2026-02-24 18:15:29 +02:00