AppSec Review: OWASP Code & API Security

    1

    - **Security design** generates a `controls.md` file specifying authentication, session, and authorization requirements for a service.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    AppSec Review: OWASP Code & API Security

    Example session with this skill installed

    Review this API for security problems. I want to know how good it is and what's wrong with it.

    • Read your context and instructions
    • Compiled the appsec review

    A real, unedited Review-mode run of this skill on a seeded test repository: a fictional system built for the skill's eval, not a customer's.

    billdesk-api: Application Security Review

    Mode: Review,

    service tier (R1–R4, all nine domains). This is a static code and config review only. I sent no requests to any running system.
    Source: the working tree of billdesk-api 2.3.0, read on 2026-11-03. It is not a git repository, so there is no commit to cite and no history to scan. Rubric v1.0.
    Stack: Node.js (the engines field allows >=20; the actual runtime is 🔬), Express 4.19.2, express-session 1.18.0 with the default MemoryStore, raw pg 8.11.3 (no ORM), hand-written password check (src/auth.js), helmet 7.1.0, cors 2.8.5, swagger-ui-express serving api/openapi.yaml. The deployment is an SPA plus a JSON API with

    cookie sessions (connect.sid). It is multi-tenant: every user belongs to one tenant (business).
    Tools: semgrep, gitleaks and osv-scanner are not installed here, so none ran. I did not run npm audit: the lockfile has no transitive entries or integrity hashes, and the audit would send the dependency list to the registry. Dependency CVEs below come from known advisories for the pinned versions. They are marked ⚠️, so confirm them with npm audit / osv-scanner on a full lockfile.
    Coverage: all 11 operations and all 10 query/redirect sinks were read line by line. The repo is small (about 150 lines of code).


    Verdict

    Score: 2.0 / 10, band "Critical / unsafe" (2.6 without the caps). Gate: FAIL on 7 of 8 conditions.

    The API should not be exposed in its current state. The core of it is reasonable: v2 uses parameterised queries almost everywhere, orders are scoped to the tenant correctly, helmet is on, and the error handler is generic. The problems are concentrated in a few places, and several are severe:

    Anyone on the internet can read every tenant's invoices. /api/v1 is still mounted with no authentication, and the client chooses the tenant ID with a query parameter.
    2.

    Any signed-in user can run arbitrary SQL through invoice search. Because pg uses the simple query protocol here, stacked statements work, so this means read and write access to the whole database, including every user's unsalted MD5 password hash.
    3. Any signed-in user can rewrite any other user's email and role, across tenants, with PATCH /users/me and an id in the body.
    4.

    The v2 single-invoice endpoint has no tenant check. Users of one business can read another business's invoices by ID.
    5.

    Credentials live in the repo: a production-labelled DATABASE_URL with an embedded password in .env, plus a hard-coded session-signing secret in app.js.

    Underneath these sit three missing layers. Fixing those layers fixes most of the findings:

    • Authentication is opt-in per router. It is not deny-by-default.
    • There is no authorisation or data-access layer. Each handler writes its own tenant predicate, or forgets to.
    • Nothing validates or allow-lists request input. That covers query parameters, bodies and redirect targets.

    R1: Inventory

    Secrets found (kind and location only, values redacted)

    LocationKindNotes
    .env:3DATABASE_URL: a Postgres connection string with an embedded username and passwordThe same file sets NODE_ENV=production (.env:1). The README (README.md:11,15) tells developers to copy this file, and .gitignore does not exclude .env, so it is meant to travel with the repo. Whether the credential is live is 🔬.
    .env:4STRIPE_SECRET_KEY: a payment-provider secret key, test-mode prefixLower impact than a live key, but still a credential to the provider account. Rotate it.
    src/app.js:21express-session signing secret, a literal stringThe same value in every environment and every clone.

    Endpoint inventory

    All operations, one row per route × method × version.

    #Method · pathVerWho may callAuthn checkedAuthz checkedUntrusted inputsSinksState changeCookie-authSpec
    1POST /auth/login–anonymousn/an/abody username, password; query nextSQL (param) auth.js:9; log routes/auth.js:9; redirect routes/auth.js:13yes (session)sets cookie❌ shadow
    2POST /auth/logout–anyonenonenonenonesession storeyesyes❌ shadow
    3GET /api/v2/invoices/searchv2userapp.js:30 (requireAuth)tenant predicate in SQL, but concatenatedquery qSQL (concatenated) invoices.js:10-13no*yes✅
    4GET /api/v2/invoices/:idv2userapp.js:30nonepath idSQL (param) invoices.js:23, SELECT *noyes✅
    5GET /api/v2/ordersv2userapp.js:31query predicate tenant_id = session orders.js:10-11 🟢noneSQL (param)noyes✅
    6GET /api/v2/orders/:idv2userapp.js:31query predicate id AND tenant_id orders.js:23-24 🟢path idSQL (param)noyes✅
    7GET /api/v2/users/mev2userapp.js:32session user id users.js:12 🟢noneSQL (param)noyes✅
    8PATCH /api/v2/users/mev2userapp.js:32target id taken from the body after Object.assign users.js:24-27whole JSON bodySQL UPDATE (param) on email, display_name, role, idyesyes✅ (spec documents only email, display_name)
    9GET /api/v1/invoices?tenant=v1anonymousnone (app.js:33)client-chosen tenant legacy.js:12query tenantSQL (param)nono❌ zombie
    10GET /api/v1/invoices/:idv1anonymousnonenonepath idSQL (param), SELECT * legacy.js:23nono❌ zombie
    11GET /docs (+ assets)–anonymousnonenonenoneSwagger UI renders the specnono❌ not listed

    *Endpoint 3 is read-only by design, but the injection lets stacked UPDATE/DELETE statements run (see AS-INP-01).

    Totals: 11 operations,

    5 reachable anonymously (login, logout, both v1 routes, docs), 3 that change state, all authenticated by cookie.

    Reconciliation: code ↔ spec ↔ gateway ↔ DNS

    SurfaceCodeSpec (api/openapi.yaml)Gateway / DNSClassification
    /api/v2/*, 6 operationsyesyes, all 6🔬 not suppliedin sync
    /api/v1/invoices, /api/v1/invoices/:idmounted app.js:33absent; servers lists only /api/v2🔬Zombie. The README says v1 was "replaced by v2 in 2024". It is still served, and without the authentication v2 has.
    /auth/login, /auth/logoutyesabsent🔬Shadow, undocumented
    /docsyes, unconditionaln/a🔬discovery artefact exposed anonymously
    PATCH /users/me bodyaccepts any propertydocuments email and display_name only, with no additionalProperties: false–Drift. The spec states a restriction the handler does not enforce.

    Spec operations with no route: none.

    Trust boundaries

    BoundaryWhat is trusted, and the problem
    Browser ↔ APIThe session cookie is the only credential. CORS reflects every origin with credentials, so for the browser any website is treated as a trusted client. The cookie is not HttpOnly, not Secure and has no SameSite.
    Old mobile app ↔ /api/v1v1 trusts the caller to say which tenant it is (?tenant=). There is no authentication at all.
    User ↔ tenantTenant isolation is enforced per handler. Three of the eight object-access handlers fail it.
    API ↔ PostgresOne pool with one connection string (db.js:3). Every query runs with the same database privileges, so the SQL injection has the app's full rights. TLS to the database is 🔬 (depends on sslmode in the URL).
    API ↔ payment providerA key is present in .env, but no code calls the provider. That raises the question of why the key ships with the repo at all.

    Credential stores and crypto uses

    UseWhereWith what
    Password storageauth.js:4-6MD5, unsalted, compared with === (auth.js:15)
    Session ID generationexpress-session (uid-safe)CSPRNG 🟢
    Session cookie signingexpress-session, secret at app.js:21HMAC-SHA256, literal secret
    Secrets.env, app.js:21in the repo; there is no secret store

    Dependencies

    PackagePinnedNotes
    express 4.19.2exact⚠️ CVE-2024-43796 (XSS in the res.redirect body, fixed in 4.20.0). The vulnerable call is reachable at routes/auth.js:13. Bundled path-to-regexp 0.1.7 has CVE-2024-45296 (ReDoS), which needs two parameters in one segment; no route here has that, so it is not reachable. Bundled body-parser below 1.20.3 has CVE-2024-45590, which hits the urlencoded parser only; that parser is not mounted, so it is not reachable.
    express-session 1.18.0exact⚠️ Bundles cookie below 0.7.0 (CVE-2024-47764). Cookie attributes here are not request-controlled, so it is not reachable. The default MemoryStore is used in production.
    lodash 4.17.15exact⚠️ CVE-2020-8203 (prototype pollution, zipObjectDeep), CVE-2021-23337 (code injection, template), CVE-2020-28500 (ReDoS). Only _.omit is used (users.js:29), so none is reachable today.
    yamljs 0.3.0exactNo release since 2017. It parses only a trusted local file.
    cors 2.8.5, helmet 7.1.0, pg 8.11.3, swagger-ui-express 5.0.0exactNo reachable advisories known to me.
    LockfilepresentLists only the 8 direct packages: no transitive entries and no integrity hashes (package-lock.json:8-15). It does not actually lock the tree.
    Runtime>=20Node 20 reached end of life on 2026-04-30, and this range still allows it. The deployed version is 🔬.
    Licences–All direct dependencies are MIT or ISC (permissive). There is no inventory or NOTICE file.

    Object counts per domain

    These weight the score: input 10 · authentication 3 · access 11 · crypto 6 · configuration 1 · dependencies 9 · logging 6 · browser 4 · api 11.

    Total 61.


    R3: Findings

    The severity grade assumes reachability as stated and that the data is

    business invoices and user accounts across tenants, meaning other businesses' financial and personal data. Confidence markers: ✅ decidable from the code, ⚠️ proxy that needs confirmation, 🔬 needs runtime data.

    Critical

    IDObjectAnti-patternConf.TheoryOWASP 2021 / API 2023Evidence (source → sink, missing check)
    AS-API-01GET /api/v1/invoices, GET /api/v1/invoices/:idZombie API with weaker controls than v2; no authentication; client-chosen tenant✅A40, A9, A10, A11A01 / API9 + API1app.js:33 mounts legacyRoutes with no requireAuth. In legacy.js:12, req.query.tenant goes straight into the tenant_id = $1 predicate. In legacy.js:23, SELECT * FROM invoices WHERE id = $1 has no owner check. An anonymous caller can walk ?tenant=1..N and dump every tenant's invoices, or walk sequential IDs to get full invoice rows. The README calls v1 replaced, and the spec does not list it.
    AS-INP-01GET /api/v2/invoices/searchSQL injection by string interpolation✅A2, A1A03 / API8 (2019)The source is req.query.q (invoices.js:9). It is interpolated into a template literal at invoices.js:12 (ILIKE '%${q}%'), and so is tenantId. The sink is db.query(text) with no parameter array, so pg uses the simple query protocol and stacked statements run. One quote breaks out of the tenant predicate: any authenticated user can read all tenants, read users.password_hash, and run UPDATE/DELETE.
    AS-ACC-01PATCH /api/v2/users/meMass assignment that grants privilege; target object chosen by the client✅A41, A12, A10A01 / API3 (BOPLA) + API1users.js:24 does Object.assign(rows[0], req.body). Then users.js:26-27 runs UPDATE users SET email=$1, display_name=$2, role=$3 WHERE id=$4 with user.role and user.id from the body. A body like {"id":<victim>,"email":"<attacker>","role":"<any>"} overwrites any user's email and role, in any tenant. The spec (openapi.yaml:42-51) says only email and display_name are writable. Bonus impact: the response at users.js:29 echoes the merged row, which includes every column except password_hash.
    AS-ACC-02GET /api/v2/invoices/:idIDOR: no tenant predicate✅A10A01 / API1invoices.js:23 runs SELECT * FROM invoices WHERE id = $1, and req.session.user.tenantId is never used. Compare the correct pattern in orders.js:23. Any user can read any tenant's invoice by sequential ID, and gets the whole row.
    AS-CRY-01.envProduction-labelled database credential committed with the source✅ present / 🔬 liveA17A02 / –.env:3 holds DATABASE_URL with an embedded password, next to NODE_ENV=production (.env:1). .gitignore (.gitignore:1-2) does not exclude .env, and README.md:11 tells developers to copy it. .env:4 holds a payment-provider secret key (test mode). I can't tell from here whether the credentials are live or whether earlier commits held other values (🔬: no git history). Treat both as compromised and rotate them.

    High

    IDObjectAnti-patternConf.TheoryOWASP / APIEvidence
    AS-AUT-01Credential storeFast, unsalted password hash✅A8, A14A07 / API2auth.js:5 uses createHash('md5') with no salt. Identical passwords give identical hashes, and GPUs crack them at billions of guesses per second. Combined with AS-INP-01, this turns a SQL injection into account takeover at scale. The comparison is also not constant-time (auth.js:15, Low on its own).
    AS-ACC-03CORS policyReflected origin with credentials✅A30, A12A01 / API8app.js:18 sets cors({ origin: true, credentials: true }). Every origin is echoed back with Access-Control-Allow-Credentials: true, and preflights for PATCH pass. Any site can read a logged-in user's API responses and send state-changing requests, as far as the browser forwards the cookie. Today, browser third-party-cookie defaults (Chrome Lax-by-default, Firefox and Safari partitioning) blunt the purely cross-site case. That protection comes from the browser, not the app, and it does not apply to same-site origins such as any *.billdesk.example sibling.
    AS-ACC-04POST /auth/login, PATCH /users/me, POST /auth/logoutNo CSRF defence on cookie-authenticated state changes✅A12A01There is no token or Origin check anywhere, and the cookie has no SameSite (app.js:24). The JSON content-type preflight would normally help, but AS-ACC-03 approves every preflight. That leaves login CSRF, and PATCH /users/me CSRF, which combined with AS-ACC-01 escalates a victim's privileges.
    AS-AUT-02Session cookieCookie readable by script and sent over HTTP; no SameSite✅A7, A31A07app.js:24 sets cookie: { secure: false, httpOnly: false }. Any XSS on a sibling page can read connect.sid, and the cookie travels over plain HTTP. helmet sends HSTS, but the first HTTP request and non-HSTS clients still leak it. Whether a TLS-terminating proxy sits in front, and how trust proxy should be set, is 🔬.
    AS-AUT-03LoginSession not regenerated at login (session fixation)✅A7A07routes/auth.js:12 assigns req.session.user without req.session.regenerate(). A session ID planted before login is upgraded in place. AS-CRY-02 makes planting easier.
    AS-CRY-02Session signing secretHard-coded literal secret✅A17, A7A02 / API2app.js:21 sets secret: 'billdesk-session-secret'. It is identical in every deployment and clone, and can only be rotated by a code release. Knowing it lets an attacker mint validly signed cookies for any session ID. express-session keeps the session data server-side, so this does not forge a login by itself. It does enable fixation and removes the integrity layer.
    AS-LOG-01LoginPlaintext password written to the log✅A24A09routes/auth.js:9 logs `login attempt user=${username} password=${password}`. Every user's password, including failed attempts that are often a near-miss of the real password, lands in stdout and whatever collects it. username is not encoded, so log forging is also possible.
    AS-INP-02POST /auth/login?next=Open redirect on the login flow✅A5, A28A01routes/auth.js:13 calls res.redirect(req.query.next || '/app'), and nothing checks the target. Express 4.19.2 also carries CVE-2024-43796 on exactly this call (⚠️, see AS-DEP-01).
    AS-API-02POST /auth/login; all API operationsCredential endpoint unmetered✅ (in code) / 🔬 (gateway)A42, A8A07 / API4There is no rate limiter, delay or lockout anywhere (app.js, routes/auth.js). Unlimited online guessing becomes cheap. Search (invoices.js:10) and v1 list (legacy.js:10) have no row limit.
    AS-API-03GET /api/v2/invoices/:id, GET /api/v1/invoices/:id, PATCH /users/me responseStored objects serialised whole⚠️ (table columns unknown)A41A01 / API3invoices.js:23-25 and legacy.js:23-24 do SELECT * → res.json(rows[0]). users.js:29 returns the whole user row minus one field (a deny-list, not an allow-list). Any column added later, such as an MFA secret or an internal note, leaks automatically. The real column set is 🔬.

    Medium

    IDObjectAnti-patternConf.TheoryOWASP / APIEvidence
    AS-ACC-05All routersAuthentication opt-in per mount; no central authorisation layer✅A9A01app.js:29-33 attaches requireAuth router by router, and v1 shows what happens when one is forgotten. Tenant scoping is written separately in each handler (orders.js:11,24 correct; invoices.js:23, legacy.js, users.js:27 wrong). req.session.user.role is stored but never checked, and goes stale after a role change.
    AS-API-04GET /docsDiscovery artefact exposed anonymously✅A43A05 / API8app.js:27 mounts it unconditionally, with no NODE_ENV check or authentication. Its content is limited to v2 today.
    AS-API-05Single-object readsExistence oracle, inconsistent across versions✅A16, A10A01 / API1v2 orders correctly return 404 for "not yours" and "missing" alike. v2 invoices return other tenants' data (AS-ACC-02). v1 returns {} vs a full row (legacy.js:24).
    AS-INP-03All inputsNo server-side schema on any boundary✅A1A03id is never checked as an integer (a non-numeric value becomes a pg error and a 500). q, tenant and next are unvalidated, and the PATCH body is unvalidated (email format, length).
    AS-CFG-01Session storeDefault MemoryStore in production✅A18A05app.js:20-25 configures no store. MemoryStore leaks memory, loses every session on restart, and does not work across instances. That makes it an availability and logout-consistency problem.
    AS-CFG-02ConfigurationNo per-environment config✅A18A05There is one .env with production values, and the README instructs copying it to developer machines. Cookie flags and the session secret are literals rather than environment-driven.
    AS-BRW-01Authenticated JSON responsesNo Cache-Control: no-store on personal responses✅A35A05No handler or middleware sets it. Invoices and profile data may be cached by browsers or intermediaries.
    AS-AUT-04SessionsNo idle or absolute timeout✅A7A07app.js:24 sets no maxAge or rolling expiry, and the MemoryStore keeps sessions until restart.
    AS-LOG-02Security eventsLogin outcome, 401s, role and email changes not logged✅A23A09The only security log line is the bad one (AS-LOG-01). Role changes through PATCH leave no trace.
    AS-DEP-01express 4.19.2, express-session 1.18.0, lodash 4.17.15Known-vulnerable versions; one reachable⚠️A21A06The express res.redirect XSS advisory is reachable at routes/auth.js:13. The lodash and cookie advisories have no reachable call today, but lodash 4.17.15 is a trap for the next _.template or _.zipObjectDeep. Confirm with npm audit.
    AS-DEP-02LockfileIncomplete lockfile without integrity hashes✅A21A08package-lock.json:8-15 has 8 entries and no transitive dependencies or integrity fields. The installed tree is whatever resolves on the day.
    AS-DEP-03Runtimeengines: >=20 admits an end-of-life Node⚠️A21A06package.json:10. Node 20 has been end of life since April 2026. The deployed version is 🔬.

    Low

    IDObjectNote
    AS-CRY-03auth.js:15Hash comparison with === is not constant-time (A16). It becomes moot once a KDF's verify function is used.
    AS-DEP-04yamljs 0.3.0Unmaintained since 2017 (A21). It only parses a trusted local file.
    AS-DEP-05LicencesAll dependencies are permissive, but there is no inventory, SBOM or NOTICE (A22).
    AS-AUT-05POST /auth/logoutThe session is destroyed 🟢, but the cookie is not cleared, and logout is CSRF-able (nuisance only).

    🔬 Needs-data flags (not scored)

    1. Whether the DATABASE_URL and payment key in .env are live, and whether earlier versions are in VCS history. This is not a git repo, so history could not be scanned.
    2. Whether a gateway, ingress or DNS name in front still routes /api/v1, or exposes other hosts or versions.
    3. Whether a TLS-terminating proxy is in front, and the trust proxy setting that implies.
    4. The real Node runtime version in production.
    5. The real column set of invoices and users (sensitive fields exposed by SELECT * and the PATCH echo).
    6. Whether the Postgres connection uses verified TLS (sslmode).
    7. Whether stdout logs are shipped off-host, and whether any alerting exists.
    8. Which role values exist and what they unlock in the SPA or other services. This determines the full blast radius of AS-ACC-01.

    What is working well 🟢 (keep and extend)

    • Parameterised queries in 8 of the 9 query sinks ($1 placeholders with arrays).

    The orders handlers are the reference pattern for tenant isolation: WHERE id = $1 AND tenant_id = $2 with the tenant taken from the session (orders.js:23-24), a uniform 404, an explicit column list, and LIMIT 100.

    Explicit column lists on search, the orders endpoints and GET /users/me. password_hash is never selected for /me.

    • The tenant comes from the server-side session, not the request, in v2.
    • helmet with defaults: CSP, nosniff, frame protection, HSTS, Referrer-Policy.
    • A generic error handler (app.js:35-38): no stack traces to clients.
    • saveUninitialized: false, resave: false, and session.destroy() on logout.
    • Exact version pins in package.json.

    express.json's default 100 kB body limit, and JSON responses only (no HTML templating, so no reflected XSS surface in the API).


    R4: Scores

    The arithmetic follows the scoring guide. Each criterion is graded by the fraction p of in-scope objects that pass it: 🟢 (p ≥ 0.95) = 2 points, 🟡 (0.50 ≤ p < 0.95) = 1 point, 🔴 (p < 0.50) = 0 points. base = Σ points / (2 × criteria) × 10. Caps: any open Critical caps the domain at 2.0; any open High caps it at 6.0. Criteria marked N/A have no in-scope object.

    input (10 sinks: 9 queries, 1 redirect)

    CriterionPass / in scopepPts
    1 Parameterised8/90.89🟡 1
    3 Output encoded (JSON)9/91.0🟢 2
    5 Server-side schema0/100🔴 0
    6 Parsers safe2/21.0🟢 2
    9 Redirect allow-listed0/10🔴 0

    Criteria 2, 4, 7 and 8 are N/A. Base = 5/10 × 10 = 5.0; the Critical cap (AS-INP-01) gives 2.0.

    authentication (3 mechanisms: password login, session, credential store)

    CriterionPass / in scopepPts
    1 Framework authentication (session yes, password check hand-rolled)1/20.50🟡 1
    2 Slow salted KDF0/10🔴 0
    4 Rotated at login✗–🔴 0
    5 Cookie flags✗–🔴 0
    6 Timeouts✗–🔴 0
    9 Throttled✗–🔴 0
    10 MFA for privileged roles (⚠️: roles exist, privilege unknown, so capped at 🟡)––🟡 1

    Criteria 3, 7 and 8 are N/A (no registration, tokens or recovery flow in code). Base = 2/14 × 10 =

    1.4. The High cap (6.0) doesn't bind, so the score is

    1.4.

    access (11 endpoints)

    CriterionPass / in scopepPts
    1 Central authorisation layer, deny by defaultnone exists0🔴 0
    2 Object access scoped by tenant4/80.50🟡 1
    3 No decisions on client signals6/80.75🟡 1
    4 CSRF defence0/30🔴 0
    5 CORS restricted0/10🔴 0
    6 Request binding allow-listed1/20.50🟡 1

    Criteria 7 and 8 are N/A. Base = 3/12 × 10 = 2.5; the Critical cap gives 2.0.

    crypto (6 objects: MD5 hash, session HMAC, session-ID RNG, 3 secrets)

    CriterionPass / in scopepPts
    1 Vetted, current algorithms2/30.67🟡 1
    2 CSPRNG and salts1/20.50🟡 1
    3 Keys separated by purpose and environment0/10🔴 0
    4 Constant-time comparison1/20.50🟡 1
    5 Secrets from a store0/30🔴 0
    7 Key lifecycle0/10🔴 0

    Criterion 6 (TLS clients) is 🔬. Base = 3/12 × 10 = 2.5; the Critical cap (AS-CRY-01) gives 2.0.

    configuration (1 production config)

    CriterionResultPts
    1 Debug offpass🟢 2
    2 Generic errorspass🟢 2
    4 HTTPS + HSTS (⚠️: HSTS on, cookie not Secure, proxy 🔬)partial🟡 1
    5 Baseline headerspass🟢 2
    6 No default secrets (literal session secret)fail🔴 0
    7 Fail closed (errors yes, authentication opt-in, ⚠️)partial🟡 1
    8 Per-environment configfail🔴 0

    Criterion 3 is N/A (docs are graded under api). Base = 8/14 × 10 =

    5.7. No High or Critical finding is attributed to this domain, so the score is

    5.7.

    dependencies (8 direct + runtime = 9)

    CriterionResultPts
    1 Locked and pinned (exact pins, hollow lockfile)partial🟡 1
    2 No known-exploited/critical reachable (⚠️ 6/9 clean)p 0.67🟡 1
    3 SCA in CIfail🔴 0
    4 Supported runtime (⚠️)partial🟡 1
    5 Maintained (8/9)p 0.89🟡 1
    6 Integrity verifiedfail🔴 0
    7 SBOMfail🔴 0
    8 Licences inventoriedfail🔴 0

    Base = 4/16 × 10 = 2.5. There are no Highs here, so the score is 2.5.

    logging (6 events: login success, login failure, 401, role change, email change, logout)

    CriterionPass / in scopePts
    1 Events logged0/6🔴 0
    2 No secrets in logsfail🔴 0
    3 Input encoded against forgingfail🔴 0

    Criteria 4 and 5 are 🔬. Base = 0.0, so the score is 0.0.

    browser (4 objects: JSON class, docs HTML, static assets, the CORS policy)

    CriterionResultPts
    1 Explicit type + nosniffpass🟢 2
    3 Request data in headers (⚠️, redirect Location)partial🟡 1
    4 URL decisions on parsed partsfail🔴 0
    6 CORS allow-listedfail🔴 0
    7 __Host- cookie + CSRF tokenfail🔴 0
    8 Framing deniedpass🟢 2
    9 No cross-site includable datapass🟢 2
    11 no-storefail🔴 0
    12 Request size/time boundedpartial🟡 1

    Criteria 2, 5 and 10 are N/A. Base = 8/18 × 10 =

    4.4. There are no Criticals in this domain, so the score is

    4.4.

    api (11 operations)

    CriterionPass / in scopepPts
    1 In the reconciled inventory6/110.55🟡 1
    2 Retired versions answer 4100/10🔴 0
    3 Per-role response shapes5/80.63🟡 1
    4 Writable properties allow-listed1/20.50🟡 1
    5 Consumption limits00🔴 0
    6 Page size bounded1/30.33🔴 0
    7 Docs gatedfail0🔴 0
    8 Uniform refusals1/30.33🔴 0
    10 Token/secret strengthfail0🔴 0

    Criterion 9 is 🔬. Base = 3/18 × 10 = 1.7, which is already below the Critical cap of 2.0, so the score is 1.7.

    inputauthenticationaccesscryptoconfigurationdependenciesloggingbrowserapiService
    2.01.42.02.05.72.50.04.41.72.0

    Service score. Each domain score is weighted by its object count:

    • Capped: (10·2.0 + 3·1.4 + 11·2.0 + 6·2.0 + 1·5.7 + 9·2.5 + 6·0 + 4·4.4 + 11·1.7) / 61 = 122.7 / 61 = 2.01. Re-applying the Critical cap gives

    2.0.

    • Uncapped: (10·5.0 + 3·1.4 + 11·2.5 + 6·2.5 + 5.7 + 22.5 + 0 + 17.6 + 18.7) / 61 = 161.2 / 61 = 2.6.

    Both are in the

    Critical / unsafe band. Even with every Critical removed, the uncapped base sits in "Critical / unsafe", because logging, authentication and the API controls are mostly missing rather than slightly wrong.

    Severity tally: Critical 5 · High 10 · Medium 12 · Low 4 · 🔬 8.

    OWASP tally (2021):

    CategoryFindings
    A01 Broken Access ControlAS-API-01, AS-ACC-01, AS-ACC-02, AS-ACC-03, AS-ACC-04, AS-INP-02, AS-API-03, AS-ACC-05, AS-API-05
    A02 Cryptographic FailuresAS-CRY-01, AS-CRY-02
    A03 InjectionAS-INP-01, AS-INP-03
    A05 MisconfigurationAS-API-04, AS-CFG-01, AS-CFG-02, AS-BRW-01
    A06 Vulnerable ComponentsAS-DEP-01, AS-DEP-03
    A07 Authentication FailuresAS-AUT-01, AS-AUT-02, AS-AUT-03, AS-API-02, AS-AUT-04
    A08 Integrity FailuresAS-DEP-02
    A09 Logging FailuresAS-LOG-01, AS-LOG-02

    OWASP API Top 10 (2023):

    CategoryFindings
    API1 Broken Object Level AuthorizationAS-API-01, AS-ACC-02, AS-ACC-01, AS-API-05
    API2 Broken AuthenticationAS-AUT-01, AS-CRY-02
    API3 Broken Object Property Level AuthorizationAS-ACC-01, AS-API-03
    API4 Unrestricted Resource ConsumptionAS-API-02
    API8 Security MisconfigurationAS-ACC-03, AS-API-04
    API9 Improper Inventory ManagementAS-API-01

    Systemic issues (shared causes)

    Authentication is opt-in and there is no authorisation layer (A9, A10). This one missing layer causes AS-API-01, AS-ACC-02, AS-ACC-01 (the target ID) and AS-API-05. The orders handlers prove the team knows the right pattern; nothing forces it on the next handler.
    2.

    No input contract or binding allow-list (A1, A41). This one missing layer causes AS-INP-01, AS-ACC-01, AS-INP-02, AS-INP-03 and the spec drift. The spec already describes the contract; the code never enforces it.
    3.

    Secrets and security settings as literals in the repo (A17, A18). This causes AS-CRY-01, AS-CRY-02, AS-AUT-02 and AS-CFG-02. One configuration module, reading from the environment or a secret store and failing closed in production, removes all four.
    4.

    No inventory discipline (A40, A43). v1 was "replaced in 2024" but never unmounted, and the auth routes and docs are not in the spec. The most severe finding in the review exists only because of this.
    5.

    Session hardening was never done (A7, A30, A12). The defaults were loosened instead: reflected CORS, httpOnly: false, no regenerate, no SameSite, MemoryStore. Together these make CSRF and session theft easy.

    Attack chains worth knowing (traced, not executed)

    Anonymous attacker: loop over GET /api/v1/invoices?tenant=<n> to get every tenant's invoices, then call GET /api/v1/invoices/<id> for full rows. Prerequisites: none.
    2.

    Any customer account: inject through GET /api/v2/invoices/search?q=… to read users.username, password_hash, then crack the unsalted MD5 hashes offline and log in as anyone. Alternatively, a stacked UPDATE users SET role=… skips the cracking.
    3.

    Any customer account, no SQL needed: send PATCH /api/v2/users/me with {"id": <victim>, "email": "<attacker>", "role": "<highest>"}. This takes over another user's contact address and changes their role, in any tenant.


    Gate: FAIL

    ConditionResultReason
    Capped score ≥ 9.0❌2.0
    No open Critical or High❌5 Critical, 10 High
    Every state change has server-side authorisation and, where cookie-authenticated, a CSRF defence (A9, A10, A12)❌PATCH /users/me takes its target from the body (AS-ACC-01). No endpoint has a CSRF defence (AS-ACC-04).
    No unrotated secret in VCS or artefacts (A17)❌.env:3-4 and app.js:21 (AS-CRY-01, AS-CRY-02). History is unknown.
    Passwords use a slow salted KDF (A8)❌Unsalted MD5 (AS-AUT-01)
    No known-exploited dependency on a reachable path (A21)✅ (⚠️)No known-exploited advisory is reachable. The reachable express redirect CVE is moderate. Confirm with npm audit on a full lockfile.
    No API version or docs endpoint outside the controlled inventory (A40, A43)❌/api/v1 zombie, anonymous /docs, undocumented /auth/*
    🔬 flags ≤ 10% of objects❌8 of 61 (13%)

    Do now (before any wider remediation plan)

    Review mode does not prescribe fixes. These items are

    containment: they close paths that are open to anyone right now. The full fix sequence belongs in Propose.

    Unmount /api/v1 (app.js:33), or put it behind requireAuth plus the session tenant, today. Check the gateway or ingress for the same paths (🔬).
    2. Rotate the database password, the payment-provider key and the session secret. Removing them from the files is not enough. Remove .env from the repo, add it to .gitignore, and scan history once the repo is under git.
    3.

    Stop logging passwords (routes/auth.js:9). Purge existing logs that contain them, and treat any password that appears there as exposed.
    4.

    Take search offline, or parameterise it (invoices.js:12). Add tenant_id to invoices.js:23 and allow-list the PATCH body (users.js:24-27).
    5. Then check the database for signs of the paths above having been used. The 🔬 flags list the evidence needed.


    Handoff

    I reviewed billdesk-api 2.3.0 from its working tree (no git, so no commit to cite). Stack: Node/Express 4.19.2, express-session, raw pg. Score

    2.0 (Critical / unsafe; 2.6 uncapped). The gate

    fails on 7 of 8 conditions. There are

    5 Critical and 10 High findings, across A01, A02, A03, A07 and A09 (API1, API2, API3, API4, API8, API9). The endpoint inventory and its reconciliation are above.

    Next:

    Design for access (a central authorisation layer, an authorisation matrix, A-B-A tests), authentication and sessions, and the api inventory and DTOs.

    -

    Propose to sequence the work: containment first, then the authorisation and input layers as class fixes, then guardrails (a route-vs-spec CI check, a semgrep rule against unparameterised db.query, a secret scanner).

    • Fixes go through tdd with a red test per finding.
    • The tenant-isolation model goes to threatmodel.
    • The proxy, TLS, gateway and DNS 🔬 items go to hardening.
    express.json

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Software vulnerabilities often boil down to two things: untrusted input being treated as instructions, or actions performed without authorization. This skill audits your codebase against these core failures, providing a rigorous assessment of your application's security posture. It moves beyond simple linting by tracing data from source to sink and verifying the enforcement of security boundaries.

    What it does

    • Static code review analyzes source, templates, and configurations to identify injection, broken auth, and crypto flaws.
    • Endpoint inventory builds a comprehensive map of every route, handler, and consumer, identifying who can call them and what inputs they read.
    • Security design generates a controls.md file specifying authentication, session, and authorization requirements for a service.
    • Remediation sequencing produces a proposal.md that prioritizes fixes by risk and focuses on solving entire classes of bugs at the root.
    • OWASP alignment grades findings against the OWASP Top 10 and API Top 10 using a standardized 0–10 scoring rubric.

    How it works

    1. Review mode identifies vulnerabilities in a repo or PR diff, producing an evidence-based inventory and score.
    2. Design mode architects the necessary security controls and authorization matrices for a new or existing service.
    3. Propose mode creates a phased remediation plan, ensuring each fix starts with a red test and includes a regression guard.

    Frameworks & tools

    This skill supports .NET, Java, Node.js, Python, PHP, Go, and Ruby. It leverages evidence from tools like Semgrep, CodeQL, Bandit, Gosec, and various SCA scanners while providing manual synthesis.

    Why this beats prompting it yourself

    Generic prompts often miss "shadow" APIs or fail to trace untrusted input across trust boundaries. This skill uses a formal rubric (A1–A43) to ensure every finding is cited against security theory rather than subjective taste.

    Use cases

    • PR security audits to catch authorization bypasses or injection risks before they reach the main branch.
    • API inventory reconciliation to find zombie endpoints or drift between code and OpenAPI specs.
    • Remediation planning for legacy codebases needing a systematic, risk-ordered security overhaul.
    • Auth system design for new microservices requiring a formal authorization matrix and session model.

    Known limitations

    Dynamic testing is restricted to non-production environments explicitly named by the user. Static review coverage depends on the visibility of source code and configuration files.

    Dynamic testing requires user-owned non-prod environments. Static review is limited to provided source and config files. Estate-level reviews may require subagent delegation.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 14 days ago

    Requires

    Python
    license-checker
    Node.js

    Permissions

    Read Files
    Network Access
    Write Files
    Terminal / Shell
    Listed14 days ago

    What's inside

    Frequently Asked Questions

    This skill performs deep static analysis to trace data from input to execution, specifically targeting authorization bypasses and injection flaws that standard linters miss. It provides a formal security posture assessment based on OWASP Top 10 standards, complete with risk scores and remediation plans.

    It supports a wide range of backend languages including .NET, Java, Node.js, Python, PHP, Go, and Ruby, and can be integrated into most AI agent environments that have access to a repository's file system or CI/CD pipelines.

    The skill produces an evidence-based vulnerability inventory, a 'controls.md' file defining security requirements, and a 'proposal.md' containing a prioritized, phased remediation plan with test cases.

    Setup is straightforward; once the skill is added to your agent, you simply provide access to your codebase or a specific PR diff and specify whether you are in Review, Design, or Propose mode.

    For safety and stability, dynamic testing and active scanning are strictly limited to non-production environments that you explicitly designate during the configuration process.

    Your purchase includes the full logic for all three operational modes (Review, Design, Propose) and access to version updates that incorporate the latest OWASP Top 10 and API Top 10 methodology changes.

    New in Security