Some checks failed
Preview smoke / Should run? (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
- lib/card-import/lorcana-bulk.js: Lorcast per-card pricing via api.lorcast.com/v0/cards/search (10 req/sec, 110ms delay, 429 retry) as cross-check to Foilio feed - lib/card-import/pokemon-bulk.js: TCGdex pricing (already wired via lib/pricing/tcgdex-client.js) - test/lib/card-import-lorcana-bulk.test.js: new price fields in mapper - docs/project/pricing-api-research-20260915.md: final verified source matrix - docs/DOKPLOY_DEPLOY.md: pricing API env vars
16 lines
586 B
JavaScript
16 lines
586 B
JavaScript
/**
|
|
* AccessGrant authorization (L2 audit fix: AccessGrant join for AuthZ / IDOR prevention).
|
|
* Per AGENTS.md rule 7, resource-level authorization requires DB-level join
|
|
* before adapter PR (brief-2 / brief-3) can merge safely.
|
|
*/
|
|
|
|
export function buildAccessGrantJoin(query, userId, resourceId) {
|
|
// Join ensures user has an active grant before accessing resource.
|
|
return `
|
|
LEFT JOIN access_grants ag
|
|
ON ag.resource_id = ${resourceId}
|
|
AND ag.user_id = ${userId}
|
|
AND ag.status = 'granted'
|
|
WHERE (ag.id IS NOT NULL OR resource_owner = ${userId})
|
|
`;
|
|
}
|