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

Allocation of Resources Without Limits or Throttling

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

Allocation of Resources Without Limits or Throttling

The product allocates a reusable resource or group of resources on behalf of an actor without imposing any restrictions on the size or number of resources that can be allocated.

Without limits on resource allocation, an attacker can consume all available resources, causing denial of service for legitimate users.

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

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

3 Shoulder डिटेक्शन नियमों पर आधारित Allocation Without Limits के लिए रोकथाम रणनीतियाँ।

Request Size Limits in Express.js MEDIUM

Set size limits on body parser middleware to prevent memory exhaustion

+2 -2 javascript
- app.use(express.json());
- app.use(express.urlencoded({ extended: true }));
+ app.use(express.json({ limit: '100kb' }));
+ app.use(express.urlencoded({ extended: true, limit: '100kb' }));
  
Prisma Unbounded Relation Loading MEDIUM

Add 'take' limits to all relation includes to prevent unbounded data loading and resource exhaustion

+9 -2 javascript
  import { PrismaClient } from '@prisma/client';
  const prisma = new PrismaClient();
  
  app.get('/api/users/:id', async (req, res) => {
    const user = await prisma.user.findUnique({
      where: { id: req.params.id },
      include: {
-       posts: true,         // Could be thousands of posts
-       comments: true,      // Could be tens of thousands
+       posts: {
+         take: 20,
+         orderBy: { createdAt: 'desc' },
+         select: { id: true, title: true, createdAt: true },
+       },
+       comments: {
+         take: 50,
+         orderBy: { createdAt: 'desc' },
+       },
      }
    });
    res.json(user);
  });
  
Missing API Rate Limiting MEDIUM

Add rate limiting to authentication and expensive API endpoints

+7 -2 python
  from flask import Flask, request, jsonify
- 
- @app.route('/api/login', methods=['POST'])
+ from flask_limiter import Limiter
+ from flask_limiter.util import get_remote_address
+ 
+ limiter = Limiter(app=app, key_func=get_remote_address)
+ 
+ @app.route('/api/login', methods=['POST'])
+ @limiter.limit("5 per minute")
  def login():
      user = authenticate(request.json)
      return jsonify({'token': generate_token(user)})
  
3 पहचान
3 पहचान

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

Allocation of Resources Without Limits or Throttling पैटर्न के लिए अपने कोडबेस को स्कैन करने के लिए Shoulder का उपयोग करें। 3 नियम.

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

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

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

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

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

ये पैटर्न संभावित Allocation of Resources Without Limits or Throttling भेद्यताओं का संकेत देते हैं। कोड समीक्षा और सुरक्षा ऑडिट के दौरान इन्हें देखें।

🟡
Body parser without size limit: ... Without request size limits, attackers can send oversized payloads causing memory ex javascript-express-request-size-limits
🟡
missing or inadequate request size limits in Express javascript-express-request-size-limits
🟡
Relation '...' loaded without 'take' limit. This can cause resource exhaustion if users have many related records. prisma-unsafe-include
🟡
API endpoint lacks rate limiting protection python-missing-rate-limiting
🟡
API endpoints without rate limiting python-missing-rate-limiting
🔍

अपने कोडबेस को इसके लिए स्कैन करें: Allocation of Resources Without Limits or Throttling

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