Skip to content

Commit 491803a

Browse files
authored
Merge branch 'main' into fix/532-root-browser-html
2 parents a65abe1 + 0036d89 commit 491803a

13 files changed

Lines changed: 162 additions & 22 deletions

File tree

.changeset/config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
33
"changelog": "@changesets/cli/changelog",
4-
"commit": false,
4+
"commit": true,
55
"fixed": [],
66
"linked": [],
77
"access": "restricted",
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
10-
"ignore": []
10+
"ignore": [],
11+
"commitMessage": "chore(release): version packages\n\n[skip ci]"
1112
}

.changeset/gentle-dots-swim.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
docs: add NIP-62 to supported feature list
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.changeset/tasty-parents-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nostream": patch
3+
---
4+
5+
Fix IP spoofing via unconditional trust of x-forwarded-for header

.changeset/tired-dots-cover.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/changesets.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
name: Release
1313
runs-on: ubuntu-latest
1414
environment: release
15+
permissions:
16+
contents: write
17+
pull-requests: write
1518
steps:
1619
- name: Checkout
1720
uses: actions/checkout@v3
@@ -32,5 +35,6 @@ jobs:
3235
version: npm run changeset:version
3336
publish: npm run changeset:tag
3437
createGithubReleases: true
38+
title: "chore(release): version packages"
3539
env:
3640
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}

CONFIGURATION.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ The settings below are listed in alphabetical order by name. Please keep this ta
129129
| limits.event.content[].kinds | List of event kinds to apply limit. Use `[min, max]` for ranges. Optional. |
130130
| limits.event.content[].maxLength | Maximum length of `content`. Defaults to 1 MB. Disabled when set to zero. |
131131
| limits.event.createdAt.maxPositiveDelta | Maximum number of seconds an event's `created_at` can be in the future. Defaults to 900 (15 minutes). Disabled when set to zero. |
132-
| limits.event.createdAt.minNegativeDelta | Maximum number of secodns an event's `created_at` can be in the past. Defaults to zero. Disabled when set to zero. |
133-
| limits.event.eventId.minLeadingZeroBits | Leading zero bits required on every incoming event for proof of work. |
134-
| | Defaults to zero. Disabled when set to zero. |
132+
| limits.event.createdAt.minNegativeDelta | Maximum number of seconds an event's `created_at` can be in the past. Defaults to zero. Disabled when set to zero. |
133+
| limits.event.eventId.minLeadingZeroBits | Leading zero bits required on every incoming event for proof of work. Defaults to zero. Disabled when set to zero. |
135134
| limits.event.kind.blacklist | List of event kinds to always reject. Leave empty to allow any. |
136135
| limits.event.kind.whitelist | List of event kinds to always allow. Leave empty to allow any. |
137136
| limits.event.pubkey.blacklist | List of public keys to always reject. Public keys in this list will not be able to post to this relay. |
138-
| limits.event.pubkey.minLeadingZeroBits | Leading zero bits required on the public key of incoming events for proof of work. |
139-
| | Defaults to zero. Disabled when set to zero. |
137+
| limits.event.pubkey.minLeadingZeroBits | Leading zero bits required on the public key of incoming events for proof of work. Defaults to zero. Disabled when set to zero. |
140138
| limits.event.pubkey.whitelist | List of public keys to always allow. Only public keys in this list will be able to post to this relay. Use for private relays. |
141139
| limits.event.rateLimits[].kinds | List of event kinds rate limited. Use `[min, max]` for ranges. Optional. |
142140
| limits.event.rateLimits[].period | Rate limiting period in milliseconds. For `sliding_window`: the time window during which requests are counted. For `ewma`: the half-life of the exponential decay — shorter values forget bursts faster, longer values are stricter on bursty clients. |
@@ -184,3 +182,30 @@ The settings below are listed in alphabetical order by name. Please keep this ta
184182
| limits.admissionCheck.rateLimits[].rate | Maximum number of admission checks during period. |
185183
| limits.admissionCheck.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
186184
| limits.rateLimiter.strategy | Rate limiting strategy. Either `ewma` or `sliding_window`. Defaults to `ewma`. When using `ewma`, the `period` field in each rate limit serves as the half-life for the exponential decay function. Note: when switching from `sliding_window` to `ewma`, consider increasing `rate` values slightly as EWMA penalizes bursty behavior more aggressively. |
185+
| mirroring.static[].address | Address of mirrored relay. (e.g. ws://100.100.100.100:8008) |
186+
| mirroring.static[].filters | Subscription filters used to mirror. |
187+
| mirroring.static[].limits.event | Event limit overrides for this mirror. See configurations under limits.event. |
188+
| mirroring.static[].secret | Secret to pass to relays. Nostream relays only. Optional. |
189+
| mirroring.static[].skipAdmissionCheck | Disable the admission fee check for events coming from this mirror. |
190+
| network.maxPayloadSize | Maximum number of bytes accepted per WebSocket frame |
191+
| network.remoteIpHeader | HTTP header from proxy containing IP address from client. |
192+
| network.trustedProxies | Optional allow-list of proxy IPs allowed to set `network.remoteIpHeader`; otherwise socket remote IP is used. |
193+
| nip05.domainBlacklist | List of domains blocked from NIP-05 verification. Authors with NIP-05 at these domains will be rejected. |
194+
| nip05.domainWhitelist | List of domains allowed for NIP-05 verification. If set, only authors verified at these domains can publish. |
195+
| nip05.maxConsecutiveFailures | Number of consecutive verification failures before giving up on an author. Defaults to 20. |
196+
| nip05.mode | NIP-05 verification mode: `enabled` requires verification, `passive` verifies without blocking, `disabled` does nothing. Defaults to `disabled`. |
197+
| nip05.verifyExpiration | Time in milliseconds before a successful NIP-05 verification expires and needs re-checking. Defaults to 604800000 (1 week). |
198+
| nip05.verifyUpdateFrequency | Minimum interval in milliseconds between re-verification attempts for a given author. Defaults to 86400000 (24 hours). |
199+
| paymentProcessors.lnbits.baseURL | Base URL of your Lnbits instance. |
200+
| paymentProcessors.lnbits.callbackBaseURL | Public-facing Nostream's Lnbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) |
201+
| paymentProcessors.lnurl.invoiceURL | [LUD-06 Pay Request](https://github.com/lnurl/luds/blob/luds/06.md) provider URL. (e.g. https://getalby.com/lnurlp/your-username) |
202+
| paymentProcessors.zebedee.baseURL | Zebedee's API base URL. |
203+
| paymentProcessors.zebedee.callbackBaseURL | Public-facing Nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) |
204+
| paymentProcessors.zebedee.ipWhitelist | List with Zebedee's API Production IPs. See [ZBD API Documentation](https://api-reference.zebedee.io/#c7e18276-6935-4cca-89ae-ad949efe9a6a) for more info. |
205+
| payments.enabled | Enabled payments. Defaults to false. |
206+
| payments.feeSchedules.admission[].amount | Admission fee amount in msats. |
207+
| payments.feeSchedules.admission[].enabled | Enables admission fee. Defaults to false. |
208+
| payments.feeSchedules.admission[].whitelists.event_kinds | List of event kinds to waive admission fee. Use `[min, max]` for ranges. |
209+
| payments.feeSchedules.admission[].whitelists.pubkeys | List of pubkeys to waive admission fee. |
210+
| payments.processor | Either `zebedee`, `lnbits`, `lnurl`. |
211+
| workers.count | Number of workers to spin up to handle incoming connections. Spin workers as many CPUs are available when set to zero. Defaults to zero. |

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@
2121
<a href="https://github.com/cameri/nostream/blob/main/LICENSE">
2222
<img alt="GitHub license" src="https://img.shields.io/github/license/Cameri/nostream" />
2323
</a>
24-
<a href='https://coveralls.io/github/Cameri/nostream?branch=main'>
25-
<img alt='Coverage Status' src='https://coveralls.io/repos/github/Cameri/nostream/badge.svg?branch=main' />
26-
</a>
27-
<a href='https://sonarcloud.io/project/overview?id=Cameri_nostr-ts-relay'>
28-
<img alt='Sonarcloud quality gate' src='https://sonarcloud.io/api/project_badges/measure?project=Cameri_nostr&metric=alert_status' />
24+
<a href='https://coveralls.io/github/cameri/nostream?branch=main'>
25+
<img alt='Coverage Status' src='https://coveralls.io/repos/github/cameri/nostream/badge.svg?branch=main' />
2926
</a>
3027
<a href='https://github.com/cameri/nostream/actions'>
3128
<img alt='Build status' src='https://github.com/cameri/nostream/actions/workflows/checks.yml/badge.svg?branch=main&event=push' />
@@ -64,6 +61,7 @@ NIPs with a relay-specific implementation are listed here.
6461
- [x] NIP-33: Parameterized Replaceable Events
6562
- [x] NIP-40: Expiration Timestamp
6663
- [x] NIP-44: Encrypted Payloads (Versioned)
64+
- [x] NIP-62: Request to Vanish
6765

6866
## Requirements
6967

resources/default-settings.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ nip05:
5555
domainBlacklist: []
5656
network:
5757
maxPayloadSize: 524288
58-
# Comment the next line if using CloudFlare proxy
59-
remoteIpHeader: x-forwarded-for
60-
# Uncomment the next line if using CloudFlare proxy
58+
# Uncomment only when using a trusted reverse proxy and configuring trustedProxies.
59+
# remoteIpHeader: x-forwarded-for
6160
# remoteIpHeader: cf-connecting-ip
61+
# Proxy IPs allowed to set remoteIpHeader (loopback and common docker internal)
62+
trustedProxies:
63+
- "127.0.0.1"
64+
- "::ffff:127.0.0.1"
65+
- "::1"
66+
- "10.10.10.1"
67+
- "::ffff:10.10.10.1"
6268
workers:
6369
count: 0
6470
mirroring:

src/@types/settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Info {
1414
export interface Network {
1515
maxPayloadSize?: number
1616
remoteIpHeader?: string
17+
trustedProxies?: string[]
1718
}
1819

1920
export interface RateLimit {

0 commit comments

Comments
 (0)