peer-term 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peer-term",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "license": "MIT",
5
5
  "description": "Share your terminal instantly using a 6-digit code. Encrypted. No config.",
6
6
  "repository": {
package/src/index.js CHANGED
@@ -90,8 +90,7 @@ if (argv.verbose) {
90
90
 
91
91
  // ─── Configuration ───────────────────────────────────────────────────────────
92
92
  const DEFAULT_RELAYS = [
93
- 'wss://peer-term-relay.onrender.com',
94
- 'wss://peer-term-relay-production-9b7a.up.railway.app'
93
+ 'wss://relay.dhananjaybalekar.in'
95
94
  ];
96
95
  const RELAY_URLS = argv.relay
97
96
  ? argv.relay.split(',').map(s => s.trim())
@@ -613,6 +612,10 @@ class Session {
613
612
  try {
614
613
  const parsedMsg = JSON.parse(plaintext);
615
614
  if (parsedMsg && typeof parsedMsg.type === 'string' && parsedMsg.type.startsWith('file-')) {
615
+ if (this.readOnly) {
616
+ this._sendFileError(parsedMsg.id, 'File uploads are disabled in read-only mode');
617
+ return;
618
+ }
616
619
  this._handleFileMessage(parsedMsg);
617
620
  return;
618
621
  }
@@ -846,6 +849,12 @@ class Session {
846
849
  * All file messages arrive over the DataChannel only.
847
850
  */
848
851
  _handleFileMessage(msg) {
852
+ // Defense-in-depth: reject all file operations in read-only sessions
853
+ if (this.readOnly) {
854
+ this._sendFileError(msg.id, 'File uploads are disabled in read-only mode');
855
+ return;
856
+ }
857
+
849
858
  switch (msg.type) {
850
859
  case 'file-start': {
851
860
  // Validate required fields
@@ -1370,6 +1379,10 @@ class Session {
1370
1379
  try {
1371
1380
  const parsedMsg = JSON.parse(plaintext);
1372
1381
  if (parsedMsg && typeof parsedMsg.type === 'string' && parsedMsg.type.startsWith('file-')) {
1382
+ if (this.readOnly) {
1383
+ this._sendFileError(parsedMsg.id, 'File uploads are disabled in read-only mode');
1384
+ return;
1385
+ }
1373
1386
  this._handleFileMessage(parsedMsg);
1374
1387
  return;
1375
1388
  }
@@ -1527,6 +1540,10 @@ class Session {
1527
1540
  try {
1528
1541
  const msg = JSON.parse(plaintext);
1529
1542
  if (msg && typeof msg.type === 'string' && msg.type.startsWith('file-')) {
1543
+ if (this.readOnly) {
1544
+ this._sendFileError(msg.id, 'File uploads are disabled in read-only mode');
1545
+ return;
1546
+ }
1530
1547
  this._handleFileMessage(msg);
1531
1548
  return;
1532
1549
  }