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-0003: Three-hop call chain with command injection
// Expected: REACHABLE (tier: executed)
// Vulnerability: CWE-78 (OS Command Injection)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void execute_command(const char *cmd) {
// Vulnerable: system call with user input
system(cmd); // SINK: CWE-78
}
void process_input(const char *input) {
char command[256];
snprintf(command, sizeof(command), "echo %s", input);
execute_command(command);
}
int main(int argc, char *argv[]) {
if (argc > 1) {
process_input(argv[1]);
}
return 0;
}

View File

@@ -0,0 +1,31 @@
{
"$schema": "https://stellaops.io/schemas/sample-manifest.v1.json",
"sampleId": "gt-0003",
"version": "1.0.0",
"category": "basic",
"description": "Three-hop call chain with multiple sinks - REACHABLE",
"language": "c",
"expectedResult": {
"reachable": true,
"tier": "executed",
"confidence": 1.0
},
"source": {
"files": ["main.c"],
"entrypoint": "main",
"sink": "system",
"vulnerability": "CWE-78"
},
"callChain": [
{"function": "main", "file": "main.c", "line": 20},
{"function": "process_input", "file": "main.c", "line": 12},
{"function": "execute_command", "file": "main.c", "line": 6},
{"function": "system", "file": "<libc>", "line": null}
],
"annotations": {
"notes": "Three-hop chain demonstrating command injection path",
"difficulty": "easy"
},
"createdAt": "2025-12-17T00:00:00Z",
"createdBy": "corpus-team"
}