mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Defend CRDResourceDetails against bad jsonPaths
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
a787f67650
commit
4cf4ab4b1b
@ -15,11 +15,10 @@ import { KubeObjectMeta } from "../kube-object-meta";
|
||||
import { Input } from "../input";
|
||||
import type { AdditionalPrinterColumnsV1 } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||
import { CustomResourceDefinition } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||
import { convertKubectlJsonPathToNodeJsonPath } from "../../utils/jsonPath";
|
||||
import { safeJSONPathValue } from "../../utils/jsonPath";
|
||||
import type { KubeObjectMetadata, KubeObjectStatus } from "../../../common/k8s-api/kube-object";
|
||||
import { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||
import logger from "../../../common/logger";
|
||||
import { JSONPath } from "@astronautlabs/jsonpath";
|
||||
|
||||
export interface CustomResourceDetailsProps extends KubeObjectDetailsProps<KubeObject> {
|
||||
crd: CustomResourceDefinition;
|
||||
@ -66,7 +65,7 @@ export class CustomResourceDetails extends React.Component<CustomResourceDetails
|
||||
renderAdditionalColumns(resource: KubeObject, columns: AdditionalPrinterColumnsV1[]) {
|
||||
return columns.map(({ name, jsonPath }) => (
|
||||
<DrawerItem key={name} name={name}>
|
||||
{convertSpecValue(JSONPath.query(resource, convertKubectlJsonPathToNodeJsonPath(jsonPath)))}
|
||||
{convertSpecValue(safeJSONPathValue(resource, jsonPath))}
|
||||
</DrawerItem>
|
||||
));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user