-
Notifications
You must be signed in to change notification settings - Fork 272
asset group tags to not contain whitespaces #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,6 +200,8 @@ func (s Resources) CreateAssetGroup(response http.ResponseWriter, request *http. | |
|
|
||
| if err := api.ReadJSONRequestPayloadLimited(&createRequest, request); err != nil { | ||
| api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusBadRequest, err.Error(), request), response) | ||
| } else if strings.Contains(createRequest.Tag, " ") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quick question: should we disallow all forms of whitespace? It seems like it may be a good idea just to be safe. We'd probably use a regex to test for any whitespace character, rather than enumerate whitespace checks manually.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, I'll add this in a follow up MR. |
||
| api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusBadRequest, api.ErrorResponseAGTagWhiteSpace, request), response) | ||
| } else if newAssetGroup, err := s.DB.CreateAssetGroup(request.Context(), createRequest.Name, createRequest.Tag, false); err != nil { | ||
| api.HandleDatabaseError(request, response, err) | ||
| } else { | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to make this v5.8.0 due to the next version definitely being a feature update |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| -- Copyright 2024 Specter Ops, Inc. | ||
| -- | ||
| -- Licensed under the Apache License, Version 2.0 | ||
| -- you may not use this file except in compliance with the License. | ||
| -- You may obtain a copy of the License at | ||
| -- | ||
| -- http://www.apache.org/licenses/LICENSE-2.0 | ||
| -- | ||
| -- Unless required by applicable law or agreed to in writing, software | ||
| -- distributed under the License is distributed on an "AS IS" BASIS, | ||
| -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| -- See the License for the specific language governing permissions and | ||
| -- limitations under the License. | ||
| -- | ||
| -- SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| UPDATE asset_groups | ||
| SET tag = REPLACE(tag, ' ', ''); |
Uh oh!
There was an error while loading. Please reload this page.