Skip to content

Commit

Permalink
Update validation for observability notebooks integration
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Oct 8, 2021
1 parent a238baf commit 957dbdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dashboards-reports/server/routes/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function (router: IRouter, accessInfo: AccessInfoType) {
// input validation
try {
report.report_definition.report_params.core_params.origin =
request.headers.origin;
request.headers.origin || request.headers.host;
report = await validateReport(
context.core.opensearch.legacy.client,
report,
Expand Down
4 changes: 2 additions & 2 deletions dashboards-reports/server/utils/validationHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { REPORT_TYPE } from '../../server/routes/utils/constants';

export const isValidRelativeUrl = (relativeUrl: string) => {
let normalizedRelativeUrl = relativeUrl
if (!relativeUrl.includes('notebooks-dashboards')) {
if (!relativeUrl.includes('observability#/notebooks')) {
normalizedRelativeUrl = path.posix.normalize(relativeUrl);
}

Expand All @@ -55,7 +55,7 @@ export const isValidRelativeUrl = (relativeUrl: string) => {
export const regexDuration = /^(-?)P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)([DW]))?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$/;
export const regexEmailAddress = /\S+@\S+\.\S+/;
export const regexReportName = /^[\w\-\s\(\)\[\]\,\_\-+]+$/;
export const regexRelativeUrl = /^\/(_plugin\/kibana\/|_dashboards\/)?app\/(dashboards|visualize|discover|notebooks-dashboards\?view=output_only)([?&]security_tenant=.+|)#\/(view\/|edit\/)?[^\/]+$/;
export const regexRelativeUrl = /^\/(_plugin\/kibana\/|_dashboards\/)?app\/(dashboards|visualize|discover|observability)([?&]security_tenant=.+|)#\/(notebooks\/|view\/|edit\/)?[^\/]+$/;

export const validateReport = async (
client: ILegacyScopedClusterClient,
Expand Down

0 comments on commit 957dbdc

Please sign in to comment.