Documentation ¶
Index ¶
- func AddEvidenceToFinding(ctx context.Context, db *database.Connection, i AddEvidenceToFindingInput) error
- func CreateAPIKey(ctx context.Context, db *database.Connection, userSlug string) (*dtos.APIKey, error)
- func CreateEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, ...) (*dtos.Evidence, error)
- func CreateFinding(ctx context.Context, db *database.Connection, i CreateFindingInput) (*dtos.Finding, error)
- func CreateOperation(ctx context.Context, db *database.Connection, i CreateOperationInput) (*dtos.Operation, error)
- func CreateQuery(ctx context.Context, db *database.Connection, i CreateQueryInput) (*dtos.Query, error)
- func CreateTag(ctx context.Context, db *database.Connection, i CreateTagInput) (*dtos.Tag, error)
- func DeleteAPIKey(ctx context.Context, db *database.Connection, i DeleteAPIKeyInput) error
- func DeleteAuthScheme(ctx context.Context, db *database.Connection, i DeleteAuthSchemeInput) error
- func DeleteAuthSchemeUsers(ctx context.Context, db *database.Connection, schemeCode string) error
- func DeleteEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, ...) error
- func DeleteFinding(ctx context.Context, db *database.Connection, i DeleteFindingInput) error
- func DeleteOperation(ctx context.Context, db *database.Connection, contentStore contentstore.Store, ...) error
- func DeleteQuery(ctx context.Context, db *database.Connection, i DeleteQueryInput) error
- func DeleteSessionsForUserSlug(ctx context.Context, db *database.Connection, userSlug string) error
- func DeleteTag(ctx context.Context, db *database.Connection, i DeleteTagInput) error
- func DeleteUser(ctx context.Context, db *database.Connection, slug string) error
- func ListAPIKeys(ctx context.Context, db *database.Connection, userSlug string) ([]*dtos.APIKey, error)
- func ListAuthDetails(ctx context.Context, db *database.Connection, ...) ([]*dtos.DetailedAuthenticationInfo, error)
- func ListEvidenceForFinding(ctx context.Context, db *database.Connection, i ListEvidenceForFindingInput) ([]dtos.Evidence, error)
- func ListEvidenceForOperation(ctx context.Context, db *database.Connection, i ListEvidenceForOperationInput) ([]*dtos.Evidence, error)
- func ListFindingsForOperation(ctx context.Context, db *database.Connection, i ListFindingsForOperationInput) ([]*dtos.Finding, error)
- func ListOperations(ctx context.Context, db *database.Connection) ([]*dtos.Operation, error)
- func ListOperationsForAdmin(ctx context.Context, db *database.Connection) ([]*dtos.Operation, error)
- func ListQueriesForOperation(ctx context.Context, db *database.Connection, operationSlug string) ([]*dtos.Query, error)
- func ListTagDifference(ctx context.Context, db *database.Connection, i ListTagsDifferenceInput) (*dtos.TagDifference, error)
- func ListTagDifferenceForEvidence(ctx context.Context, db *database.Connection, ...) (*dtos.TagDifference, error)
- func ListTagsForOperation(ctx context.Context, db *database.Connection, i ListTagsForOperationInput) ([]*dtos.Tag, error)
- func ListUsers(ctx context.Context, db *database.Connection, i ListUsersInput) ([]*dtos.User, error)
- func ListUsersForAdmin(ctx context.Context, db *database.Connection, i ListUsersForAdminInput) (*dtos.PaginationWrapper, error)
- func ListUsersForOperation(ctx context.Context, db *database.Connection, i ListUsersForOperationInput) ([]*dtos.UserOperationRole, error)
- func MoveEvidence(ctx context.Context, db *database.Connection, i MoveEvidenceInput) error
- func ReadFinding(ctx context.Context, db *database.Connection, i ReadFindingInput) (*dtos.Finding, error)
- func ReadOperation(ctx context.Context, db *database.Connection, operationSlug string) (*dtos.Operation, error)
- func ReadUser(ctx context.Context, db *database.Connection, userSlug string) (*dtos.UserOwnView, error)
- func SanitizeOperationSlug(slug string) string
- func SetUserFlags(ctx context.Context, db *database.Connection, i SetUserFlagsInput) error
- func SetUserOperationRole(ctx context.Context, db *database.Connection, i SetUserOperationRoleInput) error
- func UpdateEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, ...) error
- func UpdateFinding(ctx context.Context, db *database.Connection, i UpdateFindingInput) error
- func UpdateOperation(ctx context.Context, db *database.Connection, i UpdateOperationInput) error
- func UpdateQuery(ctx context.Context, db *database.Connection, i UpdateQueryInput) error
- func UpdateTag(ctx context.Context, db *database.Connection, i UpdateTagInput) error
- func UpdateUserProfile(ctx context.Context, db *database.Connection, i UpdateUserProfileInput) error
- type AddEvidenceToFindingInput
- type CreateEvidenceInput
- type CreateFindingInput
- type CreateOperationInput
- type CreateQueryInput
- type CreateTagInput
- type CreateUserInput
- type CreateUserOutput
- type DeleteAPIKeyInput
- type DeleteAuthSchemeInput
- type DeleteEvidenceInput
- type DeleteFindingInput
- type DeleteQueryInput
- type DeleteTagInput
- type ListEvidenceForFindingInput
- type ListEvidenceForOperationInput
- type ListFindingsForOperationInput
- type ListTagDifferenceForEvidenceInput
- type ListTagsDifferenceInput
- type ListTagsForOperationInput
- type ListUsersForAdminInput
- type ListUsersForOperationInput
- type ListUsersInput
- type MoveEvidenceInput
- type Pagination
- type ReadEvidenceInput
- type ReadEvidenceOutput
- type ReadFindingInput
- type SetUserFlagsInput
- type SetUserOperationRoleInput
- type UpdateEvidenceInput
- type UpdateFindingInput
- type UpdateOperationInput
- type UpdateQueryInput
- type UpdateTagInput
- type UpdateUserProfileInput
- type UserFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddEvidenceToFinding ¶
func AddEvidenceToFinding(ctx context.Context, db *database.Connection, i AddEvidenceToFindingInput) error
func CreateAPIKey ¶
func CreateEvidence ¶
func CreateEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, i CreateEvidenceInput) (*dtos.Evidence, error)
func CreateFinding ¶
func CreateFinding(ctx context.Context, db *database.Connection, i CreateFindingInput) (*dtos.Finding, error)
func CreateOperation ¶
func CreateOperation(ctx context.Context, db *database.Connection, i CreateOperationInput) (*dtos.Operation, error)
func CreateQuery ¶
func CreateQuery(ctx context.Context, db *database.Connection, i CreateQueryInput) (*dtos.Query, error)
CreateQuery inserts a new query into the database
func CreateTag ¶
func CreateTag(ctx context.Context, db *database.Connection, i CreateTagInput) (*dtos.Tag, error)
func DeleteAPIKey ¶
func DeleteAPIKey(ctx context.Context, db *database.Connection, i DeleteAPIKeyInput) error
func DeleteAuthScheme ¶
func DeleteAuthScheme(ctx context.Context, db *database.Connection, i DeleteAuthSchemeInput) error
DeleteAuthScheme removes a user's association with a particular auth_scheme. This function applies for both admin related actions and plain user actions. If UserSlug is not provided, this will apply to the requesting user. If it is provided, then this triggers admin validation, and will apply to the provided user matching the given slug.
func DeleteAuthSchemeUsers ¶
DeleteAuthSchemeUsers removes/unlinks all users from a provided scheme
func DeleteEvidence ¶
func DeleteEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, i DeleteEvidenceInput) error
func DeleteFinding ¶
func DeleteFinding(ctx context.Context, db *database.Connection, i DeleteFindingInput) error
func DeleteOperation ¶
func DeleteOperation(ctx context.Context, db *database.Connection, contentStore contentstore.Store, slug string) error
func DeleteQuery ¶
func DeleteQuery(ctx context.Context, db *database.Connection, i DeleteQueryInput) error
DeleteQuery removes a saved query for the given operation
func DeleteSessionsForUserSlug ¶
DeleteSessionsForUserSlug finds all existing sessions for a given user, then removes them, effectively logging the user out of the service.
func DeleteTag ¶
func DeleteTag(ctx context.Context, db *database.Connection, i DeleteTagInput) error
DeleteTag removes a tag and untags all evidence with the tag
func DeleteUser ¶
DeleteUser needs some godocs
func ListAPIKeys ¶
func ListAuthDetails ¶
func ListAuthDetails(ctx context.Context, db *database.Connection, supportedAuthSchemes *[]dtos.SupportedAuthScheme) ([]*dtos.DetailedAuthenticationInfo, error)
func ListEvidenceForFinding ¶
func ListEvidenceForFinding(ctx context.Context, db *database.Connection, i ListEvidenceForFindingInput) ([]dtos.Evidence, error)
func ListEvidenceForOperation ¶
func ListEvidenceForOperation(ctx context.Context, db *database.Connection, i ListEvidenceForOperationInput) ([]*dtos.Evidence, error)
ListEvidenceForOperation retrieves all evidence for a particular operation id matching a particular set of filters (e.g. tag:some_tag)
func ListFindingsForOperation ¶
func ListFindingsForOperation(ctx context.Context, db *database.Connection, i ListFindingsForOperationInput) ([]*dtos.Finding, error)
func ListOperations ¶
ListOperations retrieves a list of all operations that the contextual user can see
func ListOperationsForAdmin ¶
func ListOperationsForAdmin(ctx context.Context, db *database.Connection) ([]*dtos.Operation, error)
ListOperationsForAdmin is a specialized version of ListOperations where no operations are filtered For use in admin screens only
func ListQueriesForOperation ¶
func ListQueriesForOperation(ctx context.Context, db *database.Connection, operationSlug string) ([]*dtos.Query, error)
ListQueriesForOperation retrieves all saved queries for a given operation id
func ListTagDifference ¶
func ListTagDifference(ctx context.Context, db *database.Connection, i ListTagsDifferenceInput) (*dtos.TagDifference, error)
ListTagDifference determines which tag values are common between two operations. This is done via relative comparison. That is, all of the tags in the "source" are compared against the "destination" returning only tags that are common, and tags that are in the source, but not in the destination. The opposite list (tags that exist in the destination, but not the source) is not generated.
func ListTagDifferenceForEvidence ¶
func ListTagDifferenceForEvidence(ctx context.Context, db *database.Connection, input ListTagDifferenceForEvidenceInput) (*dtos.TagDifference, error)
func ListTagsForOperation ¶
func ListTagsForOperation(ctx context.Context, db *database.Connection, i ListTagsForOperationInput) ([]*dtos.Tag, error)
func ListUsers ¶
func ListUsers(ctx context.Context, db *database.Connection, i ListUsersInput) ([]*dtos.User, error)
func ListUsersForAdmin ¶
func ListUsersForAdmin(ctx context.Context, db *database.Connection, i ListUsersForAdminInput) (*dtos.PaginationWrapper, error)
ListUsersForAdmin retreives standard User (public) details, and aguments with some particular fields meant for admin review. For use in admin views only.
func ListUsersForOperation ¶
func ListUsersForOperation(ctx context.Context, db *database.Connection, i ListUsersForOperationInput) ([]*dtos.UserOperationRole, error)
func MoveEvidence ¶
func MoveEvidence(ctx context.Context, db *database.Connection, i MoveEvidenceInput) error
func ReadFinding ¶
func ReadFinding(ctx context.Context, db *database.Connection, i ReadFindingInput) (*dtos.Finding, error)
func ReadOperation ¶
func ReadUser ¶
func ReadUser(ctx context.Context, db *database.Connection, userSlug string) (*dtos.UserOwnView, error)
ReadUser retrieves a detailed view of a user. This is separate from the data retriving by listing users, or reading another user's profile (when not an admin)
func SanitizeOperationSlug ¶
SanitizeOperationSlug removes objectionable characters from a slug and returns the new slug. Current logic: only allow alphanumeric characters and hyphen, with hypen excluded at the start and end
func SetUserFlags ¶
func SetUserFlags(ctx context.Context, db *database.Connection, i SetUserFlagsInput) error
SetUserFlags updates flags for the indicated user, namely: admin and disabled. Then removes all sessions for that user (logging them out)
NOTE: The flag is to _disable_ the user, which prevents access. To enable a user, set Disabled=false
func SetUserOperationRole ¶
func SetUserOperationRole(ctx context.Context, db *database.Connection, i SetUserOperationRoleInput) error
func UpdateEvidence ¶
func UpdateEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, i UpdateEvidenceInput) error
func UpdateFinding ¶
func UpdateFinding(ctx context.Context, db *database.Connection, i UpdateFindingInput) error
func UpdateOperation ¶
func UpdateOperation(ctx context.Context, db *database.Connection, i UpdateOperationInput) error
func UpdateQuery ¶
func UpdateQuery(ctx context.Context, db *database.Connection, i UpdateQueryInput) error
UpdateQuery modifies a query for the given operation
func UpdateTag ¶
func UpdateTag(ctx context.Context, db *database.Connection, i UpdateTagInput) error
UpdateTag updates a tag's name and color
func UpdateUserProfile ¶
func UpdateUserProfile(ctx context.Context, db *database.Connection, i UpdateUserProfileInput) error
Types ¶
type CreateEvidenceInput ¶
type CreateFindingInput ¶
type CreateOperationInput ¶
type CreateQueryInput ¶
CreateQueryInput provides a structure that holds the values needed to generate a new saved query
type CreateTagInput ¶
type CreateUserInput ¶
type CreateUserOutput ¶
func CreateHeadlessUser ¶
func CreateHeadlessUser(ctx context.Context, db *database.Connection, i CreateUserInput) (CreateUserOutput, error)
CreateHeadlessUser is really just CreateUser. The difference here is that _headless_ users will not have authentication, and instead rely on user-impersonation and API keys for access.
func CreateUser ¶
func CreateUser(db *database.Connection, i CreateUserInput) (CreateUserOutput, error)
CreateUser generates an entry in the users table in the database. No more is done here, but it is expected that the caller will, at a minimum, also want to create an entry in the authentication tables, so that the user can actually log in.
Note: CreateUserInput.Slug is a _suggestion_, and it may be altered to ensure uniqueness.
Returns a structure containing both the true slug (i.e. what it was mangled to, if it was infact mangled), plus the associated user_id value
type DeleteAPIKeyInput ¶
type DeleteAuthSchemeInput ¶
type DeleteEvidenceInput ¶
type DeleteFindingInput ¶
type DeleteQueryInput ¶
type DeleteTagInput ¶
type ListEvidenceForOperationInput ¶
type ListEvidenceForOperationInput struct { OperationSlug string Filters helpers.TimelineFilters }
type ListFindingsForOperationInput ¶
type ListFindingsForOperationInput struct { OperationSlug string Filters helpers.TimelineFilters }
type ListTagDifferenceForEvidenceInput ¶
type ListTagDifferenceForEvidenceInput struct { ListTagsDifferenceInput SourceEvidenceUUID string }
type ListTagsDifferenceInput ¶
type ListTagsForOperationInput ¶
type ListTagsForOperationInput struct {
OperationSlug string
}
type ListUsersForAdminInput ¶
type ListUsersForAdminInput struct { UserFilter Pagination IncludeDeleted bool }
type ListUsersForOperationInput ¶
type ListUsersForOperationInput struct { Pagination UserFilter OperationSlug string }
type ListUsersInput ¶
type MoveEvidenceInput ¶
type Pagination ¶
type Pagination struct { PageSize int64 Page int64 TotalCount int64 // contains filtered or unexported fields }
func ParseRequestQueryPagination ¶
func ParseRequestQueryPagination(dr dissectors.DissectedRequest, defaultMaxItems int64) Pagination
ParseRequestQueryPagination retreives the part of the request set aside for pagination Note that this retrieves the values and hopes for the best. Since this uses a DissectedRequest, it is the caller of the function to ensure no error occurred _after_ this has been called.
func (*Pagination) Select ¶
func (p *Pagination) Select(ctx context.Context, db *database.Connection, resultSlice interface{}, sb sq.SelectBuilder) error
Select is a wrapper around database.Connection.Select. This performs a query that returns multiple rows. In addition, this counts the total number of rows matching this query, and saves the result inside the pagination structure.
This actually performs two queries: the intended query, plus a second query to discover the total number of matching rows. I think this works differently in other databases, but this seems to be the preferred route for mysql. See: https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_found-rows for more details
Note: It is possible to have the initial query succeed and the count query to fail. In order to prevent odd issues, you should always do an error check before using the resulting value.
Note 2: This is really only useful for communicating size back to the enduser. For other pagination techniques, you may want to use LIMIT and OFFSET directly
func (*Pagination) SetMaxItems ¶
func (p *Pagination) SetMaxItems(maxItems int64) *Pagination
SetMaxItems sets the maximum number of items that can be returned in a request/page. This must be called before Select to have any effect
func (*Pagination) WrapData ¶
func (p *Pagination) WrapData(data interface{}) *dtos.PaginationWrapper
WrapData is a small helper to turn the desired content of a request into a pagination result set
type ReadEvidenceInput ¶
type ReadEvidenceOutput ¶
type ReadEvidenceOutput struct { UUID string `json:"uuid"` Description string `json:"description"` ContentType string `json:"contentType"` OccurredAt time.Time `json:"occurredAt"` Preview io.Reader `json:"-"` Media io.Reader `json:"-"` }
func ReadEvidence ¶
func ReadEvidence(ctx context.Context, db *database.Connection, contentStore contentstore.Store, i ReadEvidenceInput) (*ReadEvidenceOutput, error)
type ReadFindingInput ¶
type SetUserFlagsInput ¶
type SetUserOperationRoleInput ¶
type SetUserOperationRoleInput struct { OperationSlug string UserSlug string Role policy.OperationRole }
type UpdateEvidenceInput ¶
type UpdateFindingInput ¶
type UpdateOperationInput ¶
type UpdateOperationInput struct { OperationSlug string Name string Status models.OperationStatus }
type UpdateQueryInput ¶
type UpdateTagInput ¶
type UpdateUserProfileInput ¶
type UserFilter ¶
UserFilter provides a mechanism to alter queries such that users are filtered
func ParseRequestQueryUserFilter ¶
func ParseRequestQueryUserFilter(dr dissectors.DissectedRequest) UserFilter
ParseRequestQueryUserFilter generates a UserFilter object from a given request. This expects that filtering is specified by the query parameter "name"
func (*UserFilter) AddWhere ¶
func (uf *UserFilter) AddWhere(sb *sq.SelectBuilder)
AddWhere adds to the given SelectBuilder a Where clause that will apply the filtering
Source Files ¶
- add_evidence_to_finding.go
- create_api_key.go
- create_evidence.go
- create_finding.go
- create_operation.go
- create_query.go
- create_tag.go
- create_user.go
- delete_api_key.go
- delete_auth_scheme.go
- delete_auth_scheme_users.go
- delete_evidence.go
- delete_finding.go
- delete_operation.go
- delete_query.go
- delete_tag.go
- delete_user.go
- list_api_keys.go
- list_auths_details.go
- list_evidence_for_finding.go
- list_evidence_for_operation.go
- list_findings_for_operation.go
- list_operations.go
- list_operations_for_admin.go
- list_queries_for_operation.go
- list_tag_differences.go
- list_tags_for_operation.go
- list_users.go
- list_users_for_admin.go
- list_users_for_operation.go
- move_evidence.go
- read_evidence.go
- read_finding.go
- read_operation.go
- read_user.go
- service_helper_user_filter.go
- service_helpers.go
- service_pagination_helper.go
- service_testing_helpers.go
- set_user_operation_role.go
- update_evidence.go
- update_finding.go
- update_operation.go
- update_query.go
- update_tag.go
- update_user_profile.go
- update_user_set_flags_for_admin.go