Skip to content

Commit

Permalink
uplink: add MaxObjectTTL to Permission type
Browse files Browse the repository at this point in the history
This allows Uplink CLI to restrict access grant with MaxObjectTTL.

Context: storj/storj#6249

Change-Id: Ie491a89e4577eae190d52d6600df9cb6fb4498a5
  • Loading branch information
kaloyan-raev committed Sep 7, 2023
1 parent a2e90d4 commit 39cbd8e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
7 changes: 7 additions & 0 deletions access.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ type Permission struct {
// believes the time is after NotAfter.
// If set, this value should always be after NotBefore.
NotAfter time.Time
// MaxObjectTTL restricts the maximum time-to-live of objects.
// If set, new objects are uploaded with an expiration time that reflects
// the MaxObjectTTL period.
// If objects are uploaded with an explicit expiration time, the upload
// will be successful only if it is shorter than the MaxObjectTTL period.
MaxObjectTTL *time.Duration
}

// ParseAccess parses a serialized access grant string.
Expand Down Expand Up @@ -249,6 +255,7 @@ func (access *Access) Share(permission Permission, prefixes ...SharePrefix) (*Ac
AllowDelete: permission.AllowDelete,
NotBefore: permission.NotBefore,
NotAfter: permission.NotAfter,
MaxObjectTTL: permission.MaxObjectTTL,
},
internalPrefixes...,
)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/vivint/infectious v0.0.0-20200605153912-25a574ae18a3
github.com/zeebo/errs v1.3.0
golang.org/x/sync v0.3.0
storj.io/common v0.0.0-20230824112457-9233ce5adb92
storj.io/common v0.0.0-20230906174921-851a779994e4
storj.io/drpc v0.0.33
)

Expand All @@ -29,5 +29,5 @@ require (
golang.org/x/sys v0.11.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
storj.io/picobuf v0.0.1 // indirect
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
storj.io/common v0.0.0-20230824112457-9233ce5adb92 h1:05A/0l5rLnLRM1ntubre4oMZ6SvRs544cDskYuy40GE=
storj.io/common v0.0.0-20230824112457-9233ce5adb92/go.mod h1:9evX8PZey+J3bcflXmR666E8GW4uRy5EDiVvg8iER7s=
storj.io/common v0.0.0-20230906174921-851a779994e4 h1:8dVpVN/UoUUKk1CSbz8SEUD84PIP6t/58r4oKuczIKs=
storj.io/common v0.0.0-20230906174921-851a779994e4/go.mod h1:FMVOxf2+SgsmfjxwFCM1MZCKwXis4U7l22M/6nIhIas=
storj.io/drpc v0.0.33 h1:yCGZ26r66ZdMP0IcTYsj7WDAUIIjzXk6DJhbhvt9FHI=
storj.io/drpc v0.0.33/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=
storj.io/picobuf v0.0.1 h1:ekEvxSQCbEjTVIi/qxj2za13SJyfRE37yE30IBkZeT0=
storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0=
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c h1:or/DtG5uaZpzimL61ahlgAA+MTYn/U3txz4fe+XBFUg=
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c/go.mod h1:JCuc3C0gzCJHQ4J6SOx/Yjg+QTpX0D+Fvs5H46FETCk=
10 changes: 5 additions & 5 deletions testsuite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ require (
github.com/zeebo/errs v1.3.0
go.uber.org/zap v1.16.0
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db
storj.io/common v0.0.0-20230824112457-9233ce5adb92
storj.io/common v0.0.0-20230906174921-851a779994e4
storj.io/drpc v0.0.33
storj.io/storj v0.12.1-0.20230828114923-b26df035f920
storj.io/uplink v1.11.1-0.20230824095320-ae5e4af292fa
storj.io/storj v0.12.1-0.20230907102753-82b108de6990
storj.io/uplink v1.11.1-0.20230905131215-412de374f05c
)

require (
Expand Down Expand Up @@ -106,6 +106,6 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 // indirect
storj.io/picobuf v0.0.1 // indirect
storj.io/private v0.0.0-20230703113355-ccd4db5ae659 // indirect
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c // indirect
storj.io/private v0.0.0-20230824104110-1eac532af65a // indirect
)
16 changes: 8 additions & 8 deletions testsuite/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -889,16 +889,16 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=
storj.io/common v0.0.0-20220719163320-cd2ef8e1b9b0/go.mod h1:mCYV6Ud5+cdbuaxdPD5Zht/HYaIn0sffnnws9ErkrMQ=
storj.io/common v0.0.0-20230824112457-9233ce5adb92 h1:05A/0l5rLnLRM1ntubre4oMZ6SvRs544cDskYuy40GE=
storj.io/common v0.0.0-20230824112457-9233ce5adb92/go.mod h1:9evX8PZey+J3bcflXmR666E8GW4uRy5EDiVvg8iER7s=
storj.io/common v0.0.0-20230906174921-851a779994e4 h1:8dVpVN/UoUUKk1CSbz8SEUD84PIP6t/58r4oKuczIKs=
storj.io/common v0.0.0-20230906174921-851a779994e4/go.mod h1:FMVOxf2+SgsmfjxwFCM1MZCKwXis4U7l22M/6nIhIas=
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
storj.io/drpc v0.0.33 h1:yCGZ26r66ZdMP0IcTYsj7WDAUIIjzXk6DJhbhvt9FHI=
storj.io/drpc v0.0.33/go.mod h1:vR804UNzhBa49NOJ6HeLjd2H3MakC1j5Gv8bsOQT6N4=
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 h1:SVuEocEhZfFc13J1AmlVLitdGXTVrvmbzN4Z9C9Ms40=
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41/go.mod h1:iK+dmHZZXQlW7ahKdNSOo+raMk5BDL2wbD62FIeXLWs=
storj.io/picobuf v0.0.1 h1:ekEvxSQCbEjTVIi/qxj2za13SJyfRE37yE30IBkZeT0=
storj.io/picobuf v0.0.1/go.mod h1:7ZTAMs6VesgTHbbhFU79oQ9hDaJ+MD4uoFQZ1P4SEz0=
storj.io/private v0.0.0-20230703113355-ccd4db5ae659 h1:J72VWwbpllfolJoCsjVMr3YnscUUOQAruzFTsivqIqY=
storj.io/private v0.0.0-20230703113355-ccd4db5ae659/go.mod h1:mfdHEaAcTARpd4/Hc6N5uxwB1ZG3jtPdVlle57xzQxQ=
storj.io/storj v0.12.1-0.20230828114923-b26df035f920 h1:mKDz4wMrnnqhFIHf1IeYDxO2mpIy/xSgCTC2w0U1dqw=
storj.io/storj v0.12.1-0.20230828114923-b26df035f920/go.mod h1:pIQkNdsVsLebaOPZvNpBeYl++2MMlWn89gL9Y6j05TE=
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c h1:or/DtG5uaZpzimL61ahlgAA+MTYn/U3txz4fe+XBFUg=
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c/go.mod h1:JCuc3C0gzCJHQ4J6SOx/Yjg+QTpX0D+Fvs5H46FETCk=
storj.io/private v0.0.0-20230824104110-1eac532af65a h1:x0OnU7z801JmR0XwFrFxmEBqcq+FDDuSn5jMbFoyfBo=
storj.io/private v0.0.0-20230824104110-1eac532af65a/go.mod h1:6+MGr4KUXEBIOsOstFz1efPkA+8wVVfzsO8RpuAhhB4=
storj.io/storj v0.12.1-0.20230907102753-82b108de6990 h1:MT0tE+il3OKl8jmKybWvvVPhpBy/pQPbri7xKoDJn/Q=
storj.io/storj v0.12.1-0.20230907102753-82b108de6990/go.mod h1:nZMfzP16xsL4B23GnrofX2VT39pEn1lQfvkIspv35kI=

0 comments on commit 39cbd8e

Please sign in to comment.