Skip to content

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

improve error message

adilson860ed1d8d406
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.test.ts b/backend/src/services/secret-sync/github/github-sync-fns.test.ts
index 8cb2fee563..deb90a34a3 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.test.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.test.ts
@@ -288,8 +288,9 @@ describe("GitHub permission errors", () => {
expect(error).toBeInstanceOf(SecretSyncError);
expect(error).toMatchObject({ shouldRetry: false });
expect((error as SecretSyncError).message).toContain(
- "lacks the 'Dependabot secrets' repository permission for repository 'acme/app'"
+ "lacks permissions to access Dependabot secrets for repository 'acme/app'"
);
+ expect((error as SecretSyncError).message).toContain("read and write access to Dependabot secrets");
expect((error as SecretSyncError).message).toContain("'repo' scope");
});
@@ -301,12 +302,12 @@ describe("GitHub permission errors", () => {
).rejects.toMatchObject({
shouldRetry: false,
message: expect.stringMatching(
- /lacks the 'Organization codespaces secrets' organization permission for organization 'acme'.*'admin:org' scope/
+ /lacks permissions to access Codespaces secrets for organization 'acme'.*'admin:org' scope/
)
});
});
- it("names both permissions an Actions environment sync needs", async () => {
+ it("names the Actions secret type for an environment sync", async () => {
paginatedMock.mockRejectedValueOnce(httpError(403));
const environmentConfig = {
scope: GitHubSyncScope.RepositoryEnvironment,
@@ -319,7 +320,7 @@ describe("GitHub permission errors", () => {
await expect(runSync(makeSync(environmentConfig), makePayload(["A"]))).rejects.toMatchObject({
shouldRetry: false,
message: expect.stringContaining(
- "lacks the 'Secrets' and 'Environments' repository permissions for environment 'prod' in repository 'acme/app'"
+ "lacks permissions to access Actions secrets for environment 'prod' in repository 'acme/app'"
)
});
});
@@ -348,7 +349,7 @@ describe("GitHub permission errors", () => {
).rejects.toMatchObject({
shouldRetry: false,
secretKey: undefined,
- message: expect.stringContaining("'Codespaces secrets' repository permission")
+ message: expect.stringContaining("read and write access to Codespaces secrets")
});
});
diff --git a/backend/src/services/secret-sync/github/github-sync-fns.ts b/backend/src/services/secret-sync/github/github-sync-fns.ts
index 32f3deaeaa..fe0e46d961 100644
--- a/backend/src/services/secret-sync/github/github-sync-fns.ts
+++ b/backend/src/services/secret-sync/github/github-sync-fns.ts
@@ -143,7 +143,7 @@ export const toGitHubSecretsError = (error: unknown, destinationConfig: TGitHubS
const message =
status === 403
- ? `The GitHub connection lacks permissions to access ${target}. Grant read and write access on the GitHub App or fine-grained token, or use the '${classicScope}' scope for OAuth and classic tokens. An owner of a GitHub App installation must also approve newly requested permissions.`
+ ? `The GitHub connection lacks permissions to access ${name} secrets for ${target}. Grant read and write access to ${name} secrets on the GitHub App or fine-grained token, or use the '${classicScope}' scope for OAuth and classic tokens. An owner of a GitHub App installation must also approve newly requested permissions.`
: `GitHub could not find the ${name} secrets for ${target}. Check that ${missing} and that the GitHub connection has the permissions to access it.`;
return new SecretSyncError({ error, message, shouldRetry: false });