代码仓库全链路质量审计
梳理项目架构与跨文件业务链路,核查安全、性能和测试问题,输出证据化整改路线。
完整提示词
# FORENSIC FULL-REPOSITORY AUDIT I want an **in-depth, systematic, and evidence-first analysis of the entire GitHub repository and application**. This is not a conventional code review. Treat this task as a unified combination of: * senior software architecture review * security audit * production-readiness audit * bug hunting * performance audit * reliability audit * UX/accessibility review * test coverage analysis * DevOps/CI/CD review * technical debt analysis * cross-file and cross-system forensics The primary objective is: > Identify, confirm, classify, and document all tangible issues, risks, bugs, inconsistencies, technical debt, and justified areas for improvement across the entire project. Priority: **accuracy > depth > finding count.** Do not fabricate issues merely to make the audit appear more detailed. --- # 0. GITHUB REPOSITORY WORKING RULES When provided with a GitHub repository URL, do not inspect only the README or the few arbitrary files surfaced by default. First, systematically map the repository structure. Establish: * repository identity * default branch * directory hierarchy * relevant secondary branches if present * monorepo structure if applicable * package/workspace structure * entry points * applications * shared packages * frontend * backend * API layer * database layer * tests * scripts * CI/CD pipelines * infrastructure definitions * configurations * documentation Use GitHub repository content as the primary source of truth. Where accessible, also examine: * relevant GitHub Actions workflows * open issues * relevant pull requests * release and tag metadata * Dependabot/Renovate configurations However, **code in the current default branch takes strict precedence over descriptions in issues or the README**. If documentation claims one behavior while the code implements another, report the discrepancy. --- # 1. DO NOT START WITH FINDINGS Construct an internal architectural map of the system prior to drafting findings. First understand: * core purpose of the application * intended target audience * primary use cases * technology stack * frameworks * runtime environments * deployment targets * data model * authentication architecture * authorization model * frontend/backend boundaries * primary business flows * external integrations Do not draw conclusions until the foundational architecture is thoroughly understood. --- # 2. MAP THE ENTIRE REPOSITORY Inspect wherever they exist: * source * app * pages * src * components * features * modules * services * lib * utils * hooks * stores * contexts * server * backend * API routes * route handlers * server actions * middleware * database * migrations * schema * ORM * seeds * workers * queues * cron * webhooks * storage * uploads * downloads * authentication * authorization * payments * email * notifications * third-party integrations * tests * unit tests * integration tests * E2E * fixtures * mocks * scripts * Docker * Vercel * Railway * Cloudflare * GitHub Actions * configuration * environment handling * package manifests * lockfiles * public assets * PWA * manifest * service workers * translations * analytics * monitoring * documentation Never assume a directory is unimportant simply because it is located outside `src`. --- # 3. REPOSITORY INVENTORY Compile an inventory at the outset of the audit. Where data can be verified, document: * framework * runtime * language * package manager * deployment platform * DB/ORM * auth system * number of applications/packages in monorepo * API surface * test frameworks * CI/CD system * key third-party services Where feasible, estimate: * count of relevant source files * count of test files * count of API endpoints * count of database models * count of GitHub workflows * TODO/FIXME/HACK markers Do not invent numbers if they could not be calculated. --- # 4. ARCHITECTURAL MAP Map the actual architectural flow of the system. For example: ```text Browser ↓ Next.js UI ↓ Server Actions / Route Handlers ↓ Business Services ↓ ORM ↓ Database ``` or whatever architectural model is actually implemented. Specifically map: ## Authentication flow ```text Login → credentials/provider → server validation → session/token → cookie → middleware → protected operation ``` ## Data flow ```text UI → request → validation → authorization → business logic → database → response → UI state ``` ## External integration flow ```text App → provider SDK/API → response/webhook → validation → persistence → user-visible state ``` --- # 5. CROSS-FILE ANALYSIS IS MANDATORY The paramount rule: **Do not review files as isolated units.** Trace every critical capability along its end-to-end traversal across the repository. Example: ```text Form ↓ client validation ↓ request payload ↓ API route ↓ server validation ↓ authorization ↓ business logic ↓ database schema ↓ response ↓ client state ``` Search for discrepancies. For example: ```text Frontend transmits `userId` API expects `id` schema utilizes `ownerId` DB foreign key enforces `accountId` ``` or: ```text UI hides the admin button ↓ yet API endpoint verifies authentication only ↓ any authenticated user can invoke the endpoint directly ``` Cross-file findings hold high priority. --- # 6. TRACE CALLERS AND CALLEES Before declaring a function defective: * locate all callers * inspect all callees * check wrapper abstractions * check middleware chains * check shared validation guards * check shared authorization gates * check database constraints * verify framework lifecycle behaviors This verification is mandatory to eliminate false-positive findings. --- # 7. BUG HUNTING Actively investigate tangible functional defects. Verify: * null * undefined * empty values * invalid values * boundary conditions * off-by-one errors * incorrect comparisons * stale state * stale closures * asynchronous errors * missing await expressions * unhandled Promise rejections * race conditions * duplicate execution * double submissions * idempotency violations * concurrency anomalies * pagination issues * filtering defects * sorting errors * date manipulation * timezone handling * daylight saving time (DST) * locale parsing * decimal computations * currencies * rounding errors * string encoding * Unicode handling * filesystem paths * Windows/Linux discrepancies * case sensitivity * SSR vs CSR divergence * hydration mismatches * caching behavior * stale cache exposure * optimistic updates * retry semantics * timeout configurations * partial failures For every significant defect, construct a reproduction scenario. --- # 8. HAPPY PATH IS INSUFFICIENT For every critical capability evaluate at minimum: ### Normal case What occurs during expected execution? ### Empty state What occurs when datasets are completely empty? ### Invalid input What occurs when malformed input is received? ### Malicious input What occurs when an attacker bypasses the frontend client? ### Large input What occurs under high input volumes? ### Concurrent usage What occurs under concurrent operational execution? ### Failure path What occurs if: * the API fails * the database crashes * external providers become unavailable * the request times out * responses return malformed payloads ### User behaviour What occurs if the user: * double-clicks triggers * refreshes the browser * navigates Back * navigates Forward * opens concurrent tabs * mutates URL parameters manually * invokes API endpoints directly --- # 9. SECURITY AUDIT Execute an in-depth security evaluation. ## Authentication Verify: * login mechanisms * registration workflows * password reset flows * session generation * session validation * logout mechanisms * token expiration * token refresh lifecycles * cookie configurations * HttpOnly flags * Secure flags * SameSite attributes * session fixation protections * account enumeration risks * brute-force safeguards where appropriate ## Authorization Specifically examine: * IDOR vulnerabilities * broken access controls * role check bypasses * privilege escalation vectors * tenant isolation boundaries * resource ownership verification * administrative endpoints * cross-user data access Frontend guards **never qualify as sufficient authorization controls**. Always verify backend enforcement. ## Input attacks Investigate wherever relevant: * SQL injection * NoSQL injection * command injection * shell injection * cross-site scripting (XSS) * stored XSS * reflected XSS * DOM XSS * CSRF vulnerabilities * SSRF vulnerabilities * path traversal * open redirects * unsafe remote URL fetching * unsafe object deserialization * prototype pollution * header injection * template injection ## API For every critical endpoint inspect: * authentication enforcement * authorization boundaries * payload validation * rate limiting * abuse resistance * idempotency controls * object enumeration * excessive data exposure * mass assignment vulnerabilities * stack trace/error leakage ## Secrets Search for: * hardcoded API keys * embedded credentials * static authentication tokens * private cryptographic keys * plaintext passwords * sensitive connection strings If credentials are discovered: **never print their full values in the report.** Mask them appropriately. ## Upload If file uploads are supported: * extension validation * MIME type verification * payload content inspection * file size limits * filename sanitization * path traversal vectors * SVG script injection * executable payload execution * unintentional file overwrite * storage permission boundaries * unintended public exposure ## Webhooks Verify: * cryptographic signatures * timestamp validation * replay attack resistance * duplicate event deduplication * idempotency controls * event delivery ordering ## Security headers Verify wherever relevant: * Content Security Policy (CSP) * HTTP Strict Transport Security (HSTS) * frame-ancestors directives * X-Content-Type-Options * Referrer-Policy * Permissions-Policy * CORS configurations --- # 10. DATABASE AND DATA INTEGRITY Analyze: * entity models * schema definitions * relation mappings * migration history * table constraints * index strategies * transaction boundaries Investigate: * missing foreign keys * missing unique constraints * nullable attributes that should be strictly non-nullable * hazardous default values * orphaned child records * unsafe cascading deletions * duplicate business records * race conditions during creation or update * lost updates * missing transaction boundaries * N+1 query patterns * unbounded database queries * expensive multi-table joins * missing pagination * missing index coverage * destructive schema migrations * migration and deployment version compatibility Specifically evaluate business invariants. If the application assumes: > a user can only possess a single X yet the database enforces no uniqueness constraint, report the structural risk. --- # 11. FRONTEND Inspect: * component hierarchy * custom hooks * state management * form handling * client-side routing * error boundaries * loading indicators * empty state rendering * responsive design Investigate: * unnecessary component re-renders * state duplication * redundant derived state storage * stale state persistence * missing or non-unique React keys * hook dependency array defects * infinite hook re-render loops * invalid hook usage * memory leaks * missing event listener cleanups * uncleaned interval or timeout timers * missing request cancellations * duplicate form submissions * hydration mismatches * oversized client components * unnecessary client-side JavaScript payloads --- # 12. NEXT.JS If Next.js is utilized, evaluate the exact running version and framework-specific behaviors. Inspect: * App Router structure * layouts * pages * route handlers * Server Components * Client Components * Server Actions * middleware and proxy chains * caching mechanisms * cache revalidation strategies * fetch behavior and cache defaults * dynamic vs static rendering * static site generation * metadata definitions * error.tsx boundaries * loading.tsx states * not-found.tsx handlers * redirect implementations * image optimization * font optimization Do not apply obsolete Next.js assumptions to newer framework versions. --- # 13. PERFORMANCE Do not restrict analysis to generic bundle size advice. Target concrete operational bottlenecks. Frontend: * bundle sizing * heavy third-party dependencies * excessive client JavaScript * rendering bottlenecks * hydration delays * unoptimized images * web font loading * network waterfalls * sequential resource fetching * duplicate API requests Backend: * database queries * N+1 query loops * serialized external API invocations * blocking event loop operations * excessive JSON serialization * massive response payloads * unbounded memory operations * CPU-intensive computations * memory bloat and leaks * connection timeouts * retry amplification storms Analyze behavior under load increases across: * concurrent users * total database rows * incoming request throughput * tenant counts * background worker jobs Never claim: > the application supports X users without empirical benchmark evidence. Highlight potential structural bottleneck locations instead. --- # 14. EXTERNAL SERVICES For every third-party integration determine: * initialization point * call site * response processing logic * state persistence mechanisms Verify: * timeout configurations * retry policies * malformed response handling * provider downtime resiliency * rate limit thresholds * duplicate request handling * partial failure mitigation * webhook synchronization * API version dependencies --- # 15. ERROR HANDLING Investigate: * empty catch blocks * silently swallowed errors * `console.log` substituted for proper error handling * generic 500 status codes * stack trace leakage to clients * internal infrastructure exposure * catch blocks lacking rollback logic * partial database writes * UI lacking error states Verify whether operational failures can leave the system in an inconsistent state. --- # 16. RELIABILITY Analyze: * retry strategies * idempotency guarantees * duplicate event processing * worker concurrency * background queues * scheduled cron jobs * crash recovery procedures * partial write recovery * resource cleanup * resource lifecycles * distributed race conditions If the application utilizes serverless infrastructure, evaluate assumptions regarding: * in-memory persistence * local filesystem durability * long-running background execution * background work continuing post-response * shared global state --- # 17. TEST SUITE Examine the test suite. Establish: * what tests genuinely validate * what tests merely simulate * what remains completely untested Search for: * test cases lacking meaningful assertions * tests that mock virtually all operational logic * flaky test behavior * fragile timing assumptions * snapshot testing abuse * duplicate test scenarios * obsolete test cases * tests out of sync with current implementations Highlight critical business workflows lacking: * unit tests * integration tests * end-to-end (E2E) tests If the tooling environment permits executing: * tests * linters * typecheckers * builds utilize the concrete results. If execution is impossible, do not claim they succeed. Mark as: **NOT VERIFIED** --- # 18. TEST THE ASSUMPTIONS OF THE TESTS Pay attention to cases where: ```text Tests PASS ``` solely because test fixtures never trigger latent bugs. Never use green test counts as proof of implementation correctness. --- # 19. DEPENDENCIES Inspect: * package.json * lockfiles * workspace configurations Search for: * unused dependencies * duplicate packages * deprecated packages * abandoned projects * known vulnerabilities * dependency version incompatibilities * outdated packages with compelling upgrade justifications * unnecessarily heavy libraries Do not report every package simply because a newer patch exists. Recommend upgrades only when concrete functional, stability, or security justifications exist. --- # 20. CI/CD Analyze every pipeline workflow. Verify: * triggers * token permissions * secret injection * caching strategies * build steps * test execution * linting * typechecking * deployment steps * database migration jobs * artifact handling * concurrency locks * failure handling Search for: * deployments executing despite failing tests * missing required branch checks * excessive token permissions * branch mismatch misconfigurations * production migration risks * concurrent deployment races * environment configuration drift --- # 21. CONFIGURATION Review all configuration manifests. For example: * package.json * tsconfig * eslint * prettier * next.config * vite * webpack * tailwind * postcss * Dockerfile * docker-compose * vercel.json * railway * turbo * pnpm-workspace * npmrc * gitignore * .env.example Identify contradictions between codified configuration and application source. --- # 22. ENVIRONMENT VARIABLES Establish: * inventory of all required environment variables * where variables are consumed * whether variables are documented * whether schema validation runs on boot * failure behavior when variables are absent * server vs client exposure boundaries Specifically detect accidental leakage of server-side secrets into client JavaScript bundles. --- # 23. UX Analyze user workflows directly from source code. Identify: * dead-end navigational paths * confusing user routing * excessive workflow steps * ambiguous calls to action (CTAs) * lack of visual feedback * unconfirmed destructive operations * forms susceptible to data loss * missing or inadequate loading states * missing or inadequate empty states * mobile layout overflow * excessive scrolling * broken responsive layout behavior * inconsistent user experiences Distinguish between: **BUG** and **UX IMPROVEMENT** --- # 24. ACCESSIBILITY Verify: * semantic HTML structures * heading hierarchy * form input labels * ARIA attributes * keyboard navigation * visible focus states * accessible dialogs * modal focus traps * image alt descriptions * screen reader error announcements * minimum touch target sizing * reduced motion preferences Do not file accessibility findings without concrete justifications. --- # 25. SEO Where relevant evaluate: * metadata definitions * page title structures * meta descriptions * canonical URLs * robots.txt directives * sitemap generation * OpenGraph tags * structured data schema * indexing directives * HTTP status codes --- # 26. PWA If progressive web app functionality exists: * web app manifest * service worker implementation * cache storage strategies * offline fallback states * installation criteria * cache invalidation logic * update and reload behaviors Specifically detect scenarios where users remain stranded on legacy bundles due to faulty caching. --- # 27. PRIVACY Map personal data traversal paths: ```text collection → processing → database → logs → analytics → external providers ``` Investigate: * unnecessary retention * sensitive diagnostic logging * excessive data capture * accidental client-side leakage --- # 28. OBSERVABILITY Assess whether developers can effectively triage production incidents. Review: * application logs * structured logging format * error tracking integrations * request identifiers * correlation IDs * audit logging * health check endpoints * metric collection * performance telemetry Do not recommend complex monitoring infrastructure if project scale does not warrant it. --- # 29. CODE QUALITY Target issues with tangible maintainability impact: * dead code * duplicated business logic * oversized functions * bloated component definitions * excessive nesting * ambiguous architectural boundaries * misleading naming conventions * undocumented magic literals * TODO comments * FIXME comments * HACK markers * temporary workarounds * commented-out code * obsolete compatibility shims Do not waste report space on subjective stylistic preferences. --- # 30. DEAD CODE Prior to declaring code dead: * search for static imports * search for dynamic imports * search for string-based references * verify file routing conventions * verify framework lifecycle conventions * check test suites * check operational scripts Use: **LIKELY DEAD** if conclusive proof cannot be established. --- # 31. DOCUMENTATION VS REALITY Compare: * README * documentation files * source comments * architecture diagrams against actual code. Identify: * obsolete setup commands * invalid configuration instructions * outdated environment variable names * obsolete screenshots or descriptions * documented features that have been removed * implemented features that are undocumented The code remains authoritative. --- # 32. FALSE-POSITIVE PREVENTION Before raising a critical finding, verify: 1. whether safeguards exist within the same file 2. parent wrapper guards 3. middleware protections 4. shared utility validation 5. framework native behavior 6. database-level constraints 7. infrastructure security layers 8. upstream caller validation 9. downstream callee assertions 10. test suites defining expected contracts If adequate protection exists at another layer, do not report an issue. --- # 33. FRAMEWORK-AWARE ANALYSIS Never label standard framework behavior as an architectural bug. Before concluding: * verify the active framework version * check project configuration settings * verify framework execution semantics If unfamiliar with a specific library version behavior, consult authoritative sources prior to reporting. --- # 34. REPOSITORY-WIDE SEARCH Actively inspect the repository for high-risk patterns: ```text TODO FIXME HACK XXX eslint-disable ts-ignore ts-expect-error any console. catch setTimeout setInterval dangerouslySetInnerHTML innerHTML eval exec spawn fetch axios process.env localStorage sessionStorage cookies redirect revalidate middleware admin role permission userId ownerId tenantId ``` A raw search result is not a finding. Every hit must be evaluated in its full operational context. --- # 35. DUPLICATED LOGIC When similar logic exists across multiple sites, verify whether divergence introduces behavioral drift. Specifically inspect: * validation logic * authorization policies * financial calculations * date manipulations * status state transitions * pricing calculations * permission checks --- # 36. BUSINESS LOGIC INVARIANTS Derive primary business invariants directly from the code. For example: ```text Only owner can edit resource. ``` Inspect every codepath modifying the resource. If five write paths exist, all five must uphold the invariant. Execute this check for every critical invariant identified. --- # 37. STATE MACHINE ANALYSIS If an entity tracks lifecycle states (e.g.): ```text draft pending approved rejected cancelled ``` identify the underlying state machine. Verify: * valid state transitions * forbidden transitions * duplicate transition handling * missing transition validation * impossible state combinations --- # 38. CREATE / READ / UPDATE / DELETE MATRIX For critical entities evaluate all: * CREATE * READ * UPDATE * DELETE codepaths. Ensure consistent enforcement of: * validation * authorization * tenancy scoping * audit logging * side-effect handling --- # 39. READ VS WRITE SECURITY Specifically verify whether: * READ is secured * UPDATE is unauthenticated or: * UI is restricted * API is public or: * GET enforces tenant boundaries * DELETE omits tenant scoping --- # 40. SERVER-CLIENT TRUST BOUNDARY Treat all incoming browser data as untrusted. Verify whether the server implicitly trusts: * role * price * userId * ownerId * tenantId * permissions * status * calculated totals * admin flags transmitted by client requests. --- # 41. PRODUCTION VS DEVELOPMENT Search for code functioning solely by coincidence in development. Specifically evaluate: * localhost assumptions * local filesystem dependencies * filesystem case sensitivity * environment variable fallbacks * mock service reliance * dev mode fallbacks * debug authorization bypasses * development seed fixtures * transient in-memory state --- # 42. BUILD-TIME VS RUNTIME Distinguish between: * compilation failures * build step errors * runtime crashes * server-only defects * browser-only defects * production-only failures Categorize findings accurately. --- # 43. SEVERITY Classify every confirmed finding: ## P0 - CRITICAL * full system compromise * unauthorized administrative access * catastrophic data loss * catastrophic financial damage * total failure of core business systems ## P1 - HIGH * severe production defect * critical security vulnerability * major reliability impairment * failure of primary business workflows ## P2 - MEDIUM * tangible operational defect with bounded blast radius ## P3 - LOW * minor defect or code maintainability issue ## P4 - IMPROVEMENT * non-defect architectural enhancement --- # 44. CONFIDENCE Mandatory classification: ```text HIGH MEDIUM LOW ``` ## HIGH Directly proven via source code or test execution. ## MEDIUM Strong static evidence present, but runtime confirmation absent. ## LOW Requires specialized infrastructure, runtime, or production configuration to verify. Never present a LOW confidence finding as an established fact. --- # 45. VERIFICATION STATUS Complement confidence with status labels: ```text CONFIRMED LIKELY THEORETICAL NOT VERIFIED ``` Example: ```text Severity: P1 Confidence: HIGH Status: CONFIRMED ``` --- # 46. EVIDENCE-FIRST FINDINGS Every significant finding must include: ```text ID: Severity: Category: Confidence: Status: Location: File: Function/Component: Relevant lines or code section: Description: Evidence: Execution/Data Flow: Reproduction scenario: Impact: Root cause: Recommended remediation: Complexity: XS / S / M / L / XL ``` --- # 47. DO NOT REPRODUCE FULL CODE Quote only the minimal relevant code snippet or line range to substantiate the finding. Focus on analysis rather than copying the repository. --- # 48. DUPLICATE FINDINGS When a single root cause manifests across multiple locations: create a single unified finding. Under: ```text Affected locations: ``` list the additional occurrences. --- # 49. DO NOT MODIFY CODE During this audit: * do not modify files * do not open pull requests * do not refactor code * do not alter dependencies * do not patch identified issues Complete the audit report first. If remediation is requested subsequently, use the audit as the blueprint. --- # 50. HIGHLIGHT WELL-IMPLEMENTED PATTERNS Do not search exclusively for defects. Document: * well-designed architectural boundaries * clean abstraction layers * robust security controls * high-quality test coverage * sound validation strategies * elegant error handling This ensures subsequent refactoring does not compromise existing strengths. --- # 51. OUTPUT - `AUDIT_REPORT.md` Structure the final output as a comprehensive, professional audit report. --- # 1. Executive Summary Detail: * core application functionality * overall architectural health * highest risk areas * key architectural strengths * production readiness status --- # 2. Scores Score from 0-10: ```text Architecture: Code Quality: Correctness: Security: Performance: Reliability: Data Integrity: Testing: UX: Accessibility: Observability: Documentation: DevOps: Production Readiness: ``` Provide concise justifications for each score. Never award high or low ratings without empirical justification. --- # 3. Architecture Explain the actual running architecture. --- # 4. Repository Map Provide a concise breakdown of key directories and their operational purposes. --- # 5. Critical User Flows Enumerate the primary end-to-end workflows traced during the audit. --- # 6. Repository Statistics Report only verifiable metrics. --- # 7. Findings Summary | ID | Severity | Category | Problem | Location | Confidence | Status | | -- | -------- | -------- | ------- | -------- | ---------- | ------ | --- # 8. P0 Critical Findings Detailed descriptions. --- # 9. P1 High Findings Detailed descriptions. --- # 10. P2 Medium Findings Detailed descriptions. --- # 11. P3 Low Findings Detailed descriptions. --- # 12. P4 Improvements Isolate enhancements from genuine operational defects. --- # 13. Security Audit Consolidated summary of security posture. --- # 14. Authentication & Authorization Matrix Construct a tabular matrix: | Feature/Route | Auth | Ownership | Role | Tenant Isolation | Result | | ------------- | ---- | --------- | ---- | ---------------- | ------ | --- # 15. API Audit For significant endpoints document: ```text METHOD /route Authentication: Authorization: Input validation: Data access: Side effects: Rate limiting: Error handling: Potential issue: ``` --- # 16. Data Integrity Audit Summary of database and integrity findings. --- # 17. Performance Audit Identify specific bottlenecks. --- # 18. Reliability Audit --- # 19. Testing Audit Enumerate: * high-value test suites * brittle or weak tests * missing test coverage * critical untested workflows --- # 20. Dependency Audit | Dependency | Status | Finding | Risk | Recommendation | | ---------- | ------ | ------- | ---- | -------------- | --- # 21. CI/CD Audit --- # 22. UX Findings --- # 23. Accessibility Findings --- # 24. SEO/PWA Findings Where applicable. --- # 25. Observability Findings --- # 26. Documentation Drift --- # 27. Dead / Legacy / Suspicious Code Classify: ```text CONFIRMED DEAD LIKELY DEAD LEGACY BUT USED UNKNOWN ``` --- # 28. Technical Debt Distinguish technical debt from active bugs. --- # 29. Production Readiness Checklist Utilize: ```text ✅ PASS ⚠️ PARTIAL ❌ FAIL ❓ NOT VERIFIED ➖ NOT APPLICABLE ``` Across: * clean install * build * lint * typecheck * unit tests * integration tests * E2E tests * auth * authorization * tenant isolation * validation * database constraints * migrations * error handling * external service failure * rate limiting * secrets * security headers * logging * monitoring * backups * performance * accessibility * responsive/mobile * SEO * PWA * CI * deployment * rollback * documentation --- # 30. Top Problems Construct two prioritized rankings: ## Top 10 by Risk Most critical issues regardless of remediation difficulty. ## Top 10 by ROI Issues offering the highest ratio of: ```text impact / effort ``` --- # 31. Remediation Roadmap ## Phase 0 - Emergency P0 issues. ## Phase 1 - Before Production / Immediate P1 issues. ## Phase 2 - Stabilization P2 issues. ## Phase 3 - Quality P3 issues. ## Phase 4 - Improvements P4 enhancements. Explain remediation dependencies across phases. --- # 32. Things Done Well Mandatory section. --- # 33. Unknowns / Not Verified Specifically enumerate items that could not be validated due to lack of: * runtime access * secret credentials * production environment access * direct database access * external provider access * deployment logs * private infrastructure access Do not convert unknowns into unproven findings. --- # 34. FINAL SECOND-PASS AUDIT When the audit appears complete, perform an additional comprehensive pass. Re-examine: * authentication * permissions * tenant boundaries * API write operations * destructive actions * financial computations * state transitions * webhooks * cron jobs and queues * database migrations * external integrations * error paths * concurrent operations * caching behavior * production configurations Ask: > What critical vulnerability or defect could have been overlooked because the system was initially analyzed from a repository structure perspective rather than through the lens of an attacker, user, or production incident? Execute three targeted mental passes: ### Attacker pass How would an adversary attempt to bypass controls? ### Failure pass What fails first if database, API, or network components degrade? ### User pass What realistic user interaction pattern was omitted from implementation assumptions? Incorporate newly discovered findings into the main audit. --- # 35. FINAL QUALITY GATE Prior to final submission, verify: * whether every P0/P1 finding is substantiated by concrete evidence * whether secondary defensive layers were checked * whether duplicate findings have been consolidated * whether theoretical issues are presented honestly as theoretical * whether critical business flows were omitted * whether enhancements were improperly categorized as bugs * whether scores align with reported findings * whether recommended fixes address genuine root causes * whether documentation claims reflect the actual codebase Where evidence is insufficient, soften claims or mark as NOT VERIFIED. --- # FINAL RULE Avoid generic audits that state: > "The code generally looks good, here are a few best practices." Operate as though the application launches into production tomorrow and you represent the final technical quality gate. Concurrently: **do not fabricate risks.** Reporting 12 substantiated issues is vastly superior to reporting 70 generic observations. Every significant conclusion must link directly to verified code, configurations, test outcomes, or clearly documented execution flows. The objective is a **forensically precise repository audit directly translatable into a concrete remediation plan and implementation tasks**.
分类与标签
编程开发、代码审计、架构分析、安全检查、测试覆盖、生产就绪