Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(integrations): aws secrets manager secrets prefixing support #2433

Merged
merged 3 commits into from
Sep 16, 2024
Merged
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
35 changes: 5 additions & 30 deletions backend/src/services/integration-auth/integration-app-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,37 +242,12 @@ const getAppsGithub = async ({ accessToken }: { accessToken: string }) => {
};
}

const octokit = new Octokit({
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const repos = (await new Octokit({
auth: accessToken
});

const getAllRepos = async () => {
let repos: GitHubApp[] = [];
let page = 1;
const perPage = 100;
let hasMore = true;

while (hasMore) {
const response = await octokit.request(
"GET /user/repos{?visibility,affiliation,type,sort,direction,per_page,page,since,before}",
{
per_page: perPage,
page
}
);

if ((response.data as GitHubApp[]).length > 0) {
repos = repos.concat(response.data as GitHubApp[]);
page += 1;
} else {
hasMore = false;
}
}

return repos;
};

const repos = await getAllRepos();
}).paginate("GET /user/repos{?visibility,affiliation,type,sort,direction,per_page,page,since,before}", {
per_page: 100
})) as GitHubApp[];

const apps = repos
.filter((a: GitHubApp) => a.permissions.admin === true)
Expand Down
18 changes: 16 additions & 2 deletions frontend/src/pages/integrations/aws-secret-manager/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
const [tagKey, setTagKey] = useState("");
const [tagValue, setTagValue] = useState("");
const [kmsKeyId, setKmsKeyId] = useState("");
const [secretPrefix, setSecretPrefix] = useState("");

// const [path, setPath] = useState('');
// const [pathErrorText, setPathErrorText] = useState('');
Expand Down Expand Up @@ -165,6 +166,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
]
}
: {}),
...(secretPrefix && { secretPrefix }),
...(kmsKeyId && { kmsKeyId }),
mappingBehavior: selectedMappingBehavior
}
Expand Down Expand Up @@ -325,7 +327,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
</Switch>
</div>
{shouldTag && (
<div className="mt-4">
<div className="mt-4 flex justify-between">
<FormControl label="Tag Key">
<Input
placeholder="managed-by"
Expand All @@ -342,10 +344,20 @@ export default function AWSSecretManagerCreateIntegrationPage() {
</FormControl>
</div>
)}

<FormControl label="Secret Prefix" className="mt-4">
<Input
value={secretPrefix}
onChange={(e) => setSecretPrefix(e.target.value)}
placeholder="INFISICAL_"
/>
</FormControl>

<FormControl label="Encryption Key" className="mt-4">
<Select
value={kmsKeyId}
onValueChange={(e) => {
if (e === "no-keys") return;
setKmsKeyId(e);
}}
className="w-full border border-mineshaft-500"
Expand All @@ -363,7 +375,9 @@ export default function AWSSecretManagerCreateIntegrationPage() {
);
})
) : (
<div />
<SelectItem isDisabled value="no-keys" key="no-keys">
No KMS keys available
</SelectItem>
)}
</Select>
</FormControl>
Expand Down
Loading