Skip to content

Commit a8efdd3

Browse files
committed
chore: Update axios to version 1.12.0 and add data URL rejection in API client
- Upgraded axios dependency in package.json and package-lock.json to version 1.12.0 for improved functionality. - Implemented a check in the API client to proactively reject requests to data: URLs, enhancing security and preventing potential issues with large payloads.
1 parent eb5337d commit a8efdd3

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

lib/api/api.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ const createClientApi = (): AxiosInstance => {
7979
config => {
8080
config.withCredentials = true;
8181

82+
// Reject data: URLs proactively to avoid Node adapter decoding large payloads
83+
try {
84+
const base = config.baseURL || API_BASE_URL;
85+
const rawUrl = config.url || '';
86+
// If absolute URL provided, use as-is; else resolve against base
87+
const fullUrl = /^https?:|^data:|^\/\//.test(rawUrl)
88+
? rawUrl
89+
: `${base?.replace(/\/$/, '')}/${String(rawUrl).replace(/^\//, '')}`;
90+
if (fullUrl.startsWith('data:')) {
91+
throw new Error('Blocked request to data: URL');
92+
}
93+
} catch (e) {
94+
return Promise.reject(e);
95+
}
96+
8297
// Only access cookies on client side
8398
if (typeof window !== 'undefined') {
8499
const accessToken = Cookies.get('accessToken');

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"@radix-ui/react-tooltip": "^1.2.7",
5555
"@stellar/freighter-api": "^4.1.0",
5656
"@stellar/stellar-sdk": "^13.3.0",
57-
"axios": "^1.11.0",
57+
"axios": "^1.12.0",
5858
"class-variance-authority": "^0.7.1",
5959
"clsx": "^2.1.1",
6060
"cmdk": "^1.1.1",

0 commit comments

Comments
 (0)