Skip to content

Commit

Permalink
fix: isPrivateIpで検証時にipバージョンが一致するかを確認するように (#12988)
Browse files Browse the repository at this point in the history
* fix: isPrivateIpで検証時にipバージョンが一致するかを確認するように

* Update CHANGELOG.md

* Update CHANGELOG.md
  • Loading branch information
GrapeApple0 authored Jan 14, 2024
1 parent 12142a2 commit ec4e57b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- Fix: `drive/files/update`でファイル名のバリデーションが機能していない問題を修正
- Fix: `notes/create`で、`text`が空白文字のみで構成されているか`null`であって、かつ`text`だけであるリクエストに対するレスポンスが400になるように変更
- Fix: `notes/create`で、`text`が空白文字のみで構成されていてかつリノート、ファイルまたは投票を含んでいるリクエストに対するレスポンスの`text``""`から`null`になるように変更
- Fix: ipv4とipv6の両方が利用可能な環境でallowedPrivateNetworksが設定されていた場合プライベートipの検証ができていなかった問題を修正

## 2023.12.2

Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/core/DownloadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export class DownloadService {
const parsedIp = ipaddr.parse(ip);

for (const net of this.config.allowedPrivateNetworks ?? []) {
if (parsedIp.match(ipaddr.parseCIDR(net))) {
const cidr = ipaddr.parseCIDR(net);
if (cidr[0].kind() === parsedIp.kind() && parsedIp.match(ipaddr.parseCIDR(net))) {
return false;
}
}
Expand Down

0 comments on commit ec4e57b

Please sign in to comment.