Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/functions/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}
try {
validateKey(transformedKey);
} catch (err: any) {

Check warning on line 84 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
throw new FirebaseError(`Invalid secret key ${transformedKey}`, { children: [err] });
}
return transformedKey;
Expand All @@ -96,9 +96,9 @@
export function validateJsonSecret(secretName: string, secretValue: string): void {
try {
JSON.parse(secretValue);
} catch (e: any) {

Check warning on line 99 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
throw new FirebaseError(
`Provided value for ${secretName} is not valid JSON: ${e.message}\n\n` +

Check warning on line 101 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .message on an `any` value

Check warning on line 101 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Invalid type "any" of template literal expression
`For complex JSON values, use:\n` +
` firebase functions:secrets:set ${secretName} --data-file <file.json>\n` +
`Or pipe from stdin:\n` +
Expand Down Expand Up @@ -155,8 +155,8 @@
}
}
return secret;
} catch (err: any) {

Check warning on line 158 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unexpected any. Specify a different type
if (err.status !== 404) {

Check warning on line 159 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .status on an `any` value
throw err;
}
}
Expand Down Expand Up @@ -189,7 +189,7 @@
/**
* Checks whether a secret is in use by the given endpoint.
*/
export function inUse(projectInfo: ProjectInfo, secret: Secret, endpoint: backend.Endpoint) {

Check warning on line 192 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
const { projectId, projectNumber } = projectInfo;
for (const sev of of([endpoint])) {
if (
Expand Down Expand Up @@ -234,11 +234,14 @@
endpoints: backend.Endpoint[],
): Promise<SecretForPruning[]> {
const { projectId, projectNumber } = projectInfo;
const pruneKey = (name: string, version: string) => `${name}@${version}`;

Check warning on line 237 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Missing return type on function
const prunedSecrets: Set<string> = new Set();

// Collect all Firebase managed secret versions
const haveSecrets = await listSecrets(projectId, `labels.${FIREBASE_MANAGED}=true`);
const haveSecrets = await listSecrets(
projectId,
`labels.${FIREBASE_MANAGED}=true OR labels.${FIREBASE_MANAGED}=functions`,
);
for (const secret of haveSecrets) {
const versions = await listSecretVersions(projectId, secret.name, `NOT state: DESTROYED`);
for (const version of versions) {
Expand Down Expand Up @@ -302,7 +305,7 @@
const { projectId, projectNumber } = projectInfo;

logger.debug("Pruning secrets to find unused secret versions...");
const unusedSecrets: SecretForPruning[] = await module.exports.pruneSecrets(

Check warning on line 308 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .pruneSecrets on an `any` value

Check warning on line 308 in src/functions/secrets.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value
{ projectId, projectNumber },
endpoints,
);
Expand Down
Loading