Skip to content

Commit c65b6de

Browse files
author
subtype
committed
Merge branch 'rc-v1' into 'v1'
rc-v1 -> v1 updates See merge request subtype/subspace-api!16
2 parents 5b86814 + 9d13eee commit c65b6de

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.github/workflows/docker-image.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
branches:
1010
- 'v*'
1111

12+
permissions:
13+
contents: read
14+
packages: write
15+
1216
jobs:
1317
build-for-v:
1418
if: startsWith(github.ref, 'refs/heads/v') || (github.event_name == 'pull_request' && startsWith(github.base_ref, 'v'))

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ npm run build && npm run start
2626
| Env var | Purpose |
2727
|---------|--------|
2828
| PORT | Defaults to 9595. The port for the API and MCP server to listen on. |
29-
| LOG_LEVEL | Defaults to 'info'. Set the logging level |
29+
| LOG_LEVEL | Defaults to 'info'. Set the logging level. |
3030
| ACTIVE_VERSION | Defaults to 'v1', currently not implemented fully. |
3131
| WMATA_PRIMARY_KEY | The API key to use for obtaining WMATA status. |
32-
| JWT_SECRET | This is the secret key that is used for encrypting and decrypting JWT tokens. |
32+
| JWT_SECRET | (DEPRECATED) This is the secret key that is used for encrypting and decrypting JWT tokens. |
33+
| SESSION_SECRET | Base64 encoded random string that you can probably generate with `openssl rand -base64 64`. |
3334
| TZ | (Optional) Lets the container/logger format log messages with the machine's local time zone. |

src/server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ server.use(
4747
resave: false,
4848
saveUninitialized: true,
4949
store: memoryStore,
50+
cookie: {
51+
secure: true // Setting this to true requires trust proxy set in express
52+
}
5053
})
5154
)
5255
server.use(keycloak.middleware())
@@ -60,7 +63,7 @@ logger.info('Initializing routes...')
6063
server.use('/', statusRouter)
6164
server.use('/health', express.json(), statusRouter)
6265

63-
// reverse proxy
66+
// reverse proxy -- removing this will cause issues with secure cookies
6467
server.set('trust proxy', 1)
6568

6669
server.use(function (err: any, req: Request, res: Response, next: NextFunction) {
@@ -104,7 +107,8 @@ server.post('/messages', logIncomingAuth, keycloak.protect(), async (req: Reques
104107
logger.info(`${transport.sessionId} has an active session`)
105108
await transport.handlePostMessage(req, res, req.body) // don't remove req.body otherwise MCP inspector will panik
106109
} else {
107-
res.status(400).send(`No session was found for ${sessionId}`)
110+
logger.warn(`${sessionId} was not found`)
111+
res.status(400).send('Requested sessionId not found')
108112
}
109113
})
110114

0 commit comments

Comments
 (0)