summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--TODO4
-rw-r--r--debug-me.hs15
2 files changed, 14 insertions, 5 deletions
diff --git a/TODO b/TODO
index 62d731d..03b0a70 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-* Typing "top" causes only "to" to be accepted.
* Improve JSON, removing use of "tag"
* potential DOS where developer sends Activity Entered that all
refer back to the first Activity Seen. This requires the user
@@ -17,6 +16,9 @@
unlikely that a Activity Entered will legitimately refer to an
old backlog item.
* Encryption!
+* Add random nonce to start message, to avoid replay issues.
+ (Or perhaps the encryption derives a RSA key in a way that avoids
+ replay..)
* Network!
* Server!
* gpg key downloading, web of trust checking, prompting
diff --git a/debug-me.hs b/debug-me.hs
index 9332270..7a9f527 100644
--- a/debug-me.hs
+++ b/debug-me.hs
@@ -278,19 +278,26 @@ sendPtyInput ichan ochan p backlog logger = go
go
-- | Truncate the Backlog to remove entries older than the one
--- that the Activity refers to.
+-- that the Activity Entered refers to, but only if the referred
+-- to Activity is an Activity Seen.
--
--- If the activity refers to an item not in the backlog, no truncation is
+-- Once the developer has referred to a given Activity Seen in
+-- their Activity Entered, they cannot refer backwards to anything
+-- that came before it.
+--
+-- If the Activity refers to an item not in the backlog, no truncation is
-- done.
truncateBacklog :: Backlog -> Activity Entered -> Backlog
truncateBacklog (Backlog (b :| l)) (Activity _ hp _)
- | Just (activityLogHash b) == hp = Backlog (b :| [])
+ | truncationpoint b = Backlog (b :| [])
| otherwise = Backlog (b :| go [] l)
where
go c [] = reverse c
go c (x:xs)
- | Just (activityLogHash x) == hp = reverse (x:c)
+ | truncationpoint x = reverse (x:c)
| otherwise = go (x:c) xs
+ truncationpoint x@(ActivitySeen {}) = Just (activityLogHash x) == hp
+ truncationpoint _ = False
-- | Entered activity is legal when it points to the last Seen activvity,
-- because this guarantees that the person who entered it saw