Skip to content

Commit 279cf27

Browse files
committed
fix Unsafe JavaScript Equality Checking
1 parent 52904f6 commit 279cf27

5 files changed

+7
-7
lines changed

src/auth/auth-api-request.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ export abstract class AbstractAuthRequestHandler {
16031603
* @param email - The email of the user the link is being sent to.
16041604
* @param actionCodeSettings - The optional action code setings which defines whether
16051605
* the link is to be handled by a mobile app and the additional state information to be passed in the
1606-
* deep link, etc. Required when requestType == 'EMAIL_SIGNIN'
1606+
* deep link, etc. Required when requestType === 'EMAIL_SIGNIN'
16071607
* @param newEmail - The email address the account is being updated to.
16081608
* Required only for VERIFY_AND_CHANGE_EMAIL requests.
16091609
* @returns A promise that resolves with the email action link.

src/auth/auth-config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ export class OIDCConfig implements OIDCAuthProviderConfig {
15171517
const allKeys = Object.keys(options.responseType).length;
15181518
const enabledCount = Object.values(options.responseType).filter(Boolean).length;
15191519
// Only one of OAuth response types can be set to true.
1520-
if (allKeys > 1 && enabledCount != 1) {
1520+
if (allKeys > 1 && enabledCount !== 1) {
15211521
throw new FirebaseAuthError(
15221522
AuthClientErrorCode.INVALID_OAUTH_RESPONSETYPE,
15231523
'Only exactly one OAuth responseType should be set to true.',
@@ -1872,7 +1872,7 @@ export class RecaptchaAuthConfig implements RecaptchaConfig {
18721872
});
18731873
}
18741874

1875-
if (typeof options.useAccountDefender != 'undefined') {
1875+
if (typeof options.useAccountDefender !== 'undefined') {
18761876
if (!validator.isBoolean(options.useAccountDefender)) {
18771877
throw new FirebaseAuthError(
18781878
AuthClientErrorCode.INVALID_CONFIG,

src/auth/tenant.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export class Tenant {
287287
MultiFactorAuthConfig.buildServerRequest(request.multiFactorConfig);
288288
}
289289
// Validate SMS Regions Config if provided.
290-
if (typeof request.smsRegionConfig != 'undefined') {
290+
if (typeof request.smsRegionConfig !== 'undefined') {
291291
SmsRegionsAuthConfig.validate(request.smsRegionConfig);
292292
}
293293
// Validate reCAPTCHAConfig type if provided.

src/auth/token-verifier.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export class FirebaseTokenVerifier {
466466
private safeDecode(jwtToken: string): Promise<DecodedToken> {
467467
return decodeJwt(jwtToken)
468468
.catch((err: JwtError) => {
469-
if (err.code == JwtErrorCode.INVALID_ARGUMENT) {
469+
if (err.code === JwtErrorCode.INVALID_ARGUMENT) {
470470
const verifyJwtTokenDocsMessage = ` See ${this.tokenInfo.url} ` +
471471
`for details on how to retrieve ${this.shortNameArticle} ${this.tokenInfo.shortName}.`;
472472
const errorMessage = `Decoding ${this.tokenInfo.jwtName} failed. Make sure you passed ` +

src/remote-config/remote-config-api-client-internal.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class RemoteConfigApiClient {
110110
public publishTemplate(template: RemoteConfigTemplate, options?: { force: boolean }): Promise<RemoteConfigTemplate> {
111111
template = this.validateInputRemoteConfigTemplate(template);
112112
let ifMatch: string = template.etag;
113-
if (options && options.force == true) {
113+
if (options && options.force === true) {
114114
// setting `If-Match: *` forces the Remote Config template to be updated
115115
// and circumvent the ETag, and the protection from that it provides.
116116
ifMatch = '*';
@@ -244,7 +244,7 @@ export class RemoteConfigApiClient {
244244
* @param {string} customEtag A custom etag to replace the etag fom the API response (Optional).
245245
*/
246246
private toRemoteConfigTemplate(resp: HttpResponse, customEtag?: string): RemoteConfigTemplate {
247-
const etag = (typeof customEtag == 'undefined') ? resp.headers['etag'] : customEtag;
247+
const etag = (typeof customEtag === 'undefined') ? resp.headers['etag'] : customEtag;
248248
this.validateEtag(etag);
249249
return {
250250
conditions: resp.data.conditions,

0 commit comments

Comments
 (0)