Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Minor UI improvements on code signing

Carlos Monastyrski082e3c6cf58e
diff --git a/backend/src/services/signer/signer-service.ts b/backend/src/services/signer/signer-service.ts
index 0ac3858c2f..9ce3794921 100644
--- a/backend/src/services/signer/signer-service.ts
+++ b/backend/src/services/signer/signer-service.ts
@@ -446,7 +446,7 @@ export const signerServiceFactory = ({
if (!matchingGrant) {
throw new ForbiddenRequestError({
- message: "Signing requires approval. Request access and get approved before signing.",
+ message: "Signing requires approval. Get approval before signing.",
name: "ApprovalRequired"
});
}
diff --git a/docs/documentation/platform/pki/code-signing/pkcs11-module.mdx b/docs/documentation/platform/pki/code-signing/pkcs11-module.mdx
index 0ba1e766a0..3e698c4984 100644
--- a/docs/documentation/platform/pki/code-signing/pkcs11-module.mdx
+++ b/docs/documentation/platform/pki/code-signing/pkcs11-module.mdx
@@ -85,6 +85,8 @@ export INFISICAL_PKCS11_CONFIG=/path/to/your/pkcs11.conf
| `cache.token_ttl_seconds` | No | `300` | Auth token cache duration |
| `cache.cert_ttl_seconds` | No | `3600` | Certificate data cache duration |
| `cache.signer_ttl_seconds` | No | `300` | Signer list cache duration |
+| `approval.signing_duration` | No | None | Auto-request signing access with this time window (e.g. `"8h"`, `"30m"`, `"2d"`). Range: 1m to 30d |
+| `approval.signing_count` | No | None | Auto-request signing access for this many signing operations |
| `log_level` | No | `info` | Log level: `trace`, `debug`, `info`, `warn`, `error` |
| `log_file` | No | stderr | Path to log file |
@@ -126,6 +128,38 @@ To list the objects (private key, certificate, public key) in a slot:
pkcs11-tool --module /usr/local/lib/libinfisical-pkcs11.so --slot 0 --list-objects
```
+## Automatic Signing Access Requests
+
+If a signer has a [signing policy](/documentation/platform/pki/code-signing/signing-policies) attached, the module can automatically create a signing request when a sign operation is denied due to a missing grant. This removes the need to manually create requests via the UI or API before signing.
+
+To enable this, add the `approval` section to your config file with at least one of the following:
+
+```json
+{
+ "approval": {
+ "signing_duration": "8h",
+ "signing_count": 10
+ }
+}
+```
+
+- **`signing_duration`**: Requests a time-window grant of the specified duration (e.g. `"30m"`, `"8h"`, `"2d"`). Valid range: 1 minute to 30 days.
+- **`signing_count`**: Requests a grant for a fixed number of signing operations.
+
+You can set one or both depending on the constraints defined in the signing policy.
+
+<Note>
+ The sign operation will fail until an approver approves the request first. Once approved, retrying the sign operation will succeed. The module logs a message indicating that an approval request was created automatically.
+</Note>
+
+### Example Workflow
+
+1. A CI/CD pipeline attempts to sign an artifact
+2. The module detects that no active grant exists for the signer
+3. It automatically creates a signing request with the configured duration/count
+4. An approver reviews and approves the request
+5. The pipeline retries and the sign operation succeeds
+
## Troubleshooting
For any issue, start by enabling debug logging in your config file to get detailed output:
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/RequestSigningAccessModal.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/RequestSigningAccessModal.tsx
index 7a04def107..5deb28b424 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/RequestSigningAccessModal.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/CodeSigningRequestsTab/RequestSigningAccessModal.tsx
@@ -48,10 +48,10 @@ const formSchema = z
justification: z.string().max(512).optional(),
windowStart: z.string().optional(),
windowEnd: z.string().optional(),
- requestedSignings: z
- .union([z.coerce.number().int().positive(), z.nan(), z.undefined()])
- .optional()
- .transform((val) => (typeof val === "number" && !Number.isNaN(val) ? val : undefined))
+ requestedSignings: z.preprocess(
+ (val) => (val === "" || val === undefined || val === null ? undefined : Number(val)),
+ z.number().int().positive().optional()
+ )
})
.superRefine((data, ctx) => {
if (data.windowStart) {
@@ -117,7 +117,7 @@ const Content = ({ onOpenChange }: Props) => {
justification: "",
windowStart: getDefaultWindowStart(),
windowEnd: getDefaultWindowEnd(),
- requestedSignings: 5
+ requestedSignings: 1
}
});
@@ -164,7 +164,7 @@ const Content = ({ onOpenChange }: Props) => {
}
if (hasCountConstraint) {
- setValue("requestedSignings", 5);
+ setValue("requestedSignings", 1);
} else {
setValue("requestedSignings", undefined);
}
@@ -276,11 +276,10 @@ const Content = ({ onOpenChange }: Props) => {
helperText="How many signing operations you need"
>
<Input
- type="number"
- min={1}
placeholder="5"
{...field}
- onChange={(e) => field.onChange(e.target.valueAsNumber || undefined)}
+ value={field.value ?? ""}
+ onChange={(e) => field.onChange(e.target.value)}
/>
</FormControl>
)}
diff --git a/frontend/src/pages/cert-manager/CodeSigningPage/CodeSigningPage.tsx b/frontend/src/pages/cert-manager/CodeSigningPage/CodeSigningPage.tsx
index 510e6d9c1d..38fc38fb9d 100644
--- a/frontend/src/pages/cert-manager/CodeSigningPage/CodeSigningPage.tsx
+++ b/frontend/src/pages/cert-manager/CodeSigningPage/CodeSigningPage.tsx
@@ -27,12 +27,14 @@ enum ApprovalSubTabs {
export const CodeSigningPage = () => {
const { t } = useTranslation();
const { currentProject } = useProject();
- const { tab } = useSearch({ strict: false }) as { tab?: string };
+ const { tab, subtab } = useSearch({ strict: false }) as { tab?: string; subtab?: string };
const [isCreateOpen, setIsCreateOpen] = useState(false);
const [activeTab, setActiveTab] = useState(
tab === "approvals" ? CodeSigningTabs.Approvals : CodeSigningTabs.Signers
);
- const [approvalSubTab, setApprovalSubTab] = useState(ApprovalSubTabs.Requests);
+ const [approvalSubTab, setApprovalSubTab] = useState(
+ (subtab as ApprovalSubTabs) || ApprovalSubTabs.Requests
+ );
return (
<div className="mx-auto flex h-full flex-col justify-between bg-bunker-800 text-white">
diff --git a/frontend/src/pages/cert-manager/CodeSigningPage/route.tsx b/frontend/src/pages/cert-manager/CodeSigningPage/route.tsx
index 75325e7d72..bc2c6a3d14 100644
--- a/frontend/src/pages/cert-manager/CodeSigningPage/route.tsx
+++ b/frontend/src/pages/cert-manager/CodeSigningPage/route.tsx
@@ -5,7 +5,8 @@ import { z } from "zod";
import { CodeSigningPage } from "./CodeSigningPage";
const CodeSigningSearchSchema = z.object({
- tab: z.enum(["signers", "approvals"]).optional()
+ tab: z.enum(["signers", "approvals"]).optional(),
+ subtab: z.enum(["requests", "policies", "grants"]).optional()
});
export const Route = createFileRoute(
diff --git a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
index adae4e8332..0f323417a8 100644
--- a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
+++ b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerOverviewSection.tsx
@@ -125,11 +125,12 @@ export const SignerOverviewSection = ({ signer, projectId, onEdit }: Props) => {
<DetailValue>
{signer.approvalPolicyId && signer.approvalPolicyName ? (
<Link
- to="/organizations/$orgId/projects/cert-manager/$projectId/approvals"
+ to="/organizations/$orgId/projects/cert-manager/$projectId/code-signing"
params={{
orgId: currentOrg.id,
projectId
}}
+ search={{ tab: "approvals", subtab: "policies" }}
className="flex items-center gap-1 text-primary hover:underline"
>
{signer.approvalPolicyName}