Reduce max timeout to 30 seconds with configuration override#164
Reduce max timeout to 30 seconds with configuration override#164aaronpowell merged 5 commits intomainfrom
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
src/Teapot.Web/appsettings.json
Outdated
| }, | ||
| "Timeout": { | ||
| "MaxSleepMilliseconds": 30000 |
There was a problem hiding this comment.
@copilot let's not include this as I want the default deployed to be the default 30s
There was a problem hiding this comment.
Removed the Timeout configuration section from appsettings.json. The application will now use the hardcoded 30-second default, but administrators can still add the configuration section if they need to override it. (e24ddb6)
…efault Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
|
@copilot can we make it that if they submit a |
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Implemented BadRequest response for sleep values exceeding the maximum timeout. The application now returns HTTP 400 BadRequest when either the |
This PR addresses abuse of the timeout feature by reducing the maximum sleep timeout from 5 minutes to 30 seconds, while adding configuration support for administrators to override this limit.
Changes Made
🔧 Core Implementation
TimeoutOptionsconfiguration class with validationCustomHttpStatusCodeResultto accept configurable timeout via constructorStatusExtensionsmethods to use dependency injection for timeout configuration⚙️ Configuration Support
Added support for configuring the timeout via standard ASP.NET Core configuration:
{ "Timeout": { "MaxSleepMilliseconds": 30000 } }Also supports environment variables and command line arguments:
🧪 Testing & Quality Assurance
📚 Documentation Updates
Index.cshtmlto reflect new 30-second default instead of 5 minutesExample Usage
The timeout will now default to 30 seconds, but can be configured:
Benefits
Migration Notes
This change significantly reduces the potential for abuse while maintaining the flexibility that makes this service useful for testing and development scenarios.
Fixes #163.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
download.visualstudio.microsoft.comwget REDACTED(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.