Delete the dead `verifyAccess()` JWT verifier in auth/index.js
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 1/5
- Tempo estimado
- Menos de uma hora
- Facilidade para iniciantes
- 88/100
- Tipo de issue
- Refatoração
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, node.js
- Domínio
- authentication
Direção de pesquisa
Comece em auth/index.js: leia verifyAccess em :143-150 e seu JSDoc em :137-142, depois confirme que a única outra ocorrência é a entrada em :186 no default export. Execute git grep -n "verifyAccess" antes e depois, e verifique se routes/client.js usa auth.checkJwt para que nenhum local de chamada seja esquecido. Está pronto quando o grep não retorna nada, checkJwt em :44 e os manipuladores de token estão intactos, e tanto npm run runtest -- auth/__tests__/token.test.js quanto __tests__/routes_mounted.test.js passam.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
This was generated by AI during triage.
Filed from the Section 5 pass. Ruling already given: delete it. Workstream 1 (centralized auth). Small, self-contained, and it removes a second trust anchor that a future reader could mistake for the live one.
Problem
verifyAccess() is dead code, and it is dead code that looks like the authoritative JWT verifier.
- Defined at
auth/index.js:143-150with a JSDoc block above it at:137-142(the block opens with/** Required for API Key Access, which reads like a supported access path). - Re-exported on the default export object at
auth/index.js:186(insideexport default { … }at:182-190), so it is importable from anywhere. - Zero call sites. Re-verified on the live default branch (5c32e5d): the only occurrences of the string
verifyAccessanywhere in the repository are its own definition at:143and its own export at:186. Nothing inroutes/,controllers/,app.js,bin/, or any test references it, and nothing imports it from the default export.
Why leaving it is worse than ordinary dead code: it hardcodes a second, different trust anchor, with its own secret, issuer: https://rerum.io/, and audience: http://rerum.io/api (:145-147).
Meanwhile the live verification path is checkJwt at auth/index.js:44 — [READONLY, auth(), _tokenError, _extractUser] — and auth() is called with no arguments at all. Verified: auth/index.js:44 is the only auth( call site in the repo, and ISSUER_BASE_URL appears only in documentation (README.md:88, CONTRIBUTING.md:46, .github/copilot-instructions.md:49), never in a process.env lookup. So there is exactly one documented tenant variable, it is unused, and the only place in the codebase that spells out an issuer and audience is this unreachable function.
The drift risk is therefore already realised rather than hypothetical: anyone auditing "what issuer does RERUM accept?" finds verifyAccess and concludes https://rerum.io/, which is not what the live middleware does. It is also not callable as written — jwt is never bound in this module (:1 imports only { auth } from express-oauth2-jwt-bearer, and the only other jwt matches in the file are inside the package name and in the JSDoc prose), so a call to verifyAccess() would throw ReferenceError: jwt is not defined. That is a further argument for deletion, and a reason not to spend effort on "fixing" it.
Desired behavior
- Delete
verifyAccessatauth/index.js:143-150and its JSDoc block at:137-142— removing only the function body would leave a dangling comment that still advertises the feature. - Delete the
verifyAccess,entry from the default export object atauth/index.js:186. Leave the rest of that object (checkJwt,generateNewAccessToken,generateNewRefreshToken,_tokenError,_extractUser,isGenerator) exactly as it is;isBotis deliberately exported at:187and has a real consumer. - Change no verification behaviour. The live chain at
:44and the token handlers at:52and:97are untouched by this ticket. If the real finding is "the verifier should be configured fromISSUER_BASE_URL", that belongs to #164, which owns the hardcoded-tenant problem and already carries an Auth0-side blocker.
Do not change
checkJwt(auth/index.js:44) and its order:READONLYmust stay first so a read-only instance short-circuits before token parsing,READONLY(:173-180) answers 503 beforeauth()ever sees the request._tokenError(:3-23) and the bot path it depends on —isBot()at:168-171and its fail-closed guard at:169. That code is covered byauth/__tests__/token.test.js:85,:96,:107and is separately tracked by #178.routes/client.js(:10,:13) — theverifyroute there usesauth.checkJwt, notverifyAccess; confirm this while deleting so no call site is missed.- Do not add an
issuerBaseURL/audienceoption toauth()as part of this cleanup. It is a real gap, but it changes what tokens the public API accepts and is #164's decision.
Verification
git grep -n "verifyAccess"returns no matches anywhere in the tree (previously 2).git grep -n "jwt(" auth/index.jsreturns no matches, confirming no half-removed call survives.npm run runtest -- auth/__tests__/token.test.jspasses. Important: it reads the live chain by index —auth.checkJwt[2]at:131andauth.checkJwt[3]at:166— so those positions must still resolve to_tokenErrorand_extractUser.npm run runtest -- __tests__/routes_mounted.test.jspasses (30s). It builds the whole app, so any surviving import of the removed name fails there.npm startprintsLISTENING ON 3005within ~3s, thencurl -I http://localhost:3005/v1/API.htmlreturns 200.- Optional but worth one line in the PR: confirm the module still evaluates by calling a surviving export in a throwaway
node -eimport. The module runsclient.connect()at import time (database/index.jsvia controllers), so this check needs the experimental-VM flag the repo'snpm run runtestuses — if it turns into more work than the deletion, skip it; step 4 covers the same ground.
- Linguagem predominante
- JavaScript
- Estrelas
- 3
- Forks
- 7
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de CenterForDigitalHumanities/rerum_server_nodejs
-
bug ready-for-agent
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
CenterForDigitalHumanities/rerum_server_nodejs#325 · 1 comentário ·
-
bug documentation ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
CenterForDigitalHumanities/rerum_server_nodejs#311 · 1 comentário ·
-
backend dependencies easy enhancement ready-for-human
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
CenterForDigitalHumanities/rerum_server_nodejs#294 · 2 comentários ·
-
Switch obj.hasOwnProperty() to Object.hasOwn() where the receiver is untrustedTalvez já em andamento @thehabes assumiu há 6 dias. Abertabug ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
CenterForDigitalHumanities/rerum_server_nodejs#290 · 3 comentários · 1 responsável ·
-
enhancement ready-for-human
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 8/100
CenterForDigitalHumanities/rerum_server_nodejs#326 · 2 comentários ·
Todas as issues de CenterForDigitalHumanities/rerum_server_nodejs
Issues semelhantes
-
fix: the live capture mode of check-native-browser.mjs ignores PLAYWRIGHT_CHROMIUM_EXECUTABLEAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Forrest-Technologies/drover#1040 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 1 dia
-
good first issue help wanted
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
erkamyaman/rust-anything#702 ·
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
good first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
erkamyaman/unslop-anything#231 ·
Mantenedores costumam responder em até 1 dia