Skip to content

Commit 9289a09

Browse files
authored
Merge pull request #983 from stellar/philip/chore-sync-12-09
Chore: Merge `develop` into `feature/c-accounts`
2 parents 526bef7 + 5800618 commit 9289a09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1126
-542
lines changed

.github/workflows/automated_release_process.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616
env:
1717
REPO_ORG: stellar
1818
REPO_NAME: stellar-disbursement-platform-backend
19-
REVIEWER: marcelosalloum,marwen-abid
19+
REVIEWER: JiahuiWho,marwen-abid,philipliu
2020

2121
jobs:
2222
create-release:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
- name: Install NodeJs
106106
uses: actions/setup-node@v6
107107
with:
108-
node-version: 20
108+
node-version: 22
109109

110110
- name: Install dependencies
111111
working-directory: internal/serve/sep24frontend/app

CHANGELOG.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,35 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/).
66

7-
## [Unreleased]
7+
## [6.0.1](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/6.0.1) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/6.0.0...6.0.1))
8+
9+
### Fixed
10+
11+
- Fix Twilio error 21656 when sending WhatsApp OTP messages by updating template to single variable format as required by Twilio/Meta's updated authentication template requirements [#974](https://github.com/stellar/stellar-disbursement-platform-backend/pull/974)
12+
13+
### Security and Dependencies
14+
15+
- Bump the all-docker group with 2 updates [#976](https://github.com/stellar/stellar-disbursement-platform-backend/pull/976)
16+
- golang from 1.25.4-alpine to 1.25.5-alpine
17+
- alpine from 3.22 to 3.23
18+
- Bump the minor-and-patch group with 7 updates [#977](https://github.com/stellar/stellar-disbursement-platform-backend/pull/977)
19+
20+
## [6.0.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/6.0.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/5.0.0...6.0.0))
21+
22+
### 🚨Potential Breaking Changes
23+
24+
- Remove case insensitivity from asset code comparisons [#967](https://github.com/stellar/stellar-disbursement-platform-backend/pull/967)
25+
- Decommission Anchor Platform and add support for SEP-10 and SEP-24 endpoints in the SDP [#834](https://github.com/stellar/stellar-disbursement-platform-backend/pull/834)
26+
- Add SEP10 /auth endpoints
27+
- Add SEP24 /info endpoints
28+
- Add SEP24 interactive deposit endpoint
29+
- Remove Anchor Platform integration from the SDP and deprecate related env variables.
830

931
### Added
1032

1133
- Add Launch Wizard through `make setup` command to simplify initial setup and mainnet configuration for docker compose [#875](https://github.com/stellar/stellar-disbursement-platform-backend/pull/875)
34+
- Add `--env-file` command line argument to support multiple environment file contexts [#963](https://github.com/stellar/stellar-disbursement-platform-backend/pull/963)
1235
- Add HTTPS mode to setup wizard [#957](https://github.com/stellar/stellar-disbursement-platform-backend/pull/957)
13-
- Support for SEP-10 and SEP-24 endpoints in the SDP [#834](https://github.com/stellar/stellar-disbursement-platform-backend/pull/834)
14-
- Add SEP10 /auth endpoints
15-
- Add SEP24 /info endpoints
16-
- Add SEP24 interactive deposit endpoint
17-
- Remove Anchor Platform integration from the SDP and deprecate related env variables.
1836
- Add configurable database connection pool settings to prevent idle connection buildup in multi-tenant deployments [#932](https://github.com/stellar/stellar-disbursement-platform-backend/pull/932)
1937

2038
### Changed
@@ -25,10 +43,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
2543

2644
### Fixed
2745

28-
- Fix HTML validation to allow apostrophes in invitation messages while maintaining security against XSS attacks [#930](https://github.com/stellar/stellar-disbursement-platform-backend/pull/930)
46+
- Fix HTML validation to allow apostrophes in invitation messages while maintaining security against XSS attacks [#931](https://github.com/stellar/stellar-disbursement-platform-backend/pull/931)
2947
- Refactor to replace float64 with shopspring decimal [#936](https://github.com/stellar/stellar-disbursement-platform-backend/pull/936)
3048
- `channel-accounts ensure` command should have a minimum of 1 [#939](https://github.com/stellar/stellar-disbursement-platform-backend/pull/939)
3149

50+
### Security and Dependencies
51+
52+
- Upgrade React to 19.2.1 in SEP-24 frontend to address CVE-2025-66478 and CVE-2025-55182 [#968](https://github.com/stellar/stellar-disbursement-platform-backend/pull/968)
53+
- Bump the minor-and-patch group with 5 updates [#961](https://github.com/stellar/stellar-disbursement-platform-backend/pull/961)
54+
- Bump the minor-and-patch group across 1 directory with 12 updates [#955](https://github.com/stellar/stellar-disbursement-platform-backend/pull/955)
55+
- Bump actions/checkout from 5 to 6 in the all-actions group [#954](https://github.com/stellar/stellar-disbursement-platform-backend/pull/954)
56+
- Bump js-yaml from 4.1.0 to 4.1.1 in the npm_and_yarn group [#947](https://github.com/stellar/stellar-disbursement-platform-backend/pull/947)
57+
- Bump golang from 1.25.3-alpine to 1.25.4-alpine in the all-docker group [#940](https://github.com/stellar/stellar-disbursement-platform-backend/pull/940)
58+
- Bump the minor-and-patch group with 7 updates [#933](https://github.com/stellar/stellar-disbursement-platform-backend/pull/933)
59+
3260
## [5.0.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/5.0.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/4.1.0...5.0.0))
3361

3462
### Added

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# To push:
44
# make docker-push
55

6-
FROM golang:1.25.4-alpine AS build
6+
FROM golang:1.25.5-alpine AS build
77
ARG GIT_COMMIT
88

99
ENV CGO_ENABLED=0 GOOS=linux
@@ -14,7 +14,7 @@ COPY . ./
1414
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .
1515

1616

17-
FROM alpine:3.22
17+
FROM alpine:3.23
1818

1919
RUN apk add --no-cache ca-certificates
2020
# ADD migrations/ /app/migrations/

Dockerfile.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1: Build the Go application
2-
FROM golang:1.25.4-alpine AS build
2+
FROM golang:1.25.5-alpine AS build
33
ARG GIT_COMMIT
44

55
WORKDIR /src/stellar-disbursement-platform
@@ -9,7 +9,7 @@ COPY . ./
99
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .
1010

1111
# Stage 2: Setup the development environment with Delve for debugging
12-
FROM golang:1.25.4-alpine AS development
12+
FROM golang:1.25.5-alpine AS development
1313

1414
# set workdir according to repo structure so remote debug source code is in sync
1515
WORKDIR /app/github.com/stellar/stellar-disbursement-platform

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Swagger Documentation](https://img.shields.io/badge/docs-swagger-blue?logo=swagger)](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/stellar/stellar-docs/refs/heads/main/openapi/stellar-disbursement-platform/bundled.yaml)
44
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/stellar/stellar-disbursement-platform-backend)
5-
[![Stellar Docs](https://img.shields.io/badge/docs-stellar.org-blue?logo=stellar)](https://developers.stellar.org/platforms/stellar-disbursement-platform)
5+
[![Stellar Docs](https://img.shields.io/badge/docs-stellar.org-blue?logo=stellar)](https://developers.stellar.org/docs/platforms/stellar-disbursement-platform)
66
[![CI](https://img.shields.io/github/check-runs/stellar/stellar-disbursement-platform-backend/develop?logo=github&label=CI)](https://github.com/stellar/stellar-disbursement-platform-backend/actions/workflows/docker_image_public_release.yml)
77
[![Go Report Card](https://goreportcard.com/badge/github.com/stellar/stellar-disbursement-platform-backend)](https://goreportcard.com/report/github.com/stellar/stellar-disbursement-platform-backend)
88
[![GitHub](https://img.shields.io/github/license/stellar/stellar-disbursement-platform-backend)](https://github.com/stellar/stellar-disbursement-platform-backend/blob/main/LICENSE)
@@ -25,8 +25,8 @@
2525
- [State Transitions](#state-transitions)
2626

2727
> [!NOTE]
28-
> If you are using version 1.x.x, we highly recommend upgrading to version 2.x.x to benefit from the latest features, routine fixes, and security patches.
29-
> For detailed instructions on how to upgrade, please refer to [the upgrade guide](https://developers.stellar.org/network/stellar-disbursement-platform/admin-guide/single-tenant-to-multi-tenant-migration).
28+
> If you are using version 1.x.x, we highly recommend upgrading to version 2.x.x to benefit from the latest features, routine fixes, and security patches.
29+
> For detailed instructions on how to upgrade, please refer to [the upgrade guide](https://developers.stellar.org/docs/platforms/stellar-disbursement-platform/admin-guide/single-tenant-to-multi-tenant-migration).
3030
3131
## Introduction
3232

@@ -47,7 +47,7 @@ stellar-disbursement-platform --help
4747

4848
## Quick Start
4949

50-
### Docker Compose
50+
### Docker Compose
5151

5252
To quickly test the SDP using preconfigured values, use the startup wizard.
5353

@@ -57,7 +57,7 @@ make setup
5757

5858
For more information about launching and configuring the SDP, see the [Quick Start Guide](./dev/README.md).
5959

60-
### Helm
60+
### Helm
6161

6262
To deploy the SDP using Helm, see the [Helm Chart](./helmchart/sdp/README.md).
6363

@@ -178,7 +178,7 @@ The SEP10/SEP24 implementation can be configured using the following environment
178178
SEP10_SIGNING_PUBLIC_KEY=G... # Public key for SEP10 signing
179179
SEP10_SIGNING_PRIVATE_KEY=S... # Private key for SEP10 signing
180180

181-
# SEP24 Configuration
181+
# SEP24 Configuration
182182
SEP24_JWT_SECRET=jwt_secret_... # JWT secret for SEP24 tokens
183183
```
184184

@@ -190,7 +190,7 @@ The following environment variables are required for SEP10/SEP24 functionality:
190190

191191
**Required Variables:**
192192
- `SEP10_SIGNING_PUBLIC_KEY` - Public key for SEP10 challenge signing
193-
- `SEP10_SIGNING_PRIVATE_KEY` - Private key for SEP10 challenge signing
193+
- `SEP10_SIGNING_PRIVATE_KEY` - Private key for SEP10 challenge signing
194194
- `SEP24_JWT_SECRET` - JWT secret for SEP24 token signing
195195

196196
**Optional Variables:**
@@ -207,9 +207,9 @@ The SDP Core service include several components started using a single command.
207207
stellar-disbursement-platform serve --help
208208
```
209209

210-
#### Admin API
210+
#### Admin API
211211

212-
The Admin API is the component responsible for managing tenants of the SDP. It runs by default on port 8003 and is used to provision new tenants and manage existing tenants.
212+
The Admin API is the component responsible for managing tenants of the SDP. It runs by default on port 8003 and is used to provision new tenants and manage existing tenants.
213213

214214
#### Dashboard API
215215

@@ -273,7 +273,7 @@ TWILIO_WHATSAPP_RECEIVER_OTP_TEMPLATE_SID=HXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
273273
- WhatsApp requires pre-approved message templates for all business-initiated conversations
274274
- Template variables are automatically populated by the SDP based on the message type
275275
- All templates must be approved by WhatsApp before they can be used in production
276-
- For detailed setup instructions, refer to the [Twilio WhatsApp API documentation](https://www.twilio.com/docs/whatsapp/api)
276+
- For detailed setup instructions, refer to the [Twilio WhatsApp API documentation](https://www.twilio.com/docs/whatsapp/api)
277277

278278
#### Wallet Registration UI
279279

@@ -308,7 +308,7 @@ In future iterations of the project, the Transaction Submission Service will pro
308308

309309
To manage the migrations of the database, use the `db` subcommand.
310310

311-
####
311+
####
312312

313313
```sh
314314
stellar-disbursement-platform db --help
@@ -322,7 +322,7 @@ stellar-disbursement-platform db --help
322322
stellar-disbursement-platform db admin migrate up
323323
```
324324

325-
The tables below are used to manage tenants and their configurations.
325+
The tables below are used to manage tenants and their configurations.
326326

327327
![admin schema](./docs/images/admin_db_schema.png)
328328

@@ -371,8 +371,8 @@ The SDP uses Background jobs to handle asynchronous tasks.
371371

372372
**1. Jobs**
373373

374-
> [!NOTE]
375-
> Certain jobs are not listed here because they cannot be configured and are necessary to the functioning of the SDP.
374+
> [!NOTE]
375+
> Certain jobs are not listed here because they cannot be configured and are necessary to the functioning of the SDP.
376376
377377
* `send_receiver_wallets_invitation_job`: This job is used to send disbursement invites to recipients. Its interval is configured through the `SCHEDULER_RECEIVER_INVITATION_JOB_SECONDS` environment variable.
378378
* `payment_to_submitter_job`: This job is used to submit payments from Core to the TSS. Its interval is configured through the `SCHEDULER_PAYMENT_JOB_SECONDS` environment variable.

cloudformation/eks/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This guide walks through deploying the Stellar Disbursement Platform (SDP) infra
4141
- Creates EKS cluster and node group
4242
- Sets up IAM roles and security groups
4343
- Configures IRSA (IAM Roles for Service Accounts)
44-
- Sets up permissions for pods to access secrets stored in AWS Secrets Manager
44+
- Sets up permissions for pods to access secrets stored in AWS Secrets Manager
4545

4646
After the CloudFormation stacks are deployed, additional Kubernetes resources are installed via Helm charts to complete the setup. The SDP expects secrets to be available as Kubernetes secrets, but how those secrets are synchronized (whether through ExternalSecrets, direct creation, or other means) is left to the deployer's preference.
4747

@@ -82,7 +82,7 @@ aws cloudformation create-stack \
8282
```
8383

8484
## 3. Keys Stack Deployment
85-
For testnet, you can auto-generate Stellar secrets using the following command:
85+
For testnet, you can auto-generate Stellar secrets using the following command:
8686

8787
```bash
8888
aws cloudformation create-stack \
@@ -107,7 +107,7 @@ aws cloudformation create-stack \
107107
ParameterKey=ChannelAccountEncryptionPassphrase,ParameterValue=your-channel-encryption-passphrase \
108108
ParameterKey=DistributionAccountEncryptionPassphrase,ParameterValue=your-distribution-encryption-passphrase
109109
```
110-
for a description of these parameters, please see: [Configuring the SDP](https://developers.stellar.org/platforms/stellar-disbursement-platform/admin-guide/configuring-sdp)
110+
for a description of these parameters, please see: [Configuring the SDP](https://developers.stellar.org/docs/platforms/stellar-disbursement-platform/admin-guide/configuring-sdp)
111111

112112
## 4. EKS Cluster Deployment
113113
Deploy the EKS cluster:
@@ -374,7 +374,7 @@ aws cloudformation delete-stack --stack-name ${STACK_NAME_PREFIX}-network --regi
374374
## Additional Information
375375

376376
### Stellar Disbursement Platform Domain Structure
377-
The SDP platform uses two base-level domains for multi-tenant frontend and backend access. For example, lets say your hosted public domain is `api.example.org`. Then, you could configure a subdomain called `api.example.org` as the base-level domain for api access and `dashboard.example.org` as the front-end dashboard base-level domain. If you then added a tenant (eg `ridedash`) to the SDP, the api and dashboard URLs for them would be `ridedash.api.example.org` and `ridedash.dashboard.example.org` respectively. you can see this example in the helm-example-values file.
377+
The SDP platform uses two base-level domains for multi-tenant frontend and backend access. For example, lets say your hosted public domain is `api.example.org`. Then, you could configure a subdomain called `api.example.org` as the base-level domain for api access and `dashboard.example.org` as the front-end dashboard base-level domain. If you then added a tenant (eg `ridedash`) to the SDP, the api and dashboard URLs for them would be `ridedash.api.example.org` and `ridedash.dashboard.example.org` respectively. you can see this example in the helm-example-values file.
378378

379379
## Example Helm Values configuration
380380
The following illustrates the example configuration for backend (api) and frontend (dashboard) base domains for the public domain `example.org`. Note, these domains must have a wild-card certificate.
@@ -392,7 +392,7 @@ dashboard:
392392
393393
The following illustrates the kubernetes configurations that result from the above helm values.
394394
```bash
395-
kubectl -n sdp get ingress
395+
kubectl -n sdp get ingress
396396
NAME CLASS HOSTS ADDRESS PORTS AGE
397397
sdp ingress-public api.example.org,*.api.example.org a3ca0226bd4494ffb808a64476ddfc4f-66bf685869e3cc2e.elb.us-west-2.amazonaws.com 80, 443 9s
398398
sdp-ap ingress-public ap-api.example.org a3ca0226bd4494ffb808a64476ddfc4f-66bf685869e3cc2e.elb.us-west-2.amazonaws.com 80, 443 9s
@@ -514,4 +514,4 @@ kubectl describe pods -n sdp
514514
```bash
515515
aws secretsmanager list-secrets \
516516
--filters Key=name-prefix,Values=/sdp/${ENVIRONMENT}
517-
```
517+
```

cmd/root.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ func rootCmd() *cobra.Command {
6666
FlagDefault: "http://localhost:3000",
6767
Required: true,
6868
},
69+
// env-file flag is already handled in main.go, but it needs to be also defined here because Cobra doesn't allow unknown flags.
70+
{
71+
Name: "env-file",
72+
Usage: "Path to environment file to load (e.g., \"dev/.env.https-testnet\"). Supports absolute and relative paths. Defaults to \".env\" if not specified.",
73+
OptType: types.String,
74+
ConfigKey: &globalOptions.EnvFile,
75+
Required: false,
76+
},
6977
cmdUtils.NetworkPassphrase(&globalOptions.NetworkPassphrase),
7078
}
7179

cmd/utils/env_loader.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package utils
2+
3+
import (
4+
"errors"
5+
"fmt"
6+
"os"
7+
"path/filepath"
8+
"strings"
9+
10+
"github.com/joho/godotenv"
11+
)
12+
13+
const (
14+
envFileFlag = "--env-file"
15+
envFileEnvVar = "ENV_FILE"
16+
)
17+
18+
// LoadEnvFile loads environment variables from a file.
19+
// Priority: --env-file flag > ENV_FILE environment variable > .env in working directory
20+
func LoadEnvFile() error {
21+
envFilePath := determineEnvFilePath()
22+
23+
if envFilePath != "" {
24+
return loadExplicitEnvFile(envFilePath)
25+
}
26+
27+
return loadDefaultEnvFile()
28+
}
29+
30+
// determineEnvFilePath determines the path to the env file based on priority.
31+
func determineEnvFilePath() string {
32+
if path := parseEnvFileFlag(); path != "" {
33+
return toAbsolutePath(path)
34+
}
35+
36+
if path := os.Getenv(envFileEnvVar); path != "" {
37+
return toAbsolutePath(path)
38+
}
39+
40+
return ""
41+
}
42+
43+
// parseEnvFileFlag checks command-line arguments for the --env-file flag.
44+
func parseEnvFileFlag() string {
45+
for i, arg := range os.Args {
46+
if arg == envFileFlag && i+1 < len(os.Args) {
47+
return os.Args[i+1]
48+
}
49+
if strings.HasPrefix(arg, envFileFlag+"=") {
50+
return strings.TrimPrefix(arg, envFileFlag+"=")
51+
}
52+
}
53+
return ""
54+
}
55+
56+
// toAbsolutePath converts a relative path to an absolute path.
57+
func toAbsolutePath(path string) string {
58+
if path == "" || filepath.IsAbs(path) {
59+
return path
60+
}
61+
62+
absPath, err := filepath.Abs(path)
63+
if err != nil {
64+
return path
65+
}
66+
return absPath
67+
}
68+
69+
// loadExplicitEnvFile loads environment variables from the specified file.
70+
func loadExplicitEnvFile(path string) error {
71+
if err := godotenv.Load(path); err != nil {
72+
return fmt.Errorf("loading env file %s: %w", path, err)
73+
}
74+
return nil
75+
}
76+
77+
// loadDefaultEnvFile loads environment variables from the default .env file.
78+
func loadDefaultEnvFile() error {
79+
err := godotenv.Load()
80+
if err == nil {
81+
return nil
82+
}
83+
84+
if errors.Is(err, os.ErrNotExist) {
85+
return nil
86+
}
87+
88+
return fmt.Errorf("loading .env file: %w", err)
89+
}

0 commit comments

Comments
 (0)