@cytario/web 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.server/auth/getSessionCredentials.ts +3 -1
- package/app/.server/auth/sessionPolicy.ts +20 -1
- package/app/components/.client/ImageViewer/components/Measurements/CursorTick.tsx +1 -1
- package/app/components/.client/ImageViewer/components/Measurements/Ruler.tsx +15 -8
- package/app/components/.client/ImageViewer/components/Measurements/SlideCarrier.tsx +2 -2
- package/app/components/.client/ImageViewer/components/Measurements/Tick.tsx +2 -8
- package/package.json +1 -1
|
@@ -52,7 +52,9 @@ const fetchTemporaryCredentials = async (
|
|
|
52
52
|
// Non-AWS providers (e.g. MinIO) may ignore or reject the `Policy` field,
|
|
53
53
|
// so we omit it there — the role's intrinsic scope is the only bound.
|
|
54
54
|
const sessionPolicy =
|
|
55
|
-
provider === "aws"
|
|
55
|
+
provider === "aws"
|
|
56
|
+
? buildSessionPolicy({ bucketName, prefix, region: actualRegion })
|
|
57
|
+
: undefined;
|
|
56
58
|
|
|
57
59
|
const command = new AssumeRoleWithWebIdentityCommand({
|
|
58
60
|
RoleArn: roleArn ?? undefined,
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
export interface SessionPolicyArgs {
|
|
13
13
|
bucketName: string;
|
|
14
14
|
prefix: string | null | undefined;
|
|
15
|
+
region: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const stripSlashes = (prefix: string): string => prefix.replace(/^\/+|\/+$/g, "");
|
|
18
19
|
|
|
19
20
|
/** Build an inline IAM session policy for `AssumeRoleWithWebIdentityCommand`. */
|
|
20
|
-
export const buildSessionPolicy = ({ bucketName, prefix }: SessionPolicyArgs): string => {
|
|
21
|
+
export const buildSessionPolicy = ({ bucketName, prefix, region }: SessionPolicyArgs): string => {
|
|
21
22
|
const normalised = typeof prefix === "string" ? stripSlashes(prefix) : "";
|
|
22
23
|
// Defense-in-depth: refuse wildcards here so the schema is not the only gate
|
|
23
24
|
// protecting cross-tenant `StringLike` conditions.
|
|
@@ -52,6 +53,23 @@ export const buildSessionPolicy = ({ bucketName, prefix }: SessionPolicyArgs): s
|
|
|
52
53
|
Resource: bucketArn,
|
|
53
54
|
};
|
|
54
55
|
|
|
56
|
+
// STS intersects this policy with the role's attached policy. Without an
|
|
57
|
+
// explicit `kms:Decrypt` here, the role's KMS grant is stripped and
|
|
58
|
+
// `GetObject` against SSE-KMS-encrypted buckets fails. `kms:ViaService`
|
|
59
|
+
// restricts use of the minted credential to the S3 data path; the role's
|
|
60
|
+
// attached policy remains the authoritative key allowlist.
|
|
61
|
+
const decryptStatement = {
|
|
62
|
+
Sid: "DecryptViaS3",
|
|
63
|
+
Effect: "Allow",
|
|
64
|
+
Action: "kms:Decrypt",
|
|
65
|
+
Resource: "*",
|
|
66
|
+
Condition: {
|
|
67
|
+
StringEquals: {
|
|
68
|
+
"kms:ViaService": `s3.${region}.amazonaws.com`,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
55
73
|
const policy = {
|
|
56
74
|
Version: "2012-10-17",
|
|
57
75
|
Statement: [
|
|
@@ -62,6 +80,7 @@ export const buildSessionPolicy = ({ bucketName, prefix }: SessionPolicyArgs): s
|
|
|
62
80
|
Action: "s3:GetObject",
|
|
63
81
|
Resource: objectArn,
|
|
64
82
|
},
|
|
83
|
+
decryptStatement,
|
|
65
84
|
],
|
|
66
85
|
};
|
|
67
86
|
|
|
@@ -29,5 +29,5 @@ export const CursorTick = ({ vertical }: { vertical?: boolean }) => {
|
|
|
29
29
|
const metricY = absoluteToMetric(absoluteY);
|
|
30
30
|
const cursorOffset = vertical ? metricY : metricX;
|
|
31
31
|
|
|
32
|
-
return <Tick number={cursorOffset} offset={vertical ? y : x}
|
|
32
|
+
return <Tick number={cursorOffset} offset={vertical ? y : x} />;
|
|
33
33
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { twMerge } from "tailwind-merge";
|
|
2
|
+
|
|
1
3
|
import { CursorTick } from "./CursorTick";
|
|
2
4
|
import { Tick } from "./Tick";
|
|
3
5
|
|
|
@@ -22,16 +24,21 @@ export const Ruler = ({
|
|
|
22
24
|
arr.push(i);
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className={`
|
|
27
|
+
const cx = twMerge(
|
|
28
|
+
`
|
|
28
29
|
absolute top-0 left-0
|
|
29
|
-
w-4 h-4
|
|
30
|
+
flex w-4 h-4
|
|
30
31
|
origin-top-left
|
|
31
32
|
text-xs
|
|
32
|
-
font-semibold
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
font-semibold
|
|
34
|
+
`,
|
|
35
|
+
vertical ? "rotate-90 translate-x-4" : "",
|
|
36
|
+
vertical ? "items-end" : "items-start",
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={cx}
|
|
35
42
|
style={{
|
|
36
43
|
width: size,
|
|
37
44
|
}}
|
|
@@ -47,7 +54,7 @@ export const Ruler = ({
|
|
|
47
54
|
const isMajor = i % interval === 0;
|
|
48
55
|
const label = isMajor ? i : undefined;
|
|
49
56
|
|
|
50
|
-
return <Tick key={i} number={label} offset={offset + i * one_mm}
|
|
57
|
+
return <Tick key={i} number={label} offset={offset + i * one_mm} />;
|
|
51
58
|
})}
|
|
52
59
|
|
|
53
60
|
<CursorTick vertical={vertical} />
|
|
@@ -15,7 +15,7 @@ export function SlideCarrier() {
|
|
|
15
15
|
return (
|
|
16
16
|
<div
|
|
17
17
|
style={{ width: viewPortWidth, height: viewPortHeight }}
|
|
18
|
-
className="absolute top-0 left-
|
|
18
|
+
className="absolute top-0 left-0 overflow-hidden"
|
|
19
19
|
>
|
|
20
20
|
<Size value={widthTotalMm} />
|
|
21
21
|
<Size vertical value={heightTotalMm} />
|
|
@@ -49,7 +49,7 @@ const Size = ({ value, vertical = false }: { value: number; vertical?: boolean }
|
|
|
49
49
|
h-4
|
|
50
50
|
origin-top-left
|
|
51
51
|
text-xs font-semibold
|
|
52
|
-
|
|
52
|
+
text-(--color-text-secondary)
|
|
53
53
|
`}
|
|
54
54
|
style={{
|
|
55
55
|
width: vertical ? imageHeightScreen : imageWidthScreen,
|
|
@@ -3,25 +3,19 @@ import { twMerge } from "tailwind-merge";
|
|
|
3
3
|
interface TickProps {
|
|
4
4
|
number?: number;
|
|
5
5
|
offset: number;
|
|
6
|
-
label?: string | number;
|
|
7
|
-
vertical?: boolean;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
export const Tick = ({ number, offset
|
|
8
|
+
export const Tick = ({ number, offset }: TickProps) => {
|
|
11
9
|
const isMajor = typeof number === "number";
|
|
12
|
-
|
|
13
10
|
const n = Math.round((number as number) * 100) / 100;
|
|
11
|
+
const adjustedOffset = offset - 2; // Account for border width
|
|
14
12
|
|
|
15
13
|
const cx = twMerge(
|
|
16
14
|
"absolute left-0 bg-[var(--color-surface-default)]",
|
|
17
15
|
"border-l border-l-[var(--color-text-secondary)]",
|
|
18
16
|
isMajor ? "h-4" : "h-2",
|
|
19
|
-
vertical ? "rotate-90" : "",
|
|
20
|
-
vertical ? "bottom-0" : "top-0",
|
|
21
17
|
);
|
|
22
18
|
|
|
23
|
-
const adjustedOffset = Math.floor(offset) - (vertical ? 2 : 3);
|
|
24
|
-
|
|
25
19
|
return (
|
|
26
20
|
<div
|
|
27
21
|
className={cx}
|
package/package.json
CHANGED