11960: Fix permission checking for events on trashed collections.
[arvados.git] / services / ws / session_v0.go
index 44e2a1deb5843f5909fc6f9157bbde1ca045e424..daa5208d0fef564e4b02759e2f8665f6447b8fa9 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
 package main
 
 import (
@@ -16,7 +20,16 @@ var (
        errQueueFull   = errors.New("client queue full")
        errFrameTooBig = errors.New("frame too big")
 
-       sendObjectAttributes = []string{"state", "name", "owner_uuid", "portable_data_hash"}
+       // Send clients only these keys from the
+       // log.properties.old_attributes and
+       // log.properties.new_attributes hashes.
+       sendObjectAttributes = []string{
+               "is_trashed",
+               "name",
+               "owner_uuid",
+               "portable_data_hash",
+               "state",
+       }
 
        v0subscribeOK   = []byte(`{"status":200}`)
        v0subscribeFail = []byte(`{"status":400}`)
@@ -157,6 +170,7 @@ func (sub *v0subscribe) sendOldEvents(sess *v0session) {
                sess.log.WithError(err).Error("db.Query failed")
                return
        }
+       defer rows.Close()
        for rows.Next() {
                var id uint64
                err := rows.Scan(&id)