Jean-Paul Calderone
3de9c73b0b
preserve the type when renewing HashedLeaseInfo
...
does this mean immutable lease renewal is untested? maybe
2021-11-05 14:11:05 -04:00
Jean-Paul Calderone
5d703d9893
some type annotations
2021-11-05 14:10:27 -04:00
Jean-Paul Calderone
0cd96ed713
fix the debug tool for the hashed lease secret case
2021-11-05 14:09:46 -04:00
Jean-Paul Calderone
931ddf85a5
introduce an explicit representation of the v1 mutable container schema
...
This is only a partial representation, sufficient to express the changes that
are coming in v2.
2021-11-04 15:26:58 -04:00
Jean-Paul Calderone
2186bfcc37
silence some mypy errors :/
...
I don't know the "right" way to make mypy happy with these things
2021-11-04 14:40:43 -04:00
Jean-Paul Calderone
6889ab2a76
fix syntax of type hint
2021-11-04 14:16:55 -04:00
Jean-Paul Calderone
7a59aa83bb
add missing import
2021-11-04 14:12:54 -04:00
Jean-Paul Calderone
b69e8d013b
introduce immutable container schema version 2
...
This version used on-disk hashed secrets to reduce the chance of secrets
leaking to unintended parties.
2021-11-04 14:07:49 -04:00
Jean-Paul Calderone
234b8dcde2
Formalize LeaseInfo interface in preparation for another implementation
2021-11-04 12:07:24 -04:00
Jean-Paul Calderone
10724a91f9
introduce an explicit representation of the v1 immutable container schema
...
This is only a partial representation, sufficient to express the changes that
are coming in v2.
2021-11-04 10:17:36 -04:00
Jean-Paul Calderone
274dc6e837
Introduce UnknownContainerVersionError
base w/ structured args
2021-11-04 10:06:26 -04:00
Jean-Paul Calderone
a71b1d31bf
Merge remote-tracking branch 'upstream/master'
2021-11-04 10:02:54 -04:00
Jean-Paul Calderone
7335b2a597
remove unused import
2021-11-03 13:16:15 -04:00
Jean-Paul Calderone
b5f882ffa6
introduce and use LeaseInfo.is_cancel_secret
2021-10-28 15:21:51 -04:00
Jean-Paul Calderone
8b976b441e
add LeaseInfo.is_renew_secret and use it
2021-10-28 15:21:51 -04:00
Jean-Paul Calderone
78dbe76994
remove unused import
2021-10-28 15:20:44 -04:00
Jean-Paul Calderone
1b46ac7a24
add MutableShareFile.is_valid_header and use it
2021-10-28 11:38:18 -04:00
Jean-Paul Calderone
66845c9a17
Add ShareFile.is_valid_header and use it instead of manual header inspection
2021-10-28 11:12:20 -04:00
Jean-Paul Calderone
65d3ab6142
move backdating logic into mutable/immutable share files
2021-10-28 10:53:52 -04:00
Jean-Paul Calderone
3514995068
some versions of mypy don't like this so nevermind
2021-10-28 10:26:30 -04:00
Jean-Paul Calderone
76caf46347
make the alternate LeaseInfo constructors into class methods
2021-10-28 10:23:58 -04:00
Jean-Paul Calderone
70fb5d563a
Get rid of the public expiration_time attribute
...
LeaseInfo now has a getter and a setter for this attribute.
LeaseInfo is now also immutable by way of `attrs`.
LeaseInfo is now also comparable by way of `attrs`.
2021-10-28 09:48:26 -04:00
Jean-Paul Calderone
470657b337
Drop corruption advisories if we don't have a matching share
2021-10-23 07:35:05 -04:00
Jean-Paul Calderone
194499aafe
remove unused import
2021-10-22 16:09:54 -04:00
Jean-Paul Calderone
6449ad03de
Do not record corruption advisories if there is no available space
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
f789339a79
Have MutableShare file only write a new lease if there is room for it
...
This is analagous to the earlier ShareFile change.
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
dd1ab2afe8
Add a helper to compute the size of a lease in a mutable share
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
4defc641a2
Have ShareFile only write a new lease if there is room for it
...
StorageServer passes available space down so it can make the decision.
ShareFile has to do it because `add_or_renew_lease` only *sometimes* adds a
lease and only ShareFile knows when that is.
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
1264c3be1e
Use _add_or_renew_leases
helper consistently in StorageServer
...
This will make it easier to add a new argument to the underlying
`add_or_renew_lease` call.
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
b3aa1e224f
Add a helper to LeaseInfo for computing size
...
This lets some code LBYL and avoid writing if the lease won't fit in the
immutable share in the space available.
2021-10-22 15:56:45 -04:00
Jean-Paul Calderone
82e4704415
Merge remote-tracking branch 'remediate/master' into LFS-01-008
2021-10-22 15:27:15 -04:00
Jean-Paul Calderone
ce30f9dd06
clean up copyediting errors
2021-10-22 15:04:45 -04:00
Jean-Paul Calderone
d8c466e9a7
try to explain lease_count_format
more clearly
2021-10-22 12:35:11 -04:00
Jean-Paul Calderone
3cd9a02c81
Reject negative lengths in MutableShareFile._read_share_data and readv
2021-10-18 20:22:52 -04:00
Jean-Paul Calderone
df64bbb1e4
fail to encode the lease count *before* changing anything
...
This preserves the failure behavior - `struct.error` is raised - but leaves
the actual share file contents untouched if the new lease count cannot be
encoded.
There are still two separate write operations so it is conceivable that some
other problem could cause `write_lease_record` to happen but
`write_encoded_num_leases` not to happen. As far as I can tell we have
severely limited options for addressing that problem in general as long as
share files are backed by a POSIX filesystem.
However, by removing the failure mode that depends on user input, it may be
that this is all that is needed to close the *security* hole.
2021-10-18 20:17:41 -04:00
Jean-Paul Calderone
f60bbbd3e2
make it possible to test this behavior of add_lease
2021-10-18 20:17:41 -04:00
Itamar Turner-Trauring
016d6b4530
Fix spurious type checking error.
2021-09-29 14:10:14 -04:00
Itamar Turner-Trauring
58d7e2f627
Simplify implementation.
2021-09-29 13:58:53 -04:00
Itamar Turner-Trauring
8fb6afee1b
Refactor BucketWriters such that disconnection can be limited Foolscap.
2021-09-29 13:42:17 -04:00
Itamar Turner-Trauring
a4153b7125
Implementation plan.
2021-09-29 11:56:04 -04:00
Itamar Turner-Trauring
fadfbcad99
Merge pull request #1130 from tahoe-lafs/3801-no-overlapping-writes-immutable-upload
...
Disallow conflicting overlapping writes when doing an immutable upload.
Fixes ticket:3801
2021-09-28 10:37:56 -04:00
Itamar Turner-Trauring
0b1082fc04
Fix lint.
2021-09-24 12:04:12 -04:00
Itamar Turner-Trauring
6ef3811112
Prevent conflicting overlapping writes.
2021-09-24 11:54:08 -04:00
Itamar Turner-Trauring
1ff4e61e41
Low-level tests for conflicting and non-conflicting writes.
2021-09-24 10:49:27 -04:00
Itamar Turner-Trauring
911a5e2ed1
Rip out server-side usage of operators other than eq, because nothing ever used them.
2021-09-15 11:07:02 -04:00
Itamar Turner-Trauring
148a0573de
Replace colon on filename only, not on whole path.
...
This would break Windows logging of corruption reports, since colon would be removed from e.g. "C:".
2021-09-03 13:11:02 -04:00
Itamar Turner-Trauring
7d32335353
Clarify and remove duplication.
2021-08-30 16:49:11 -04:00
Itamar Turner-Trauring
d599568c79
Tests validating that the operation for adding a lease will renew the lease
...
instead if it already exists.
2021-08-19 13:56:13 -04:00
Itamar Turner-Trauring
dfff187ad0
Make time pluggable to support better testing.
2021-08-19 13:23:01 -04:00
Itamar Turner-Trauring
3f98349cd9
Limit Pickle protocol to version supported by Python 2.
2021-06-16 11:53:25 -04:00