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:
31
datasets/reachability/ground-truth/basic/gt-0005/main.c
Normal file
31
datasets/reachability/ground-truth/basic/gt-0005/main.c
Normal file
@@ -0,0 +1,31 @@
|
||||
// gt-0005: Recursive function with sink
|
||||
// Expected: REACHABLE (tier: executed)
|
||||
// Vulnerability: CWE-134 (Format String)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char result[1024];
|
||||
|
||||
void process_recursive(const char *input, int depth) {
|
||||
if (depth <= 0 || strlen(input) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Vulnerable: format string in recursive context
|
||||
sprintf(result + strlen(result), input); // SINK: CWE-134
|
||||
|
||||
// Recurse with modified input
|
||||
process_recursive(input + 1, depth - 1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
result[0] = '\0';
|
||||
|
||||
if (argc > 1) {
|
||||
process_recursive(argv[1], 5);
|
||||
printf("Result: %s\n", result);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user