CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/aspnet-security-basics

Security defaults that belong in every ASP.NET Core application from day one.

87

1.91x
Quality

83%

Does it follow best practices?

Impact

94%

1.91x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Build an E-Commerce Order API with ASP.NET Core

Problem/Feature Description

An e-commerce company needs an order management API built with ASP.NET Core and C#. A Vue.js storefront on https://store.example.com will consume this API. Customers browse products, add items to a cart, and place orders.

The API needs the following endpoints:

  • GET /api/products -- list available products (public, supports ?category=electronics&sort=price)
  • GET /api/products/{id} -- get product details (public)
  • POST /api/orders -- place a new order (authenticated, accepts items array with productId and quantity, plus shippingAddress)
  • GET /api/orders -- list the current user's orders (authenticated)
  • GET /api/orders/{id} -- get order details (authenticated, users can only see their own orders)
  • PATCH /api/orders/{id}/cancel -- cancel an order (authenticated, only if status is "Pending")
  • GET /api/admin/orders -- list all orders (admin only, supports ?status=pending&page=1)

Use an in-memory data store. Products have Id, Name, Description, Price, Category, StockQuantity. Orders have Id, UserId, Items, ShippingAddress, Status (Pending, Confirmed, Shipped, Cancelled), Total, CreatedAt.

Output Specification

Produce:

  • Program.cs -- Application setup with services and middleware
  • Controllers/ProductsController.cs -- Product browsing endpoints
  • Controllers/OrdersController.cs -- Order management endpoints
  • Models/ -- Request/response DTOs and entity classes
  • Services/OrderService.cs -- Order processing business logic
  • appsettings.json -- Configuration
  • ECommerceApi.csproj -- Project file with NuGet packages

evals

tile.json