Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bca7840
Fix the GHCR release SBOM step and copy release images to Docker Hub …
KrzysztofPajak Oct 4, 2026
427205e
Restrict product XLSX import to the global admin scope (#890)
KrzysztofPajak Oct 11, 2026
568ba95
Authentication: a Bearer header without the Web API module no longer …
KrzysztofPajak Oct 11, 2026
dd86ea3
Storefront: news and home page news/blog blocks render database HTML …
KrzysztofPajak Oct 11, 2026
0cc9feb
Serve only static asset types from the Plugins folder (2.4.x) (#948)
KrzysztofPajak Oct 18, 2026
9fdba8f
Update Vite to 8.3.5 in the storefront and admin frontends (2.4.x) (#…
KrzysztofPajak Oct 23, 2026
2c34bf3
Pin System.Security.Cryptography.Pkcs and Cryptography.Xml to 10.0.13…
KrzysztofPajak Oct 24, 2026
0cd8d6a
Update MailKit to 4.18.2 instead of pinning System.Security.Cryptogra…
KrzysztofPajak Oct 24, 2026
862e998
Compare the loyalty points balance with the order total in the same c…
KrzysztofPajak Oct 24, 2026
5f78731
Update follow-redirects to 1.16.2 in the storefront lockfile (#1003)
KrzysztofPajak Oct 31, 2026
019fd31
Keep the time zone on save, let guests be saved, stop losing the firs…
KrzysztofPajak Nov 1, 2026
2eba3f3
Keep sub-account edits on the owner's accounts and change passwords o…
KrzysztofPajak Nov 1, 2026
b7a364e
Answer 404 from the permission actions popup for an unknown group or …
KrzysztofPajak Nov 2, 2026
cb51a75
Require the Create action when saving a create form (#1015)
KrzysztofPajak Nov 2, 2026
e53b309
Panels: the two-factor step after a password sign-in stays on the pan…
KrzysztofPajak Nov 2, 2026
6644a3c
Reload the plugin list with a POST (#1021)
KrzysztofPajak Nov 4, 2026
76f251d
Keep bulk order export and delete within the staff member's orders (#…
KrzysztofPajak Nov 4, 2026
4209625
Stop WidgetViewComponent from writing request data into the cached wi…
KrzysztofPajak Nov 4, 2026
5d8c5da
Fix installing on LiteDB and the first concurrent requests after a st…
KrzysztofPajak Nov 5, 2026
fbd6dfc
Patch the OS packages of the runtime image (2.4.x) (#1031)
KrzysztofPajak Nov 5, 2026
e3ff098
Run CI on release branches and set version 2.4.1 (2.4.x) (#1007)
KrzysztofPajak Nov 6, 2026
9497431
Merge main into 2.4.1 release
Nov 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ai/standards/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Every project imports `..\..\Build\Grand.Common.props`, which sets:
- `ImplicitUsings` = `true`
- global using of `System.Text`
- release build with no debug symbols
- product version, currently `2.4.0`, set in the `SetVersion` target
- product version, currently `2.4.1`, set in the `SetVersion` target

Do not override `TargetFramework` or `LangVersion` in an individual project.

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/aspnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ASP.NET Core CI

on:
push:
branches: [ develop, main ]
branches: [ develop, main, '[0-9]+.[0-9]+.x' ]
pull_request:
branches: [ develop, main ]
branches: [ develop, main, '[0-9]+.[0-9]+.x' ]

jobs:
build:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/docker-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ jobs:
format: spdx-json
output-file: sbom.spdx.json
upload-artifact: true
# On a tag push the action also attaches the SBOM to the GitHub
# release, which needs contents: write. The SBOM ships as a signed
# attestation instead, so the job keeps contents: read.
upload-release-assets: false

- name: Cosign attest SBOM
env:
Expand Down Expand Up @@ -202,3 +206,25 @@ jobs:
--cert-identity "${IDENTITY}" \
--deny-self-hosted-runners \
--predicate-type "https://slsa.dev/provenance/v1"

# Docker Hub gets the same verified digest, not a rebuild: the
# signature and attestations above stay valid for it.
- name: Login to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Copy image to Docker Hub
env:
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
DIGEST: ${{ steps.build.outputs.digest }}
DOCKERHUB_IMAGE: grandnode/grandnode2
# 2.4.0 -> :2.4.0 and :2.4.x; a prerelease (2.4.0-beta) only gets its
# own tag. :latest stays with the push to main (docker-image.yml).
run: |
tags=(-t "${DOCKERHUB_IMAGE}:${VERSION}")
if [[ "${VERSION}" != *-* ]]; then
tags+=(-t "${DOCKERHUB_IMAGE}:${VERSION%.*}.x")
fi
docker buildx imagetools create "${tags[@]}" "${IMAGE}@${DIGEST}"
4 changes: 2 additions & 2 deletions .github/workflows/docker-image-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Docker Image CI

on:
push:
branches: [ "develop" ]
branches: [ "develop", "[0-9]+.[0-9]+.x" ]
pull_request:
branches: [ "develop" ]
branches: [ "develop", "[0-9]+.[0-9]+.x" ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageVersion Include="Scalar.AspNetCore" Version="2.17.13" />
<PackageVersion Include="Scryber.Core" Version="9.7.4.4" />
<PackageVersion Include="Scryber.Core.OpenType" Version="9.7.4" />
<PackageVersion Include="MailKit" Version="4.18.1" />
<PackageVersion Include="MailKit" Version="4.18.2" />
<PackageVersion Include="AWSSDK.Core" Version="4.0.102.8" />
<PackageVersion Include="AWSSDK.S3" Version="4.0.104.1" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.30.0" />
Expand Down Expand Up @@ -43,7 +43,7 @@
<PackageVersion Include="Braintree" Version="5.41.0" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.12" />
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.7.4" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="10.0.12" />
<PackageVersion Include="System.Security.Cryptography.Xml" Version="10.0.13" />
<PackageVersion Include="System.Xml.XPath.XmlDocument" Version="4.7.0" />
<PackageVersion Include="Stripe.net" Version="52.4.2" />
<PackageVersion Include="elFinder.Net.AspNetCore" Version="1.5.0" />
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ RUN dotnet publish /app/Web/Grand.Web/Grand.Web.csproj -c Release -o ./build/rel
# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime

# Security fixes of the OS packages, without waiting for a rebuilt base image
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*

EXPOSE 8080
WORKDIR /app
COPY --from=build-env /app/build/release .
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Grand.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ItemGroup>
<Target Name="SetVersion" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
</PropertyGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ public class ApiAuthenticationService : IApiAuthenticationService
private readonly ICustomerService _customerService;
private readonly IGroupService _groupService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IAuthenticationSchemeProvider _schemeProvider;

public ApiAuthenticationService(
ICustomerService customerService,
IGroupService groupService, IHttpContextAccessor httpContextAccessor)
IGroupService groupService, IHttpContextAccessor httpContextAccessor,
IAuthenticationSchemeProvider schemeProvider)
{
_schemeProvider = schemeProvider;
_customerService = customerService;
_groupService = groupService;
_httpContextAccessor = httpContextAccessor;
Expand All @@ -39,10 +42,18 @@ public virtual async Task<Customer> GetAuthenticatedCustomer()

if (IsApiFrontAuthenticated())
{
//the scheme exists only when the Web API module is enabled
if (await _schemeProvider.GetSchemeAsync(FrontendAPIConfig.AuthenticationScheme) == null)
return null;

customer = await ApiCustomer();
return customer;
}

//the scheme exists only when the Web API module is enabled
if (await _schemeProvider.GetSchemeAsync(JwtBearerDefaults.AuthenticationScheme) == null)
return null;

var authenticateResult = await _httpContextAccessor.HttpContext.AuthenticateAsync(JwtBearerDefaults.AuthenticationScheme);
if (!authenticateResult.Succeeded)
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public Task<IQueryable<GiftVoucher>> Handle(GetGiftVoucherQuery request, Cancell
query = query.Where(gc => gc.StoreId == request.StoreId || gc.StoreId == null || gc.StoreId == "");

if (!string.IsNullOrEmpty(request.PurchasedWithOrderItemId))
query = query.Where(gc => gc.PurchasedWithOrderItem.Id == request.PurchasedWithOrderItemId);
query = query.Where(gc =>
gc.PurchasedWithOrderItem != null && gc.PurchasedWithOrderItem.Id == request.PurchasedWithOrderItemId);

if (request.CreatedFromUtc.HasValue)
query = query.Where(gc => request.CreatedFromUtc.Value <= gc.CreatedOnUtc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public Task<IQueryable<Order>> Handle(GetOrderQuery request, CancellationToken c

if (!string.IsNullOrEmpty(request.BillingLastName))
query = query.Where(o =>
o.BillingAddress != null && o.BillingAddress.LastName.Contains(request.BillingLastName));
o.BillingAddress != null && !string.IsNullOrEmpty(o.BillingAddress.LastName) &&
o.BillingAddress.LastName.Contains(request.BillingLastName));

if (!string.IsNullOrEmpty(request.OrderGuid))
if (Guid.TryParse(request.OrderGuid, out var orderGuid))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,22 +889,28 @@ await _loyaltyPointsService.GetLoyaltyPointsBalance(_contextAccessor.WorkContext
_contextAccessor.StoreContext.CurrentStore.Id);
if (CheckMinimumLoyaltyPointsToUseRequirement(loyaltyPointsBalance))
{
var loyaltyPointsBalanceAmount = await ConvertLoyaltyPointsToAmount(loyaltyPointsBalance);
//the order total is in the working currency, so the balance is compared in that currency
//and rounded only after the conversion
var loyaltyPointsBalanceAmount = await _currencyService.ConvertFromPrimaryStoreCurrency(
loyaltyPointsBalance * _loyaltyPointsSettings.ExchangeRate,
_contextAccessor.WorkContext.WorkingCurrency);
if (_shoppingCartSettings.RoundPrices)
loyaltyPointsBalanceAmount = RoundingHelper.RoundPrice(loyaltyPointsBalanceAmount,
_contextAccessor.WorkContext.WorkingCurrency);
if (orderTotal > 0)
{
if (orderTotal > loyaltyPointsBalanceAmount)
{
redeemedLoyaltyPoints = loyaltyPointsBalance;
redeemedLoyaltyPointsAmount =
await _currencyService.ConvertFromPrimaryStoreCurrency(loyaltyPointsBalanceAmount,
_contextAccessor.WorkContext.WorkingCurrency);
redeemedLoyaltyPointsAmount = loyaltyPointsBalanceAmount;
}
else
{
redeemedLoyaltyPointsAmount = orderTotal;
redeemedLoyaltyPoints = ConvertAmountToLoyaltyPoints(
//rounding can push the points one over the balance
redeemedLoyaltyPoints = Math.Min(loyaltyPointsBalance, ConvertAmountToLoyaltyPoints(
await _currencyService.ConvertToPrimaryStoreCurrency(redeemedLoyaltyPointsAmount,
_contextAccessor.WorkContext.WorkingCurrency));
_contextAccessor.WorkContext.WorkingCurrency)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ public interface ICustomerManagerService
/// <param name="request">Request</param>
/// <param name="storeId">Store identifier - used to resolve the customer when per-store customer identity is enabled</param>
Task ChangePassword(ChangePasswordRequest request, string storeId = "");

/// <summary>
/// Change password of this customer, without resolving the account by e-mail
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="passwordFormat">Password format</param>
/// <param name="newPassword">New password</param>
/// <remarks>The default body keeps implementations built for an earlier 2.4 release loading without a rebuild</remarks>
Task ChangePassword(Customer customer, PasswordFormat passwordFormat, string newPassword) =>
ChangePassword(new ChangePasswordRequest(customer.Email, passwordFormat, newPassword), customer.StoreId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ Task UpdateCustomerField<T>(string customerId,
/// <param name="customer">Customer</param>
Task UpdateActive(Customer customer);

/// <summary>
/// Updates the password fields of the customer, and nothing else
/// </summary>
/// <param name="customer">Customer</param>
/// <remarks>The default body keeps implementations built for an earlier 2.4 release loading without a rebuild</remarks>
Task UpdateCustomerPassword(Customer customer) => UpdateCustomer(customer);

/// <summary>
/// Update the customer
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,33 +173,46 @@ public virtual async Task ChangePassword(ChangePasswordRequest request, string s
ArgumentNullException.ThrowIfNull(request);

var customer = await _customerService.GetCustomerByEmail(request.Email, storeId);

await ChangePassword(customer, request.PasswordFormat, request.NewPassword);
}

/// <summary>
/// Change password of this customer, without resolving the account by e-mail
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="passwordFormat">Password format</param>
/// <param name="newPassword">New password</param>
public virtual async Task ChangePassword(Customer customer, PasswordFormat passwordFormat, string newPassword)
{
ArgumentNullException.ThrowIfNull(customer);

switch (request.PasswordFormat)
switch (passwordFormat)
{
case PasswordFormat.Clear:
{
customer.Password = request.NewPassword;
customer.Password = newPassword;
}
break;
case PasswordFormat.Encrypted:
{
customer.PasswordSalt = CommonHelper.GenerateRandomDigitCode(24);
customer.Password = _encryptionService.EncryptText(request.NewPassword, customer.PasswordSalt);
customer.Password = _encryptionService.EncryptText(newPassword, customer.PasswordSalt);
}
break;
case PasswordFormat.Hashed:
{
//modern self-describing PBKDF2 hash - salt and parameters are embedded in the value itself
customer.PasswordSalt = string.Empty;
customer.Password = _encryptionService.HashPassword(request.NewPassword);
customer.Password = _encryptionService.HashPassword(newPassword);
}
break;
}

customer.PasswordChangeDateUtc = DateTime.UtcNow;
customer.PasswordFormatId = request.PasswordFormat;
await _customerService.UpdateCustomer(customer);
customer.PasswordFormatId = passwordFormat;
//only the password fields: the caller's copy may be older than the account
await _customerService.UpdateCustomerPassword(customer);
//insert password history
await _customerHistoryPasswordService.InsertCustomerPassword(customer);

Expand Down
20 changes: 20 additions & 0 deletions src/Business/Grand.Business.Customers/Services/CustomerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,26 @@ public virtual async Task UpdateCustomerInAdminPanel(Customer customer)
}


public virtual async Task UpdateCustomerPassword(Customer customer)
{
ArgumentNullException.ThrowIfNull(customer);

if (customer.IsSystemAccount)
throw new GrandException(
$"System customer account ({(string.IsNullOrEmpty(customer.SystemName) ? customer.Email : customer.SystemName)}) could not be updated");

var update = UpdateBuilder<Customer>.Create()
.Set(x => x.Password, customer.Password)
.Set(x => x.PasswordSalt, customer.PasswordSalt)
.Set(x => x.PasswordFormatId, customer.PasswordFormatId)
.Set(x => x.PasswordChangeDateUtc, customer.PasswordChangeDateUtc);

await _customerRepository.UpdateOneAsync(x => x.Id == customer.Id, update);

//event notification
await _mediator.EntityUpdated(customer);
}

public virtual async Task UpdateActive(Customer customer)
{
ArgumentNullException.ThrowIfNull(customer);
Expand Down
60 changes: 60 additions & 0 deletions src/Core/Grand.Data/LiteDb/LiteDBMapperWarmup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using LiteDB;
using System.Reflection;

namespace Grand.Data.LiteDb;

/// <summary>
/// Builds the entity mappers before the application starts handling requests and running tasks.
/// LiteDB publishes a mapper before filling its members and reads published mappers without a lock
/// (BsonMapper.BuildAddEntityMapper), so threads meeting a type for the first time together either
/// throw "Collection was modified" or silently read an object with fields missing.
/// </summary>
public static class LiteDBMapperWarmup
{
private static readonly string[] FrameworkNamespaces = ["System", "Microsoft", "LiteDB", "MongoDB"];

//Entity<T> is the public way to reach the internal BsonMapper.GetEntityMapper
private static readonly MethodInfo BuildMapper = typeof(BsonMapper).GetMethod(nameof(BsonMapper.Entity))!;

public static void Warm(IEnumerable<Type> entityTypes)
{
Warm(BsonMapper.Global, entityTypes);
}

public static void Warm(BsonMapper mapper, IEnumerable<Type> entityTypes)
{
var visited = new HashSet<Type>();
var pending = new Stack<Type>(entityTypes);

while (pending.TryPop(out var type))
{
if (!visited.Add(type)) continue;

if (type.IsArray)
{
pending.Push(type.GetElementType()!);
continue;
}

//lists, dictionaries and nullables hold their mapped types in the type arguments
foreach (var argument in type.GetGenericArguments()) pending.Push(argument);

if (type.IsEnum || type.ContainsGenericParameters || IsFrameworkType(type)) continue;

BuildMapper.MakeGenericMethod(type).Invoke(mapper, null);

foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
pending.Push(property.PropertyType);

//LINQ looks a member up on the type declaring it: x.Id goes through ParentEntity, not the entity
if (type.BaseType != null) pending.Push(type.BaseType);
foreach (var contract in type.GetInterfaces()) pending.Push(contract);
}
}

private static bool IsFrameworkType(Type type)
{
return type.Namespace != null &&
FrameworkNamespaces.Any(name => type.Namespace == name || type.Namespace.StartsWith(name + "."));
}
}
7 changes: 7 additions & 0 deletions src/Core/Grand.Infrastructure/Configuration/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ public class AppConfig
/// </summary>
public string StaticFilesCacheControl { get; set; }

/// <summary>
/// Gets or sets the file extensions served from the Plugins folder on top of the built-in css, js, images,
/// fonts and pdf (e.g. ".mp4"). The folder also holds the plugin assemblies and their build files - add only
/// extensions that are safe to publish; .dll, .pdb, .exe and .config are never served.
/// </summary>
public string[] PluginStaticFileExtensions { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to display the full error in production environment.
/// It's ignored (always enabled) in development environment
Expand Down
Loading
Loading