Hello! We are running our annual fundraising. Please consider making a donation if you value this freely available service or want to support people around the world working towards liberatory social change. https://riseup.net/donate.

  1. 28 Jan, 2020 3 commits
  2. 27 Jan, 2020 2 commits
  3. 26 Jan, 2020 7 commits
    • aguestuser's avatar
      Merge branch 'ni-fixup-mr-173' into 'master' · 63b1c2f9
      aguestuser authored
      [ni] fixup !173: fix (incomplete) unit test
      
      See merge request team-friendo/signalboost!174
      63b1c2f9
    • aguestuser's avatar
      [ni] fixup !173: fix (incomplete) unit test · d14d6799
      aguestuser authored
      d14d6799
    • aguestuser's avatar
      Merge branch 'ni-rate-limit-bugfix-try-defensively-parsing-outbound-attachments' into 'master' · 4533b1e3
      aguestuser authored
      [ni] defensively parse outbound attachments to prevent NPE on resend
      
      See merge request team-friendo/signalboost!173
      4533b1e3
    • aguestuser's avatar
      [ni] defensively parse outbound attachments to prevent NPE on resend · f8818bf2
      aguestuser authored
      SYMPTOM:
      
      * when resending rate-limited messages, signald throws an NPE when
        trying to read construct a file handle from the
        `attachment.filename` field
      
      this is the error message:
      
      ```
      signald_1      | java.lang.NullPointerException: null
      signald_1      |        at java.io.File.<init>(File.java:277) ~[?:1.8.0_232]
      signald_1      |        at io.finn.signald.SocketHandler.send(SocketHandler.java:233) ~[signald.jar:unspecified]
      signald_1      |        at io.finn.signald.SocketHandler.handleRequest(SocketHandler.java:140) [signald.jar:unspecified]
      signald_1      |        at io.finn.signald.SocketHandler.run(SocketHandler.java:125) [signald.jar:unspecified]
      signald_1      |        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
      
      ```
      
      RELEVANT CODE:
      
      in signald:
      
      ```
      // io.signald.SocketHandler.send(SocketHandler.java:233
      List<SignalServiceAttachment> attachments = null;
          if (request.attachments != null) {
              attachments = new ArrayList<>(request.attachments.size());
              for (JsonAttachment attachment : request.attachments) {
                  try {
                      File attachmentFile = new File(attachment.filename);
                      InputStream attachmentStream = new FileInputStream(attachmentFile);
                      final long attachmentSize = attachmentFile.length();
                      String mime = Files.probeContentType(attachmentFile.toPath());
                      if (mime == null) {
                          mime = "application/octet-stream";
                      }
      
                      attachments.add(new SignalServiceAttachmentStream(attachmentStream, mime, attachmentSize, Optional.of(attachmentFile.getName()), attachment.voiceNote, attachment.getPreview(), attachment.width, attachment.height, Optional.fromNullable(attachment.caption), Optional.fromNullable(attachment.blurhash), null));
                  } catch (IOException e) {
                      throw new AttachmentInvalidException(attachment.filename, e);
                  }
              }
          }
      
      ```
      
      in decompiled java bytecode:
      
      ```
      // java.io.File.class:61
      
          public File(String var1) {
              if (var1 == null) {
                  throw new NullPointerException();
              } else {
                  this.path = fs.normalize(var1);
                  this.prefixLength = fs.prefixLength(this.path);
              }
          }
      
      // java.io.FileInputStream.class:23
      
          public FileInputStream(File var1) throws FileNotFoundException {
              this.closeLock = new Object();
              String var2 = var1 != null ? var1.getPath() : null;
              SecurityManager var3 = System.getSecurityManager();
              if (var3 != null) {
                  var3.checkRead(var2);
              }
      
              if (var2 == null) {
                  throw new NullPointerException();
              } else if (var1.isInvalid()) {
                  throw new FileNotFoundException("Invalid file path");
              } else {
                  this.fd = new FileDescriptor();
                  this.fd.attach(this);
                  this.path = var2;
                  this.open(var2);
                  this.altFinalizer = getFinalizer(this);
                  if (this.altFinalizer == null) {
                      FileCleanable.register(this.fd);
                  }
      
              }
          }
      
      ```
      
      HYPOTHESIS:
      
      * signald is throwing an NPE, because we tried to parse
        `outSdMessagefilename` from `request.storedFilename`, when in fact
        `request` was providing us `request.filename`.
      * as a result `outSdMessage.filename` was undefined, so when we passed
        it to `File attachmentFile = new File(attachment.filename);`
        in `signald.SocketHandler.send(SocketHandler.java:233)`,
        `attachment.filename` is null and the constructore throws an NPE
      
      ATTEMPTED FIX:
      
      * defensively try to parse a `filename` field from either
        `storedFilename` (if present), `filename` (if not), or provide an
        empty string
      * in the ideal case, this grabs the filename from whatever field it
        was provided in
      * as a fallback, it at least prevents the original NPE by providing an
        empty string, which will prevent `new File` from crashing, but cause
        `new InputFileStream` to throw a `FileNotFoundException`, which
        fortunately is okay (or at least better), because that exception is
        handled by signald and should give us slightly better reporting and
        ability to recover?
      f8818bf2
    • aguestuser's avatar
      Merge branch '204-only-override-message-expiry-time-for-subscribers' into 'master' · 01615d7f
      aguestuser authored
      [#204] Resolve "BUG: users trying to subscribe get confusing expiry time messages before/ instead of welcome message"
      
      Closes #204
      
      See merge request team-friendo/signalboost!170
      01615d7f
    • aguestuser's avatar
      [204] wait 2 sec before setting expiry time for new users · 9a324b0e
      aguestuser authored
      (because why not? i'll try anything!)
      9a324b0e
    • aguestuser's avatar
      [204] only override expiry time for subscribers · 6d63b3e7
      aguestuser authored
      (do nothing for randos)
      6d63b3e7
  4. 23 Jan, 2020 2 commits
    • aguestuser's avatar
      Merge branch 'ni-fix-bug-in-resending-rate-limited-messages-with-attachments' into 'master' · 52b53cf0
      aguestuser authored
      [hotfix] fix bug causing rate-limit resends with attachments to fail
      
      See merge request team-friendo/signalboost!168
      52b53cf0
    • aguestuser's avatar
      [ni] fix bug causing rate-limit resends with attachments to fail · c7d450e8
      aguestuser authored
      * SYMPTOM: halting error when attempting to resend a rate-limited
        message that contained attachment. crashes due to deserialization
        error with message: "Cannot deserialize instance of
        `java.lang.String` out of START_OBJECT token"
      * CAUSE: we were failing to transform attachments from their inbound
        format to their outbound format (and yes, it's annoying that signald
        uses a different format for inboud and outbound attachments!)
      * FIX: parse outbound attachments the first time we resend a message
        and alter the hashing algorithm such that it hashes a field that is
        not removed during that parse step (ie: use the filename,not the digest)
      c7d450e8
  5. 22 Jan, 2020 4 commits
  6. 21 Jan, 2020 4 commits
  7. 19 Jan, 2020 4 commits
    • aguestuser's avatar
      Merge branch '186-fixup-mr-165' into 'master' · 8be46e1f
      aguestuser authored
      [#186] fixup !165
      
      Closes #186
      
      See merge request !166
      8be46e1f
    • aguestuser's avatar
      [186] fixup !165 · 90d02a68
      aguestuser authored
      * MR !165 implemented an exponential backoff resend queue for
        rate-limited messages, but it got the type of signald `attachments` wrong
        (they are objects not strings, and thus, not directly hashable)
      * this fixes that by hashing one of the (unique) fields on each
        `attachment` in an `SdMessage`
      90d02a68
    • aguestuser's avatar
      Merge branch '186-queue-and-resend-rate-limited-messages' into 'master' · eca86d24
      aguestuser authored
      [#186] Resolve "queue and resend rate-limited messages"
      
      Closes #186
      
      See merge request team-friendo/signalboost!165
      eca86d24
    • aguestuser's avatar
      [186] enqueue rate-limited messages in top-level dispatch code · b043ca24
      aguestuser authored
      * modify `enqueueResend` to:
        * have "fire-and-forget" semantics, ie: return immediately without waiting for enqueued resend to be attempted
        * return the interval it will wait before attempting enqueued resend
      
      * modify `dipatcher.run.dispatch` to:
        * hold a reference to a module-local `resendQueue` hash map created in `dispatcher.run.run` (which it will use to track state of resent messages)
        * enqueue resend for rate-limited messages identified by `detectRateLimitedMessage` helper
        * include attempted resend interval in admin notification about rate limit
      b043ca24
  8. 18 Jan, 2020 2 commits
    • aguestuser's avatar
      [186] implement exponential backoff resends in `#enqueueResend` · e69e9288
      aguestuser authored
      * keep a queue of resent messages and the interval that was waited
        before sending them
      * every time a message errors, resend it waiting double the last
        interval we waited last time
      * when we resend a message for the first time, we add it to the queue
        and resend at a specified minumum threshold (2 sec)
      * when a message exceeds a threshold (256 sec), don't resend it anymore and
        delete it from the queue
      e69e9288
    • aguestuser's avatar
      [186] implement hash function for resend module · 1b6553b3
      aguestuser authored
      * hashes an sd message into a 20-byte hex string using sha1 algo,
        taking the concatenation of the messageBody, username,
        recipientNumber, and attachment filepaths as input to the hash
      1b6553b3
  9. 17 Jan, 2020 2 commits
  10. 14 Jan, 2020 6 commits
  11. 13 Jan, 2020 4 commits