diff --git a/src/Api/Utilities/SecretsManagerAttribute.cs b/src/Api/Utilities/SecretsManagerAttribute.cs new file mode 100644 index 0000000000..44ba465861 --- /dev/null +++ b/src/Api/Utilities/SecretsManagerAttribute.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; + +namespace Bit.Api.Utilities +{ + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] + public class SecretsManagerAttribute : Attribute, IResourceFilter + { + public void OnResourceExecuting(ResourceExecutingContext context) + { + var env = context.HttpContext.RequestServices.GetService(); + if (!env.IsDevelopment()) + { + context.Result = new NotFoundResult(); + } + } + + public void OnResourceExecuted(ResourceExecutedContext context) { } + } +} +