Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(backend:auth): allow trusted private IPs for OIDC avatar downloads

johaven9c9b682b1357
diff --git a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
index 1bb297b3..9ff344c3 100644
--- a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
+++ b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
@@ -436,7 +436,10 @@ export class AuthProviderOIDC implements AuthProvider {
try {
const tmpPicturePath = path.join(user.tmpPath, USER_AVATAR_FILE_NAME)
// retrieve headers
- const { contentType, contentLength, lastModified } = await downloadFile(this.http, downloadDto, tmpPicturePath, { getContentInfo: true })
+ const { contentType, contentLength, lastModified } = await downloadFile(this.http, downloadDto, tmpPicturePath, {
+ allowPrivateIP: true, // trust the url source
+ getContentInfo: true
+ })
pictureContentLength = contentLength ?? undefined
pictureLastModified = lastModified ?? ''
@@ -458,10 +461,10 @@ export class AuthProviderOIDC implements AuthProvider {
this.logger.warn({ tag: this.updatePictureUrl.name, msg: `checks failed: ${e}` })
}
- // download avatar
+ // download avatar (trust the url source)
const userAvatarTmpPath = path.join(user.tmpPath, USER_AVATAR_FILE_NAME)
try {
- await downloadFile(this.http, downloadDto, userAvatarTmpPath)
+ await downloadFile(this.http, downloadDto, userAvatarTmpPath, { allowPrivateIP: true })
} catch (e) {
this.logger.warn({ tag: this.updatePictureUrl.name, msg: `download failed: ${e}` })
return