Skip to content

Commit 7ec739c

Browse files
authored
Merge branch 'main' into dev
2 parents 6fb6b8d + f0ae36e commit 7ec739c

File tree

1 file changed

+71
-75
lines changed

1 file changed

+71
-75
lines changed

README.md

Lines changed: 71 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@ services:
1515
- MODE=normal
1616
volumes:
1717
- ./data:/home/.local/share/signal-cli
18+
restart: unless-stopped
1819
networks:
1920
backend:
2021
aliases:
2122
- signal-api
22-
restart: unless-stopped
2323

2424
secured-signal:
2525
image: ghcr.io/codeshelldev/secured-signal-api:latest
2626
container_name: secured-signal
27-
networks:
28-
backend:
29-
aliases:
30-
- secured-signal-api
3127
environment:
3228
API__URL: http://signal-api:8080
33-
VARIABLES__RECIPIENTS: '[000,001,002]'
34-
VARIABLES__NUMBER: 123456789
35-
API__TOKENS: '[LOOOOOONG_STRING]'
29+
SETTINGS__VARIABLES__RECIPIENTS:
30+
["+123400002", "+123400003", "+123400004"]
31+
SETTINGS__VARIABLES__NUMBER: "+123400001"
32+
API__TOKENS: [LOOOOOONG_STRING]
3633
ports:
3734
- "8880:8880"
3835
restart: unless-stopped
36+
networks:
37+
backend:
38+
aliases:
39+
- secured-signal-api
3940

4041
networks:
4142
backend:
@@ -57,16 +58,11 @@ services:
5758
secured-signal:
5859
image: ghcr.io/codeshelldev/secured-signal-api:latest
5960
container_name: secured-signal
60-
networks:
61-
proxy:
62-
backend:
63-
aliases:
64-
- secured-signal-api
6561
environment:
6662
API__URL: http://signal-api:8080
67-
VARIABLES__RECIPIENTS: '[000,001,002]'
68-
VARIABLES__NUMBER: 123456789
69-
API__TOKENS: '[LOOOOOONG_STRING]'
63+
SETTINGS__VARIABLES__RECIPIENTS: ["+123400002", "+123400003", "+123400004"]
64+
SETTINGS__VARIABLES__NUMBER: "+123400001"
65+
API__TOKENS: [LOOOOOONG_STRING]
7066
labels:
7167
- traefik.enable=true
7268
- traefik.http.routers.signal-api.rule=Host(`signal-api.mydomain.com`)
@@ -77,6 +73,11 @@ services:
7773
- traefik.http.services.signal-api-svc.loadbalancer.server.port=8880
7874
- traefik.docker.network=proxy
7975
restart: unless-stopped
76+
networks:
77+
proxy:
78+
backend:
79+
aliases:
80+
- secured-signal-api
8081

8182
networks:
8283
backend:
@@ -139,10 +140,10 @@ Notice the `@` infront of `authorization`. See [KeyValue Pair Injection](#keyval
139140

140141
### Example
141142

142-
To send a message to 1234567:
143+
To send a message to `+123400002`:
143144

144145
```bash
145-
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d '{"message": "Hello World!", "recipients": ["1234567"]}' http://sec-signal-api:8880/v2/send
146+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer API_TOKEN" -d '{"message": "Hello World!", "recipients": ["+123400002"]}' http://sec-signal-api:8880/v2/send
146147
```
147148

148149
### Advanced
@@ -207,16 +208,17 @@ api:
207208
208209
logLevel: INFO
209210
210-
variables:
211-
number: "000"
212-
recipients: ["001", "group.id", "user.id"]
211+
settings:
212+
variables:
213+
number: "+123400001"
214+
recipients: ["+123400002", "group.id", "user.id"]
213215
214-
messageAliases: [{ alias: "msg", score: 100 }]
216+
messageAliases: [{ alias: "msg", score: 100 }]
215217
216-
blockedEndpoints:
217-
- /v1/about
218-
allowedEndpoints:
219-
- /v2/send
218+
blockedEndpoints:
219+
- /v1/about
220+
allowedEndpoints:
221+
- /v2/send
220222
```
221223

222224
#### Token Configs
@@ -243,10 +245,10 @@ Suppose you want to set a new [Placeholder](#placeholders) `NUMBER` in your Envi
243245

244246
```yaml
245247
environment:
246-
VARIABLES__NUMBER: "000"
248+
SETTINGS__VARIABLES__NUMBER: "+123400001"
247249
```
248250

249-
This would internally be converted into `variables.number` matching the config formatting.
251+
This would internally be converted into `settings.variables.number` matching the config formatting.
250252

251253
> [!IMPORTANT]
252254
> Underscores `_` are removed during Conversion, Double Underscores `__` on the other hand convert the Variable into a nested Object (`__` replaced by `.`)
@@ -283,52 +285,48 @@ api:
283285
```
284286

285287
> [!IMPORTANT]
286-
> It is highly recommended use API Tokens
287-
288-
> _What if I just don't?_
289-
290-
Secured Signal API will still work, but important Security Features won't be available
291-
like Blocked Endpoints and any sort of Auth.
288+
> Using API Tokens is highly recommended, but not mandatory.
289+
> Some important Security Features won't be available (like default Blocked Endpoints).
292290

293291
> [!NOTE]
294292
> Blocked Endpoints can be reactivated by manually configuring them
295293

296294
### Endpoints
297295

298-
Because Secured Signal API is just a Proxy you can use all of the [Signal REST API](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md) endpoints except for...
296+
Since Secured Signal API is just a Proxy you can use all of the [Signal REST API](https://github.com/bbernhard/signal-cli-rest-api/blob/master/doc/EXAMPLES.md) endpoints except for...
299297

300-
| Endpoint |
301-
| :-------------------- |
302-
| **/v1/about** |
303-
| **/v1/configuration** |
304-
| **/v1/devives** |
305-
| **/v1/register** |
306-
| **/v1/unregister** |
307-
| **/v1/qrcodelink** |
308-
| **/v1/accounts** |
309-
| **/v1/contacts** |
298+
| Endpoint | |
299+
| :-------------------- | ------------------ |
300+
| **/v1/about** | **/v1/unregister** |
301+
| **/v1/configuration** | **/v1/qrcodelink** |
302+
| **/v1/devives** | **/v1/contacts** |
303+
| **/v1/register** | **/v1/accounts** |
304+
305+
These Endpoints are blocked by default due to Security Risks.
310306

311307
> [!NOTE]
312-
> Matching works by checking if the requested Endpoints startswith a Blocked or Allowed Endpoint
308+
> Matching works by checking if the requested Endpoints starts with a Blocked or an Allowed Endpoint
313309

314-
These Endpoints are blocked by default due to Security Risks, but can be modified by setting `blockedEndpoints` in your config:
310+
You can modify Blocked Endpoints by configuring `blockedEndpoints` in your config:
315311

316312
```yaml
317-
blockedEndpoints: [/v1/register, /v1/unregister, /v1/qrcodelink, /v1/contacts]
313+
settings:
314+
blockedEndpoints: [/v1/register, /v1/unregister, /v1/qrcodelink, /v1/contacts]
318315
```
319316

320-
Override Blocked Endpoints by explicitly allowing endpoints in `allowedEndpoints`.
317+
You can also override Blocked Endpoints by adding Allowed Endpoints to `allowedEndpoints`.
318+
319+
```yaml
320+
settings:
321+
allowedEndpoints: [/v2/send]
322+
```
321323

322324
| Config (Allow) | (Block) | Result | | | |
323325
| :------------------------------- | :---------------------------------- | :--------: | --- | :---------------: | --- |
324326
| `allowedEndpoints: ["/v2/send"]` | `unset` | **all** | 🛑 | **`/v2/send`** | ✅ |
325327
| `unset` | `blockedEndpoints: ["/v1/receive"]` | **all** | ✅ | **`/v1/receive`** | 🛑 |
326328
| `blockedEndpoints: ["/v2"]` | `allowedEndpoints: ["/v2/send"]` | **`/v2*`** | 🛑 | **`/v2/send`** | ✅ |
327329

328-
```yaml
329-
allowedEndpoints: [/v2/send]
330-
```
331-
332330
### Variables
333331

334332
Placeholders can be added under `variables` and can then be referenced in the Body, Query or URL.
@@ -339,40 +337,38 @@ See [Placeholders](#placeholders).
339337
> Example: `number` becomes `NUMBER` in `{{.NUMBER}}`
340338

341339
```yaml
342-
variables:
343-
number: "001",
344-
recipients: [
345-
"user.id", "000", "001", "group.id"
346-
]
340+
settings:
341+
variables:
342+
number: "+123400001",
343+
recipients: ["+123400002", "group.id", "user.id"]
347344
```
348345

349346
### Message Aliases
350347

351348
To improve compatibility with other services Secured Signal API provides aliases for the `message` attribute by default:
352349

353-
| Alias | Score |
354-
| ----------- | ----- |
355-
| msg | 100 |
356-
| content | 99 |
357-
| description | 98 |
358-
| text | 20 |
359-
| body | 15 |
360-
| summary | 10 |
361-
| details | 9 |
362-
| payload | 2 |
363-
| data | 1 |
350+
| Alias | Score | Alias | Score |
351+
| ------------ | ----- | ---------------- | ----- |
352+
| msg | 100 | data.content | 9 |
353+
| content | 99 | data.description | 8 |
354+
| description | 98 | data.text | 7 |
355+
| text | 20 | data.summary | 6 |
356+
| summary | 15 | data.details | 5 |
357+
| details | 14 | body | 2 |
358+
| data.message | 10 | data | 1 |
364359

365360
Secured Signal API will pick the best scoring Message Alias (if available) to extract the correct message from the Request Body.
366361

367362
Message Aliases can be added by setting `messageAliases` in your config:
368363

369364
```yaml
370-
messageAliases:
371-
[
372-
{ alias: "msg", score: 80 },
373-
{ alias: "data.message", score: 79 },
374-
{ alias: "array[0].message", score: 78 },
375-
]
365+
settings:
366+
messageAliases:
367+
[
368+
{ alias: "msg", score: 80 },
369+
{ alias: "data.message", score: 79 },
370+
{ alias: "array[0].message", score: 78 },
371+
]
376372
```
377373

378374
### Port

0 commit comments

Comments
 (0)