mirror of
https://github.com/bitwarden/server.git
synced 2025-05-21 03:24:31 -05:00
added string length checks on all request objects that store the given data.
This commit is contained in:
parent
ff39bb1dd5
commit
4c4f803c1f
@ -6,10 +6,13 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string NewEmail { get; set; }
|
public string NewEmail { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string NewMasterPasswordHash { get; set; }
|
public string NewMasterPasswordHash { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
@ -6,8 +6,10 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string NewEmail { get; set; }
|
public string NewEmail { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,10 @@ namespace Bit.Api.Models
|
|||||||
public class PasswordRequestModel
|
public class PasswordRequestModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string NewMasterPasswordHash { get; set; }
|
public string NewMasterPasswordHash { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public CipherRequestModel[] Ciphers { get; set; }
|
public CipherRequestModel[] Ciphers { get; set; }
|
||||||
|
@ -8,12 +8,16 @@ namespace Bit.Api.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(50)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(300)]
|
||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
|
[StringLength(50)]
|
||||||
public string MasterPasswordHint { get; set; }
|
public string MasterPasswordHint { get; set; }
|
||||||
|
|
||||||
public User ToUser()
|
public User ToUser()
|
||||||
|
@ -6,6 +6,7 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@ namespace Bit.Api.Models
|
|||||||
public class UpdateProfileRequestModel
|
public class UpdateProfileRequestModel
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(50)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
[StringLength(50)]
|
||||||
public string MasterPasswordHint { get; set; }
|
public string MasterPasswordHint { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[RegularExpression("^[a-z]{2}-[A-Z]{2}$")]
|
[RegularExpression("^[a-z]{2}-[A-Z]{2}$")]
|
||||||
|
@ -9,6 +9,7 @@ namespace Bit.Api.Models
|
|||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public bool? Enabled { get; set; }
|
public bool? Enabled { get; set; }
|
||||||
|
[StringLength(50)]
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
|
||||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||||
|
@ -6,6 +6,7 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EmailAddress]
|
[EmailAddress]
|
||||||
|
[StringLength(50)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public string MasterPasswordHash { get; set; }
|
public string MasterPasswordHash { get; set; }
|
||||||
|
@ -13,18 +13,25 @@ namespace Bit.Api.Models
|
|||||||
public CipherType Type { get; set; }
|
public CipherType Type { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
|
[StringLength(36)]
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
[StringLength(36)]
|
||||||
public string FolderId { get; set; }
|
public string FolderId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(300)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(5000)]
|
||||||
public string Uri { get; set; }
|
public string Uri { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(200)]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(300)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(5000)]
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
|
||||||
public virtual Site ToSite(string userId = null)
|
public virtual Site ToSite(string userId = null)
|
||||||
|
@ -9,6 +9,7 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(300)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public Folder ToFolder(string userId = null)
|
public Folder ToFolder(string userId = null)
|
||||||
|
@ -7,19 +7,25 @@ namespace Bit.Api.Models
|
|||||||
{
|
{
|
||||||
public class SiteRequestModel
|
public class SiteRequestModel
|
||||||
{
|
{
|
||||||
|
[StringLength(36)]
|
||||||
public string FolderId { get; set; }
|
public string FolderId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(300)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(5000)]
|
||||||
public string Uri { get; set; }
|
public string Uri { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(200)]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(300)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
|
[StringLength(5000)]
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
|
||||||
public Site ToSite(string userId = null)
|
public Site ToSite(string userId = null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user