@blueking/bkui-knowledge 0.0.1-beta.1 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +166 -58
  2. package/bin/bkui-knowledge.js +147 -82
  3. package/knowledge/manifest.json +38 -1
  4. package/knowledge/skills/.template/README.md +1 -1
  5. package/knowledge/skills/bk-security-redlines/SKILL.md +47 -0
  6. package/knowledge/skills/bk-security-redlines/references/auth-check.md +73 -0
  7. package/knowledge/skills/bk-security-redlines/references/data-encryption.md +78 -0
  8. package/knowledge/skills/bk-security-redlines/references/input-validation.md +96 -0
  9. package/knowledge/skills/bk-skill-creator/SKILL.md +37 -0
  10. package/knowledge/skills/bk-skill-creator/references/common-mistakes.md +43 -0
  11. package/knowledge/skills/bk-skill-creator/references/quick-start.md +42 -0
  12. package/knowledge/skills/bk-skill-creator/references/skill-checklist.md +93 -0
  13. package/knowledge/skills/bk-skill-creator/references/structure-guide.md +88 -0
  14. package/knowledge/skills/bk-skill-creator/references/writing-tips.md +153 -0
  15. package/knowledge/skills/bkui-quick-start/SKILL.md +52 -0
  16. package/knowledge/skills/bkui-quick-start/references/components-list.md +17 -0
  17. package/knowledge/skills/bkui-quick-start/references/skills-index.md +26 -0
  18. package/knowledge/skills/external/vue-skills/LICENSE +21 -0
  19. package/knowledge/skills/external/vue-skills/README.md +69 -0
  20. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/SKILL.md +42 -0
  21. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/codeactions-save-performance.md +79 -0
  22. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/data-attributes-config.md +74 -0
  23. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/deep-watch-numeric.md +102 -0
  24. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/define-model-update-event.md +79 -0
  25. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/duplicate-plugin-detection.md +102 -0
  26. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/fallthrough-attributes.md +63 -0
  27. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/hmr-vue-ssr.md +124 -0
  28. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/module-resolution-bundler.md +81 -0
  29. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/pinia-store-mocking.md +159 -0
  30. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/script-setup-jsdoc.md +85 -0
  31. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/strict-css-modules.md +68 -0
  32. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/unplugin-auto-import-conflicts.md +97 -0
  33. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/volar-3-breaking-changes.md +66 -0
  34. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-directive-comments.md +73 -0
  35. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-router-typed-params.md +81 -0
  36. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/vue-tsc-strict-templates.md +69 -0
  37. package/knowledge/skills/external/vue-skills/skills/vue-best-practices/rules/with-defaults-union-types.md +102 -0
  38. package/knowledge/skills/web-security-guide/SKILL.md +48 -0
  39. package/knowledge/skills/web-security-guide/references/access-control.md +123 -0
  40. package/knowledge/skills/web-security-guide/references/auth-session.md +99 -0
  41. package/knowledge/skills/web-security-guide/references/csrf.md +59 -0
  42. package/knowledge/skills/web-security-guide/references/data-exposure.md +108 -0
  43. package/knowledge/skills/web-security-guide/references/deserialization.md +59 -0
  44. package/knowledge/skills/web-security-guide/references/injection.md +357 -0
  45. package/knowledge/skills/web-security-guide/references/logging-monitoring.md +47 -0
  46. package/knowledge/skills/web-security-guide/references/security-config.md +73 -0
  47. package/knowledge/skills/web-security-guide/references/ssrf.md +55 -0
  48. package/knowledge/skills/web-security-guide/references/xss.md +134 -0
  49. package/package.json +3 -3
  50. package/server/mcp-core.js +48 -33
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Enable Strict CSS Modules Type Checking
3
+ impact: MEDIUM
4
+ impactDescription: catches typos in CSS module class names at compile time
5
+ type: capability
6
+ tags: strictCssModules, vueCompilerOptions, css-modules, style-module
7
+ ---
8
+
9
+ # Enable Strict CSS Modules Type Checking
10
+
11
+ **Impact: MEDIUM** - catches typos in CSS module class names at compile time
12
+
13
+ When using CSS modules with `<style module>`, Vue doesn't validate class names by default. Enable `strictCssModules` to catch typos and undefined classes.
14
+
15
+ ## Problem
16
+
17
+ CSS module class name errors go undetected:
18
+
19
+ ```vue
20
+ <script setup lang="ts">
21
+ // No error for typo in class name
22
+ </script>
23
+
24
+ <template>
25
+ <div :class="$style.buttn">Click me</div>
26
+ </template>
27
+
28
+ <style module>
29
+ .button {
30
+ background: blue;
31
+ }
32
+ </style>
33
+ ```
34
+
35
+ The typo `buttn` instead of `button` silently fails at runtime.
36
+
37
+ ## Solution
38
+
39
+ Enable `strictCssModules` in your tsconfig:
40
+
41
+ ```json
42
+ // tsconfig.json or tsconfig.app.json
43
+ {
44
+ "vueCompilerOptions": {
45
+ "strictCssModules": true
46
+ }
47
+ }
48
+ ```
49
+
50
+ Now `$style.buttn` will show a type error because `buttn` doesn't exist in the CSS module.
51
+
52
+ ## What Gets Checked
53
+
54
+ | Access | With strictCssModules |
55
+ |--------|----------------------|
56
+ | `$style.validClass` | OK |
57
+ | `$style.typo` | Error: Property 'typo' does not exist |
58
+ | `$style['dynamic']` | OK (dynamic access not checked) |
59
+
60
+ ## Limitations
61
+
62
+ - Only checks static property access (`$style.className`)
63
+ - Dynamic access (`$style[variable]`) is not validated
64
+ - Only works with `<style module>`, not external CSS files
65
+
66
+ ## Reference
67
+
68
+ - [Vue Language Tools Wiki - Vue Compiler Options](https://github.com/vuejs/language-tools/wiki/Vue-Compiler-Options)
@@ -0,0 +1,97 @@
1
+ ---
2
+ title: unplugin-vue-components and unplugin-auto-import Type Conflicts
3
+ impact: HIGH
4
+ impactDescription: fixes component types resolving as any when using both plugins
5
+ type: capability
6
+ tags: unplugin-vue-components, unplugin-auto-import, types, any, dts
7
+ ---
8
+
9
+ # unplugin-vue-components and unplugin-auto-import Type Conflicts
10
+
11
+ **Impact: HIGH** - fixes component types resolving as any when using both plugins
12
+
13
+ Installing both `unplugin-vue-components` and `unplugin-auto-import` can cause component types to resolve as `any`. The generated `.d.ts` files conflict with each other.
14
+
15
+ ## Symptoms
16
+
17
+ - Components typed as `any` instead of proper component types
18
+ - No autocomplete for component props
19
+ - No type errors for invalid props
20
+ - Types work when using only one plugin but break with both
21
+
22
+ ## Root Cause
23
+
24
+ Both plugins generate declaration files (`components.d.ts` and `auto-imports.d.ts`) that can have conflicting declarations. TypeScript declaration merging fails silently.
25
+
26
+ ## Fix
27
+
28
+ **Step 1: Ensure both .d.ts files are in tsconfig include**
29
+ ```json
30
+ {
31
+ "include": [
32
+ "src/**/*.ts",
33
+ "src/**/*.vue",
34
+ "components.d.ts",
35
+ "auto-imports.d.ts"
36
+ ]
37
+ }
38
+ ```
39
+
40
+ **Step 2: Set explicit, different dts paths**
41
+ ```typescript
42
+ // vite.config.ts
43
+ import Components from 'unplugin-vue-components/vite'
44
+ import AutoImport from 'unplugin-auto-import/vite'
45
+
46
+ export default defineConfig({
47
+ plugins: [
48
+ Components({
49
+ dts: 'src/types/components.d.ts' // Explicit unique path
50
+ }),
51
+ AutoImport({
52
+ dts: 'src/types/auto-imports.d.ts' // Explicit unique path
53
+ })
54
+ ]
55
+ })
56
+ ```
57
+
58
+ **Step 3: Regenerate type files**
59
+ ```bash
60
+ # Delete existing .d.ts files
61
+ rm components.d.ts auto-imports.d.ts
62
+
63
+ # Restart dev server to regenerate
64
+ npm run dev
65
+ ```
66
+
67
+ **Step 4: Verify no duplicate declarations**
68
+
69
+ Check that the same component isn't declared in both files.
70
+
71
+ ## Plugin Order Matters
72
+
73
+ Configure Components plugin AFTER AutoImport:
74
+ ```typescript
75
+ plugins: [
76
+ AutoImport({ /* ... */ }),
77
+ Components({ /* ... */ }) // Must come after AutoImport
78
+ ]
79
+ ```
80
+
81
+ ## Common Mistake: Duplicate Imports
82
+
83
+ Don't configure the same import in both plugins:
84
+ ```typescript
85
+ // Wrong - Vue imported in both
86
+ AutoImport({
87
+ imports: ['vue']
88
+ })
89
+ Components({
90
+ resolvers: [/* includes Vue components */]
91
+ })
92
+ ```
93
+
94
+ ## Reference
95
+
96
+ - [unplugin-vue-components#640](https://github.com/unplugin/unplugin-vue-components/issues/640)
97
+ - [unplugin-auto-import docs](https://github.com/unplugin/unplugin-auto-import)
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Volar 3.0 Breaking Changes
3
+ impact: HIGH
4
+ impactDescription: fixes editor integration after Volar/vue-language-server upgrade
5
+ type: capability
6
+ tags: volar, vue-language-server, neovim, vscode, ide, ts_ls, vtsls
7
+ ---
8
+
9
+ # Volar 3.0 Breaking Changes
10
+
11
+ **Impact: HIGH** - fixes editor integration after Volar/vue-language-server upgrade
12
+
13
+ Volar 3.0 (vue-language-server 3.x) introduced breaking changes to the language server protocol. Editors configured for Volar 2.x will break with errors like "vue_ls doesn't work with ts_ls.. it expects vtsls".
14
+
15
+ ## Symptoms
16
+
17
+ - `vue_ls doesn't work with ts_ls`
18
+ - TypeScript features stop working in Vue files
19
+ - No autocomplete, type hints, or error highlighting
20
+ - Editor shows "Language server initialization failed"
21
+
22
+ ## Fix by Editor
23
+
24
+ ### VSCode
25
+
26
+ Update the "Vue - Official" extension to latest version. It manages the language server automatically.
27
+
28
+ ### NeoVim (nvim-lspconfig)
29
+
30
+ **Option 1: Use vtsls instead of ts_ls**
31
+ ```lua
32
+ -- Replace ts_ls/tsserver with vtsls
33
+ require('lspconfig').vtsls.setup({})
34
+ require('lspconfig').volar.setup({})
35
+ ```
36
+
37
+ **Option 2: Downgrade vue-language-server**
38
+ ```bash
39
+ npm install -g @vue/language-server@2.1.10
40
+ ```
41
+
42
+ ### JetBrains IDEs
43
+
44
+ Update to latest Vue plugin. If issues persist, disable and re-enable the Vue plugin.
45
+
46
+ ## What Changed in 3.0
47
+
48
+ | Feature | Volar 2.x | Volar 3.0 |
49
+ |---------|-----------|-----------|
50
+ | Package name | volar | vue_ls |
51
+ | TypeScript integration | ts_ls/tsserver | vtsls required |
52
+ | Hybrid mode | Optional | Default |
53
+
54
+ ## Workaround: Stay on 2.x
55
+
56
+ If upgrading is not possible:
57
+ ```bash
58
+ npm install -g @vue/language-server@^2.0.0
59
+ ```
60
+
61
+ Pin in your project's package.json to prevent accidental upgrades.
62
+
63
+ ## Reference
64
+
65
+ - [vuejs/language-tools#5598](https://github.com/vuejs/language-tools/issues/5598)
66
+ - [NeoVim Vue Setup Guide](https://dev.to/danwalsh/solved-vue-3-typescript-inlay-hint-support-in-neovim-53ej)
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: Vue Template Directive Comments
3
+ impact: HIGH
4
+ impactDescription: enables fine-grained control over template type checking
5
+ type: capability
6
+ tags: vue-directive, vue-ignore, vue-expect-error, vue-skip, template, type-checking
7
+ ---
8
+
9
+ # Vue Template Directive Comments
10
+
11
+ **Impact: HIGH** - enables fine-grained control over template type checking
12
+
13
+ Vue Language Tools supports special directive comments to control type checking behavior in templates.
14
+
15
+ ## Available Directives
16
+
17
+ ### @vue-ignore
18
+
19
+ Suppress type errors for the next line:
20
+
21
+ ```vue
22
+ <template>
23
+ <!-- @vue-ignore -->
24
+ <Component :prop="valueWithTypeError" />
25
+ </template>
26
+ ```
27
+
28
+ ### @vue-expect-error
29
+
30
+ Assert that the next line should have a type error (useful for testing):
31
+
32
+ ```vue
33
+ <template>
34
+ <!-- @vue-expect-error -->
35
+ <Component :invalid-prop="value" />
36
+ </template>
37
+ ```
38
+
39
+ ### @vue-skip
40
+
41
+ Skip type checking for an entire block:
42
+
43
+ ```vue
44
+ <template>
45
+ <!-- @vue-skip -->
46
+ <div>
47
+ <!-- Everything in here is not type-checked -->
48
+ <LegacyComponent :any="props" :go="here" />
49
+ </div>
50
+ </template>
51
+ ```
52
+
53
+ ### @vue-generic
54
+
55
+ Declare template-level generic types:
56
+
57
+ ```vue
58
+ <template>
59
+ <!-- @vue-generic {T extends string} -->
60
+ <GenericList :items="items as T[]" />
61
+ </template>
62
+ ```
63
+
64
+ ## Use Cases
65
+
66
+ - Migrating legacy components with incomplete types
67
+ - Working with third-party components that have incorrect type definitions
68
+ - Temporarily suppressing errors during refactoring
69
+ - Testing that certain patterns produce expected type errors
70
+
71
+ ## Reference
72
+
73
+ - [Vue Language Tools Wiki - Directive Comments](https://github.com/vuejs/language-tools/wiki/Directive-Comments)
@@ -0,0 +1,81 @@
1
+ ---
2
+ title: Vue Router useRoute Params Union Type Narrowing
3
+ impact: MEDIUM
4
+ impactDescription: fixes "Property does not exist" errors with typed route params
5
+ type: capability
6
+ tags: vue-router, useRoute, unplugin-vue-router, typed-routes, params
7
+ ---
8
+
9
+ # Vue Router useRoute Params Union Type Narrowing
10
+
11
+ **Impact: MEDIUM** - fixes "Property does not exist" errors with typed route params
12
+
13
+ With `unplugin-vue-router` typed routes, `route.params` becomes a union of ALL page param types. TypeScript cannot narrow `Record<never, never> | { id: string }` properly, causing "Property 'id' does not exist" errors even on the correct page.
14
+
15
+ ## Symptoms
16
+
17
+ - "Property 'id' does not exist on type 'RouteParams'"
18
+ - `route.params.id` shows as `string | undefined` everywhere
19
+ - Union type of all route params instead of specific route
20
+ - Type narrowing with `if (route.name === 'users-id')` doesn't work
21
+
22
+ ## Root Cause
23
+
24
+ `unplugin-vue-router` generates a union type of all possible route params. TypeScript's control flow analysis can't narrow this union based on route name checks.
25
+
26
+ ## Fix
27
+
28
+ **Option 1: Pass route name to useRoute (recommended)**
29
+ ```typescript
30
+ // pages/users/[id].vue
31
+ import { useRoute } from 'vue-router/auto'
32
+
33
+ // Specify the route path for proper typing
34
+ const route = useRoute('/users/[id]')
35
+
36
+ // Now properly typed as { id: string }
37
+ console.log(route.params.id) // string, not string | undefined
38
+ ```
39
+
40
+ **Option 2: Type assertion with specific route**
41
+ ```typescript
42
+ import { useRoute } from 'vue-router'
43
+ import type { RouteLocationNormalized } from 'vue-router/auto-routes'
44
+
45
+ const route = useRoute() as RouteLocationNormalized<'/users/[id]'>
46
+ route.params.id // Properly typed
47
+ ```
48
+
49
+ **Option 3: Define route-specific param type**
50
+ ```typescript
51
+ // In your page component
52
+ interface UserRouteParams {
53
+ id: string
54
+ }
55
+
56
+ const route = useRoute()
57
+ const { id } = route.params as UserRouteParams
58
+ ```
59
+
60
+ ## Required tsconfig Setting
61
+
62
+ Ensure `moduleResolution: "bundler"` for unplugin-vue-router:
63
+ ```json
64
+ {
65
+ "compilerOptions": {
66
+ "moduleResolution": "bundler"
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Caveat: Route Name Format
72
+
73
+ The route name matches the file path pattern:
74
+ - `pages/users/[id].vue` → `/users/[id]`
75
+ - `pages/posts/[slug]/comments.vue` → `/posts/[slug]/comments`
76
+
77
+ ## Reference
78
+
79
+ - [unplugin-vue-router#337](https://github.com/posva/unplugin-vue-router/issues/337)
80
+ - [unplugin-vue-router#176](https://github.com/posva/unplugin-vue-router/discussions/176)
81
+ - [unplugin-vue-router TypeScript docs](https://uvr.esm.is/guide/typescript.html)
@@ -0,0 +1,69 @@
1
+ ---
2
+ title: Enable Strict Template Checking
3
+ impact: HIGH
4
+ impactDescription: catches undefined components and props at compile time
5
+ type: capability
6
+ tags: vue-tsc, typescript, type-checking, templates, vueCompilerOptions
7
+ ---
8
+
9
+ # Enable Strict Template Checking
10
+
11
+ **Impact: HIGH** - catches undefined components and props at compile time
12
+
13
+ By default, vue-tsc does not report errors for undefined components in templates. Enable `strictTemplates` to catch these issues during type checking.
14
+
15
+ ## Which tsconfig?
16
+
17
+ Add `vueCompilerOptions` to the tsconfig that includes Vue source files. In projects with multiple tsconfigs (like those created with `create-vue`), this is typically `tsconfig.app.json`, not the root `tsconfig.json` or `tsconfig.node.json`.
18
+
19
+ **Incorrect (missing strict checking):**
20
+
21
+ ```json
22
+ {
23
+ "compilerOptions": {
24
+ "strict": true
25
+ }
26
+ // vueCompilerOptions not configured - undefined components won't error
27
+ }
28
+ ```
29
+
30
+ **Correct (strict template checking enabled):**
31
+
32
+ ```json
33
+ {
34
+ "compilerOptions": {
35
+ "strict": true
36
+ },
37
+ "vueCompilerOptions": {
38
+ "strictTemplates": true
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Available Options
44
+
45
+ | Option | Default | Effect |
46
+ |--------|---------|--------|
47
+ | `strictTemplates` | `false` | Enables all checkUnknown* options below |
48
+ | `checkUnknownComponents` | `false` | Error on undefined/unregistered components |
49
+ | `checkUnknownProps` | `false` | Error on props not declared in component definition |
50
+ | `checkUnknownEvents` | `false` | Error on events not declared via `defineEmits` |
51
+ | `checkUnknownDirectives` | `false` | Error on unregistered custom directives |
52
+
53
+ ## Granular Control
54
+
55
+ If `strictTemplates` is too strict, enable individual checks:
56
+
57
+ ```json
58
+ {
59
+ "vueCompilerOptions": {
60
+ "checkUnknownComponents": true,
61
+ "checkUnknownProps": false
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Reference
67
+
68
+ - [Vue Compiler Options](https://github.com/vuejs/language-tools/wiki/Vue-Compiler-Options)
69
+ - [Vite Vue+TS Template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-vue-ts)
@@ -0,0 +1,102 @@
1
+ ---
2
+ title: withDefaults Incorrect Default with Union Types
3
+ impact: MEDIUM
4
+ impactDescription: fixes incorrect default value behavior with union type props
5
+ type: capability
6
+ tags: withDefaults, defineProps, union-types, defaults, vue-3.5
7
+ ---
8
+
9
+ # withDefaults Incorrect Default with Union Types
10
+
11
+ **Impact: MEDIUM** - fixes spurious "Missing required prop" warning with union type props
12
+
13
+ Using `withDefaults` with union types like `false | string` may produce a Vue runtime warning "Missing required prop" even when a default is provided. The runtime value IS applied correctly, but the warning can be confusing.
14
+
15
+ ## Symptoms
16
+
17
+ - Vue warns "Missing required prop" despite default being set
18
+ - Warning appears only with union types like `false | string`
19
+ - TypeScript types are correct
20
+ - Runtime value IS correct (the default is applied)
21
+
22
+ ## Problematic Pattern
23
+
24
+ ```typescript
25
+ // This produces a spurious warning (but works at runtime)
26
+ interface Props {
27
+ value: false | string // Union type
28
+ }
29
+
30
+ const props = withDefaults(defineProps<Props>(), {
31
+ value: 'default' // Runtime value IS correct, but Vue warns about missing prop
32
+ })
33
+ ```
34
+
35
+ ## Fix
36
+
37
+ **Option 1: Use Reactive Props Destructure (Vue 3.5+)**
38
+ ```vue
39
+ <script setup lang="ts">
40
+ interface Props {
41
+ value: false | string
42
+ }
43
+
44
+ // Preferred in Vue 3.5+
45
+ const { value = 'default' } = defineProps<Props>()
46
+ </script>
47
+ ```
48
+
49
+ **Option 2: Use runtime declaration**
50
+ ```vue
51
+ <script setup lang="ts">
52
+ const props = defineProps({
53
+ value: {
54
+ type: [Boolean, String] as PropType<false | string>,
55
+ default: 'default'
56
+ }
57
+ })
58
+ </script>
59
+ ```
60
+
61
+ **Option 3: Split into separate props**
62
+ ```typescript
63
+ interface Props {
64
+ enabled: boolean
65
+ customValue?: string
66
+ }
67
+
68
+ const props = withDefaults(defineProps<Props>(), {
69
+ enabled: false,
70
+ customValue: 'default'
71
+ })
72
+ ```
73
+
74
+ ## Why Reactive Props Destructure Works
75
+
76
+ Vue 3.5's Reactive Props Destructure handles default values at the destructuring level, bypassing the type inference issues with `withDefaults`.
77
+
78
+ ```typescript
79
+ // The default is applied during destructuring, not type inference
80
+ const { prop = 'default' } = defineProps<{ prop?: string }>()
81
+ ```
82
+
83
+ ## Enable Reactive Props Destructure
84
+
85
+ This is enabled by default in Vue 3.5+. For older versions:
86
+ ```javascript
87
+ // vite.config.js
88
+ export default {
89
+ plugins: [
90
+ vue({
91
+ script: {
92
+ propsDestructure: true
93
+ }
94
+ })
95
+ ]
96
+ }
97
+ ```
98
+
99
+ ## Reference
100
+
101
+ - [vuejs/core#12897](https://github.com/vuejs/core/issues/12897)
102
+ - [Reactive Props Destructure RFC](https://github.com/vuejs/rfcs/discussions/502)
@@ -0,0 +1,48 @@
1
+ ---
2
+ id: security/web-security-guide
3
+ name: Web 安全漏洞学习指南
4
+ category: security
5
+ description: OWASP 十大漏洞原理、影响与修复方案,覆盖 Python/Java 场景
6
+ tags: [security, owasp, vulnerability, injection, xss, csrf, ssrf]
7
+ updated_at: 2026-01-23
8
+ ---
9
+
10
+ # Web 安全漏洞学习指南
11
+
12
+ ## ⚠️ 核心规则
13
+
14
+ 1. **永不信任用户输入** - 所有外部数据必须校验、转义、参数化
15
+ 2. **最小权限原则** - 仅授予完成任务所需的最小权限
16
+ 3. **纵深防御** - 多层安全措施,不依赖单一防护
17
+
18
+ ## 十大漏洞速查
19
+
20
+ | 漏洞 | 危害 | 核心防御 |
21
+ |------|------|----------|
22
+ | 🔴 注入 | RCE/数据泄露 | 参数化查询 |
23
+ | 🔴 XSS | 会话劫持 | 转义输出 |
24
+ | 🔴 认证缺陷 | 账户接管 | 强Token+限速 |
25
+ | 🔴 敏感数据泄露 | 隐私泄露 | 加密+脱敏 |
26
+ | 🔴 访问控制缺失 | 越权操作 | 后端鉴权 |
27
+ | 🟡 安全配置错误 | 信息泄露 | 关闭Debug |
28
+ | 🟡 CSRF | 伪造操作 | Token验证 |
29
+ | 🟡 反序列化 | RCE | 禁用危险接口 |
30
+ | 🟡 SSRF | 内网探测 | 白名单URL |
31
+ | ⚪ 日志不足 | 无法溯源 | 完整审计 |
32
+
33
+ ## 📦 按需加载资源
34
+
35
+ | 漏洞类型 | URI |
36
+ |----------|-----|
37
+ | 注入漏洞 | `skill://web-security-guide/references/injection.md` |
38
+ | XSS攻击 | `skill://web-security-guide/references/xss.md` |
39
+ | 认证会话 | `skill://web-security-guide/references/auth-session.md` |
40
+ | 数据泄露 | `skill://web-security-guide/references/data-exposure.md` |
41
+ | 访问控制 | `skill://web-security-guide/references/access-control.md` |
42
+ | 配置错误 | `skill://web-security-guide/references/security-config.md` |
43
+ | CSRF | `skill://web-security-guide/references/csrf.md` |
44
+ | 反序列化 | `skill://web-security-guide/references/deserialization.md` |
45
+ | SSRF | `skill://web-security-guide/references/ssrf.md` |
46
+ | 日志监控 | `skill://web-security-guide/references/logging-monitoring.md` |
47
+
48
+ > 💡 先用速查表定位问题,再按需加载详细文档