8000 Fix medium-severity npm transitive dependency vulnerabilities via pnpm overrides by abstractj · Pull Request #47658 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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 js/apps/admin-ui/src/authentication/FlowDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default function FlowDetails() {

const addFlow = async (
flow: string,
{ name, description = "", type, provider }: Flow,
{ name, description, type, provider }: Flow,
) => {
try {
await adminClient.authenticationManagement.addFlowToFlow({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ import { defaultContextAttributes } from "../utils";
import { KeyBasedAttributeInput } from "./KeyBasedAttributeInput";
import { Results } from "./evaluate/Results";

interface EvaluateFormInputs
extends Omit<ResourceEvaluation, "context" | "resources"> {
interface EvaluateFormInputs extends Omit<
ResourceEvaluation,
"context" | "resources"
> {
alias: string;
authScopes: string[];
context: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ClientScope = () => {

useFetch(
() => adminClient.clientScopes.find(),
(scopes = []) => {
(scopes) => {
const clientScopes = getValues("clientScopes") || [];
setSelectedScopes(
clientScopes.map((s) => scopes.find((c) => c.id === s.id)!),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function PolicyDetails() {
id: permissionClientId ?? id,
type: policyType!,
policyId,
}) as PolicyRepresentation | undefined,
}) as Promise<PolicyRepresentation | undefined>,
adminClient.clients.getAssociatedPolicies({
id: permissionClientId ?? id,
permissionId: policyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export type PermissionConfigurationDetailParams = {

const PermissionConfigurationDetails = lazy(
() =>
import(
"../../permissions-configuration/permission-configuration/PermissionConfigurationDetails"
),
import("../../permissions-configuration/permission-configuration/PermissionConfigurationDetails"),
);

export const PermissionConfigurationDetailRoute: AppRouteObject = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const ConfirmDialogModal = ({
onConfirm,
onCancel,
children,
open = true,
open,
variant = ModalVariant.small,
toggleDialog,
confirmButtonDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type RealmLoAMappingType = { acr: string; uri?: string; loa: string };
export const RealmLoAMapping = ({
name,
label = "attributes",
uri = false,
uri,
}: RealmLoAMappingProps) => {
const { t } = useTranslation();
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import useSortedResourceTypes from "../../utils/useSortedResourceTypes";
import { PermissionEvaluationResult } from "./PermissionEvaluationResult";
import { COMPONENTS } from "../resource-types/ResourceType";

interface EvaluateFormInputs
extends Omit<ResourceEvaluation, "context" | "resources"> {
interface EvaluateFormInputs extends Omit<
ResourceEvaluation,
"context" | "resources"
> {
authScopes: string[];
user: string[];
clients: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export type PermissionConfigurationDetailsParams = {

const PermissionConfigurationDetails = lazy(
() =>
import(
"../../permissions-configuration/permission-configuration/PermissionConfigurationDetails"
),
import("../../permissions-configuration/permission-configuration/PermissionConfigurationDetails"),
);

export const PermissionConfigurationDetailRoute: AppRouteObject = {
Expand Down
4 changes: 2 additions & 2 deletions js/apps/admin-ui/src/user/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ export default function EditUser() {
adminClient.users.findOne({
id: id!,
userProfileMetadata: true,
}) as UIUserRepresentation | undefined,
}) as Promise<UIUserRepresentation | undefined>,
adminClient.attackDetection.findOne({ id: id! }),
adminClient.users.getUnmanagedAttributes({ id: id! }),
adminClient.users.getProfile({ realm: realmName }),
showOrganizations
? adminClient.organizations.find({ first: 0, max: 1 })
: [],
: Promise.resolve([]),
]),
([
userData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import UserRepresentation from "./userRepresentation.js";

export default interface OrganizationMemberRepresentation
extends UserRepresentation {
export default interface OrganizationMemberRepresentation extends UserRepresentation {
membershipType: string;
}
12 changes: 6 additions & 6 deletions js/libs/ui-shared/src/context/KeycloakContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ export type KeycloakContext<T extends BaseEnvironment = BaseEnvironment> =
keycloak: Keycloak;
};

const createKeycloakEnvContext = <T extends BaseEnvironment>() =>
createContext<KeycloakContext<T> | undefined>(undefined);

let KeycloakEnvContext: any;
const KeycloakEnvContext = createContext<KeycloakContext<any> | undefined>(
undefined,
);

export const useEnvironment = <
T extends BaseEnvironment = BaseEnvironment,
>() => {
const context = useContext<KeycloakContext<T>>(KeycloakEnvContext);
const context = useContext(KeycloakEnvContext) as
| KeycloakContext<T>
| undefined;
if (!context)
throw Error(
"no environment provider in the hierarchy make sure to add the provider",
Expand All @@ -45,7 +46,6 @@ export const KeycloakProvider = <T extends BaseEnvironment>({
keycloak: externalKeycloak,
children,
}: PropsWithChildren<KeycloakContextProps<T>>) => {
KeycloakEnvContext = createKeycloakEnvContext<T>();
const calledOnce = useRef(false);
const [init, setInit] = useState(!!externalKeycloak);
const [error, setError] = useState<unknown>();
Expand Down
2 changes: 1 addition & 1 deletion js/libs/ui-shared/src/select/KeycloakSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export enum SelectVariant {
export const propertyToString = (prop: string | number | undefined) =>
typeof prop === "number" ? prop + "px" : prop;

export type KeycloakSelectProps<> = Omit<
export type KeycloakSelectProps = Omit<
SelectProps,
"name" | "toggle" | "selected" | "onClick" | "onSelect" | "variant"
> & {
Expand Down
22 changes: 11 additions & 11 deletions js/libs/ui-shared/src/utils/useSetTimeout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ describe("useSetTimeout", () => {

// Ensure that setTimeout was actually called with the correct arguments.
expect(setTimeoutSpy).toHaveBeenCalledTimes(2);
expect(setTimeoutSpy).toBeCalledWith(expect.any(Function), 1000);
expect(setTimeoutSpy).toBeCalledWith(expect.any(Function), 500);
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 1000);
expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 500);

// Ensure callbacks are called after timers run.
expect(callback2).not.toBeCalled();
expect(callback2).not.toHaveBeenCalled();
vi.advanceTimersByTime(500);
expect(callback1).not.toBeCalled();
expect(callback2).toBeCalled();
expect(callback1).not.toHaveBeenCalled();
expect(callback2).toHaveBeenCalled();
vi.advanceTimersByTime(500);
expect(callback1).toBeCalled();
expect(callback1).toHaveBeenCalled();

setTimeoutSpy.mockRestore();
});
Expand All @@ -39,7 +39,7 @@ describe("useSetTimeout", () => {

unmount();

expect(() => result.current(vi.fn(), 1000)).toThrowError(
expect(() => result.current(vi.fn(), 1000)).toThrow(
"Can't schedule a timeout on an unmounted component.",
);
});
Expand All @@ -54,11 +54,11 @@ describe("useSetTimeout", () => {

// Timeout should be cleared after unmounting.
unmount();
expect(clearTimeoutSpy).toBeCalled();
expect(clearTimeoutSpy).toHaveBeenCalled();

// And the callback should no longer be called.
vi.runOnlyPendin F3CC gTimers();
expect(callback).not.toBeCalled();
expect(callback).not.toHaveBeenCalled();

setTimeoutSpy.mockRestore();
clearTimeoutSpy.mockRestore();
Expand All @@ -73,11 +73,11 @@ describe("useSetTimeout", () => {

// Timeout should be cleared when cancelling.
cancel();
expect(clearTimeoutSpy).toBeCalled();
expect(clearTimeoutSpy).toHaveBeenCalled();

// And the callback should no longer be called.
vi.runOnlyPendingTimers();
expect(callback).not.toBeCalled();
expect(callback).not.toHaveBeenCalled();

setTimeoutSpy.mockRestore();
clearTimeoutSpy.mockRestore();
Expand Down
8 changes: 6 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@
"minimatch@~3": "^3.1.4",
"minimatch@~9": "^9.0.7",
"@isaacs/brace-expansion@^5": "^5.0.1",
"serialize-javascript": "^7.0.3",
"serialize-javascript": "^7.0.5",
"diff@^4": "^4.0.4",
"diff@^7": "^8.0.3"
"diff@^7": "^8.0.3",
"ajv@^8": "^8.18.0",
"lodash": "^4.18.1",
"mdast-util-to-hast": "^13.2.1",
"jquery@^3": "^3.5.0"
}
}
}
Loading
Loading
0