बीटा Shoulder बीटा में है — परिणाम कभी-कभी गलत हो सकते हैं। आपकी प्रतिक्रिया तय करती है कि हम आगे क्या ठीक करें। प्रतिक्रिया साझा करें
🚫

Improper Access Control

🛡️ 4 नियम इसे पहचानते हैं

Improper Access Control

The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.

Access control involves determining which subjects can access which objects. When access control is implemented incorrectly, it can lead to unauthorized access to sensitive data or functionality.

व्यापकता
उच्च
बार-बार शोषित
प्रभाव
उच्च
3 उच्च गंभीरता वाले नियम
रोकथाम
प्रलेखित
4 फिक्स उदाहरण
2 रोकथाम
2 रोकथाम

इस भेद्यता को कैसे ठीक करें

4 Shoulder डिटेक्शन नियमों पर आधारित Improper Access Control के लिए रोकथाम रणनीतियाँ।

LLM Insecure Plugin Design HIGH

Validate tool inputs against strict schemas and use an allowlist for permitted tools

+18 -2 go
- func handleToolCall(toolCall ToolCall) (interface{}, error) {
-     return tools[toolCall.Name](toolCall.Arguments)
+ var toolRegistry = map[string]ToolConfig{
+     "search":  {Handler: searchHandler, Validator: validateSearch, Permission: "read"},
+     "weather": {Handler: weatherHandler, Validator: validateWeather, Permission: "read"},
+ }
+ 
+ func handleToolCall(userPerms map[string]bool, toolCall ToolCall) (interface{}, error) {
+     config, ok := toolRegistry[toolCall.Name]
+     if !ok {
+         return nil, fmt.Errorf("unknown tool: %s", toolCall.Name)
+     }
+     if !userPerms[config.Permission] {
+         return nil, fmt.Errorf("permission denied for tool: %s", toolCall.Name)
+     }
+     args, err := config.Validator(toolCall.Arguments)
+     if err != nil {
+         return nil, fmt.Errorf("invalid arguments: %w", err)
+     }
+     return config.Handler(args)
  }
  
LLM Insecure Plugin Design HIGH

Validate tool inputs against schemas and use allowlists for permitted tools

+10 -3 javascript
- for (const toolCall of response.tool_calls) {
-   const fn = tools[toolCall.function.name];
-   const result = await fn(JSON.parse(toolCall.function.arguments));
+ const allowedTools = new Set(['search', 'calculate', 'getWeather']);
+ 
+ for (const toolCall of response.tool_calls) {
+   if (!allowedTools.has(toolCall.function.name)) {
+     throw new Error('Unknown tool');
+   }
+   const validate = ajv.compile(toolSchemas[toolCall.function.name]);
+   const args = JSON.parse(toolCall.function.arguments);
+   if (!validate(args)) throw new Error('Invalid arguments');
+   await tools[toolCall.function.name](args);
  }
  
Missing Network Policy MEDIUM

Define NetworkPolicy resources to restrict pod-to-pod traffic and enforce network segmentation

+17 -11 yaml
- apiVersion: apps/v1
- kind: Deployment
- metadata:
-   name: web
- spec:
-   replicas: 3
-   template:
-     spec:
-       containers:
-       - name: web
-         image: nginx:1.25
+ apiVersion: networking.k8s.io/v1
+ kind: NetworkPolicy
+ metadata:
+   name: web-policy
+ spec:
+   podSelector:
+     matchLabels:
+       app: web
+   policyTypes:
+   - Ingress
+   ingress:
+   - from:
+     - podSelector:
+         matchLabels:
+           role: frontend
+     ports:
+     - port: 80
  
LLM Insecure Plugin Design HIGH

Use Pydantic for tool input validation and maintain a strict allowlist for permitted tools

+14 -4 python
- def handle_tool_call(tool_call):
-     name = tool_call.function.name
-     args = json.loads(tool_call.function.arguments)
-     return tools[name](args)
+ from pydantic import BaseModel, Field
+ 
+ class SearchArgs(BaseModel):
+     query: str = Field(max_length=100, pattern=r'^[a-zA-Z0-9\s]+$')
+ 
+ ALLOWED_TOOLS = {'search_products': SearchArgs, 'get_weather': WeatherArgs}
+ 
+ def handle_tool_call(tool_call):
+     name = tool_call.function.name
+     if name not in ALLOWED_TOOLS:
+         raise ValueError(f'Unknown tool: {name}')
+     schema = ALLOWED_TOOLS[name]
+     args = schema.parse_raw(tool_call.function.arguments)
+     return handlers[name](args)
  
3 पहचान
3 पहचान

अपने कोड में भेद्यताएँ खोजें

Improper Access Control पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 4 नियम.

टर्मिनल
# Scan with Shoulder CLI
npx @shoulderdev/cli trust --cwe=284

# Or scan entire project
npx @shoulderdev/cli trust .

पहचान नियम (4)

4 चेतावनी संकेत
4 चेतावनी संकेत

कोड समीक्षा में किन बातों पर ध्यान दें

ये पैटर्न संभावित Improper Access Control भेद्यताओं का संकेत देते हैं। कोड समीक्षा और सुरक्षा ऑडिट के दौरान इन्हें देखें।

🟠
Insecure plugin implementation: ... go-llm-insecure-plugin
🟠
insecure plugin/function calling implementations in AI/LLM systems without proper validation go-llm-insecure-plugin
🟡
Workload has no NetworkPolicy for network segmentation kubernetes-missing-network-policy
🟡
Kubernetes deployments without associated NetworkPolicy resources kubernetes-missing-network-policy
🔍

अपने कोडबेस को इसके लिए स्कैन करें: Improper Access Control

Shoulder CLI आपके पूरे कोडबेस में भेद्य पैटर्न खोजता है।