a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
59 lines
1.7 KiB
Go
59 lines
1.7 KiB
Go
package languages
|
|
|
|
// Reserved call denylist for through-handler call attribution. When walking
|
|
// an inline route-handler body (`app.get('/u', (req,res) => { ... })`) to
|
|
// connect a route to the services it calls, the framework's own
|
|
// request/response/next helpers and JS built-ins are noise — `res.json()`,
|
|
// `req.params`, `next()`, `console.log()` are not application calls. This
|
|
// table (plus the handler's own parameter names, checked dynamically) is the
|
|
// filter, mirroring the table style of phpLaravelFacadesDefault.
|
|
|
|
// jsReservedCallReceivers are receiver identifiers whose member calls are
|
|
// framework/runtime helpers, not application services.
|
|
var jsReservedCallReceivers = map[string]struct{}{
|
|
"req": {},
|
|
"res": {},
|
|
"request": {},
|
|
"response": {},
|
|
"reply": {},
|
|
"next": {},
|
|
"ctx": {},
|
|
"context": {},
|
|
"console": {},
|
|
"JSON": {},
|
|
"Math": {},
|
|
"Object": {},
|
|
"Array": {},
|
|
"Promise": {},
|
|
"this": {},
|
|
}
|
|
|
|
// jsReservedBareCalls are free-function calls that are runtime/built-in, not
|
|
// application services.
|
|
var jsReservedBareCalls = map[string]struct{}{
|
|
"next": {},
|
|
"require": {},
|
|
"parseInt": {},
|
|
"parseFloat": {},
|
|
"String": {},
|
|
"Number": {},
|
|
"Boolean": {},
|
|
"setTimeout": {},
|
|
"setInterval": {},
|
|
"isNaN": {},
|
|
}
|
|
|
|
// jsIsReservedReceiver reports whether a member-call receiver name is a
|
|
// framework/runtime helper rather than an application service.
|
|
func jsIsReservedReceiver(name string) bool {
|
|
_, ok := jsReservedCallReceivers[name]
|
|
return ok
|
|
}
|
|
|
|
// jsIsReservedBareCall reports whether a free-function call name is a
|
|
// runtime/built-in.
|
|
func jsIsReservedBareCall(name string) bool {
|
|
_, ok := jsReservedBareCalls[name]
|
|
return ok
|
|
}
|