Skip to content

Commit 22df743

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(oci): require a single downloaded PEM key block
1 parent 9df7986 commit 22df743

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

apps/sim/lib/credentials/oci-api-key-service-account.server.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ describe('OCI API-key credential setup', () => {
129129
'extra\nOCI_API_KEY',
130130
'OCI_API_KEY\nOCI_API_KEY',
131131
'\u0000OCI_API_KEY',
132+
privateKey,
133+
`extra\n-----END PRIVATE KEY-----`,
132134
]) {
133135
await expect(
134136
verifyAndEncryptOciApiKeyCredential(fields({ privateKey: `${privateKey}${suffix}` }))

apps/sim/lib/credentials/oci-api-key-service-account.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function normalizePrivateKey(value: unknown): string {
9898
? normalized.slice(0, -'\nOCI_API_KEY'.length).trimEnd()
9999
: normalized
100100
if (
101-
!/^-----BEGIN (PRIVATE KEY|RSA PRIVATE KEY|ENCRYPTED PRIVATE KEY)-----\n[\s\S]+\n-----END \1-----$/.test(
101+
!/^-----BEGIN (PRIVATE KEY|RSA PRIVATE KEY|ENCRYPTED PRIVATE KEY)-----\n(?:(?!-----BEGIN |-----END )[\s\S])+\n-----END \1-----$/.test(
102102
pem
103103
)
104104
) {

0 commit comments

Comments
 (0)