Skip to content
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

Update validation for observability notebooks integration #174

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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