feat(rate-limiting): Implement core rate limiting functionality with configuration, decision-making, metrics, middleware, and service registration

- Add RateLimitConfig for configuration management with YAML binding support.
- Introduce RateLimitDecision to encapsulate the result of rate limit checks.
- Implement RateLimitMetrics for OpenTelemetry metrics tracking.
- Create RateLimitMiddleware for enforcing rate limits on incoming requests.
- Develop RateLimitService to orchestrate instance and environment rate limit checks.
- Add RateLimitServiceCollectionExtensions for dependency injection registration.
This commit is contained in:
master
2025-12-17 18:02:37 +02:00
parent 394b57f6bf
commit 8bbfe4d2d2
211 changed files with 47179 additions and 1590 deletions

View File

@@ -0,0 +1,25 @@
// gt-0011: Dead code - function never called
// Expected: UNREACHABLE (tier: imported)
// Vulnerability: CWE-120 (Buffer Copy without Checking Size)
#include <stdio.h>
#include <string.h>
// This function is NEVER called - dead code
void vulnerable_function(const char *input) {
char buffer[32];
strcpy(buffer, input); // SINK: CWE-120 (but unreachable)
printf("Value: %s\n", buffer);
}
void safe_function(const char *input) {
printf("Safe: %.31s\n", input);
}
int main(int argc, char *argv[]) {
if (argc > 1) {
// Only safe_function is called
safe_function(argv[1]);
}
return 0;
}

View File

@@ -0,0 +1,27 @@
{
"$schema": "https://stellaops.io/schemas/sample-manifest.v1.json",
"sampleId": "gt-0011",
"version": "1.0.0",
"category": "unreachable",
"description": "Dead code - function never called - UNREACHABLE",
"language": "c",
"expectedResult": {
"reachable": false,
"tier": "imported",
"confidence": 1.0
},
"source": {
"files": ["main.c"],
"entrypoint": "main",
"sink": "strcpy",
"vulnerability": "CWE-120"
},
"callChain": null,
"annotations": {
"notes": "Vulnerable function exists but is never called from any reachable path",
"difficulty": "trivial",
"reason": "dead_code"
},
"createdAt": "2025-12-17T00:00:00Z",
"createdBy": "corpus-team"
}