1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-07 19:05:07 -05:00
Commit Graph

94 Commits

Author SHA1 Message Date
1bd515e8f0 Refuse upload renew if a file is validated (#1284)
Download should return regardless of file validation state
2021-04-26 14:36:06 -05:00
b68c841e56 Move renew endpoint to fix overlapping endpoint issue (#1266) 2021-04-12 09:44:45 -05:00
022e404cc5 Attachment blob upload (#1229)
* Add Cipher attachment upload endpoints

* Add validation bool to attachment storage data

This bool is used to determine whether or not to renew upload links

* Add model to request a new attachment to be made for later upload

* Add model to respond with created attachment.

The two cipher properties represent the two different
cipher model types that can be returned. Cipher Response from
personal items and mini response from organizations

* Create Azure SAS-authorized upload links for both one-shot and block uploads

* Add service methods to handle delayed upload and file size validation

* Add emergency access method for downloading attachments direct from Azure

* Add new attachment storage methods to other services

* Update service interfaces

* Log event grid exceptions

* Limit Send and Attachment Size to 500MB

* capitalize Key property

* Add key validation to Azure Event Grid endpoint

* Delete blob for unexpected blob creation events

* Set Event Grid key at API startup

* Change renew attachment upload url request path to match Send

* Shore up attachment cleanup method.

As long as we have the required information, we should always delete
attachments from each the Repository, the cipher in memory, and the
file storage service to ensure they're all synched.
2021-03-30 18:41:14 -05:00
5537470703 Use sas token for attachment downloads (#1153)
* Get limited life attachment download URL

This change limits url download to a 1min lifetime.
This requires moving to a new container to allow for non-public blob
access.

Clients will have to call GetAttachmentData api function to receive the download
URL. For backwards compatibility, attachment URLs are still present, but will not
work for attachments stored in non-public access blobs.

* Make GlobalSettings interface for testing

* Test LocalAttachmentStorageService equivalence

* Remove comment

* Add missing globalSettings using

* Simplify default attachment container

* Default to attachments containe for existing methods

A new upload method will be made for uploading to attachments-v2.
For compatibility for clients which don't use these new methods, we need
to still use the old container. The new container will be used only for
new uploads

* Remove Default MetaData fixture.

* Keep attachments container blob-level security for all instances

* Close unclosed FileStream

* Favor default value for noop services
2021-02-22 15:35:16 -06:00
edd4bc2623 Add disable send policy (#1130)
* Add Disable Send policy

* Test DisableSend policy

* PR Review

* Update tests for using CurrentContext

This required making an interface for CurrentContext and mocking out
the members used. The interface can be expanded as needed for tests.

I moved CurrentContext to a folder, which changes the namespace
and causes a lot of file touches, but most are just adding a reference

* Fix failing test

* Update exemption to include all exempt users

* Move all CurrentContext usages to ICurrentContext

* PR review. Match messaging with Web
2021-02-04 12:54:21 -06:00
63fcdc1418 Implemented Custom role and permissions (#1057)
* Implemented Custom role and permissions

* Converted permissions columns to a json blob

* Code review fixes for Permissions

* sql build fix

* Update Permissions.cs

* formatting

* Update IOrganizationService.cs

* reworked a conditional

* built out tests for relevant organization service methods

* removed unused usings

* fixed a broken test and a bad empty string init

* removed 'Attribute' from some attribute instances
2021-01-12 11:02:39 -05:00
5aba9f7549 Add cipher response to restore (#1072)
* Return revised ciphers on restore api call

* Return restored date from restore sproc

* Test Restore updates passed in ciphers

This is necessary for CipherController to appropriately return the
up-to-date ciphers without an extra db call to read them.

* Add missing SELECT
2021-01-08 08:52:42 -06:00
a46d678d6e Fix Organization put drops cipher updates (#1044) 2020-12-17 11:19:14 -06:00
7eaf7ab770 [Bug] Fix cipher clone yielding incorrect RevisionDate (#1031)
* Fix cipher clone yielding incorrect RevisionDate

* PR fixes

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
2020-12-07 19:35:34 -06:00
edf30974dc Validate cipher updates with revision date (#994)
* Add last updated validation to cipher replacements

* Add AutoFixture scaffolding.

AutoDataAttributes and ICustomizations are meant to automatically
produce valid test input. Examples are the Cipher customizations,
which enforce the model's mutual exclusivity of UserId and
OrganizationId.

FixtureExtensions create a fluent way to generate SUTs. We currently
use parameter injection to fascilitate service testing, which is nicely
handled by AutoNSubstitute. However, in order to gain access to the
substitutions, we need to Freeze them onto the Fixture. The For fluent
method allows specifying a Freeze to a specific type's constructor and
optionally to a parameter name in that constructor.

* Unit tests for single Cipher update version checks

* Fix test runner

Test runner requires Microsoft.NET.Test.Sdk

* Move to provider model for SUT generation

This model differs from previous in that you no longer need to specify
which dependencies you would like access to. Instead, all are
remembered and can be queried through the sutProvider.

* User cipher provided by Put method reads

Every put method already reads all relevant ciphers from database,
there's no need to re-read them.

JSON serialization of datetimes seems to leave truncate at second
precision. Verify last known date time is within one second rather than
exact.

* validate revision date for share many requests

* Update build script to use Github environment path

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
2020-11-23 08:48:05 -06:00
229478adae Feature.web.534.allow multi select in org vault (#830)
* Set up API methods for bulk admin delete
2020-07-22 11:38:53 -05:00
f6044f0d00 Missed one other PR comment fix 2020-04-01 15:47:10 -04:00
1d04803bd0 Resolved PR comments, spacing and controller code-line reversion 2020-04-01 14:55:14 -04:00
d014a597dd [Soft Delete] - API updates for soft delete + retrieval 2020-04-01 13:00:25 -04:00
9800b752c0 Changed all C# control flow block statements to include space between keyword and open paren 2020-03-27 14:36:37 -04:00
b4148d3532 fix issues on cipher admin endpoints 2019-05-01 09:38:13 -04:00
f7511fce13 increase import limits 2019-03-15 11:29:07 -04:00
cc2cef5b27 pass org admin flag for attachment actions 2019-02-12 11:49:35 -05:00
43967ebbc1 increase folder limits on imports 2019-01-23 22:40:19 -05:00
7cda459127 support for attachments keys
load existing items and set attachments on key update
2018-11-14 17:19:04 -05:00
5bc07fea7e return cipher model with share put 2018-10-30 10:21:26 -04:00
0b166a080e limit collection scope option when creating cipher 2018-10-22 14:09:55 -04:00
6641d884f5 formatting 2018-10-22 14:07:17 -04:00
96b492fa07 apis for creating ciphers with org & collections 2018-10-19 12:07:31 -04:00
7164f378fc purge org vault 2018-09-25 09:12:50 -04:00
2562d5a40d reference OrganizationMembership instead 2018-08-31 17:05:27 -04:00
0816c609db check user access permissions on collections edit 2018-08-23 23:04:44 -04:00
de552be25f apis for bulk sharing 2018-06-13 14:03:44 -04:00
9f919920bc RequestSizeLimit for all attachment endpoints 2018-05-21 21:03:52 -04:00
8ce0f85fe8 only impose import limits on cloud version 2018-05-15 08:52:15 -04:00
528a0732a6 use withOrganizations sproc 2018-04-24 20:19:23 -04:00
165ee97d2f refactor cipher queries by user. tuned indexing. 2018-04-24 12:48:43 -04:00
e350ef650a dont cycle security token on re-hash 2018-04-17 08:10:17 -04:00
c4a6b3b7ef idGuid variable 2018-02-24 14:32:48 -05:00
a5630f8af4 admin attachment apis 2018-02-24 14:29:11 -05:00
5a9923092a RequestSizeLimit for attachment uploads 2018-02-19 08:20:57 -05:00
ec4eb6c3a0 update error message 2017-11-28 09:21:32 -05:00
0502ba2451 only get collection info when in an org 2017-11-24 09:28:38 -05:00
448ab08b19 limit to 500 on non self-hosted 2017-11-16 20:05:06 -05:00
a989a800f7 validate master password on purge 2017-10-25 21:38:54 -04:00
a042fd10f1 apis for purging user vault 2017-10-25 21:26:09 -04:00
255b5bbdb0 abuse limits on bulk apis 2017-10-09 16:58:37 -04:00
b0fd99b218 additional identity fields 2017-10-09 11:23:20 -04:00
0abcdd9724 import ciphers, not logins 2017-09-28 13:11:56 -04:00
c58135bac5 refactor api models for other cipher types 2017-09-21 10:52:23 -04:00
12650a0ada deprecated logins api and moved to ciphers 2017-09-20 23:52:45 -04:00
06bdda5717 change routing for org import 2017-09-06 09:06:13 -04:00
95181aef89 organization cipher import with collections 2017-09-05 17:49:34 -04:00
955755831c return CipherResponseModel from attachment post 2017-07-12 14:42:39 -04:00
f8c749bab5 share login with attachments 2017-07-10 14:30:12 -04:00