Skip to content

fix(apns): handling of the certificate expiration error #364

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

geekbrother
Copy link
Contributor

Description

This PR adds proper handling of the received fatal alert: CertificateExpired APNS error.

How Has This Been Tested?

Not tested.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@geekbrother geekbrother self-assigned this May 20, 2025
// Note: Should we pass this error back up?
Err(_e) => None,
};
let public_ip = networking::find_public_ip_addr().ok();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing clippy error.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces handling for APNS CertificateExpired errors and simplifies public IP lookup.

  • Simplify public_ip assignment by using .ok()
  • Add a new match arm for CertificateExpired in the APNS provider

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/state.rs Replace manual match with .ok() for public IP
src/providers/apns.rs Add explicit handling for CertificateExpired alerts
Comments suppressed due to low confidence (3)

src/providers/apns.rs:178

  • [nitpick] Using dbg as a variable name can be confused with the dbg! macro. Rename this binding to something more descriptive, like debug_msg.
dbg if dbg.contains("received fatal alert: CertificateExpired") => {

src/providers/apns.rs:175

  • New error variant ApnsCertificateExpired is introduced but there are no tests for this branch. Consider adding a unit test that simulates the CertificateExpired response.
impl PushProvider for ApnsProvider {

src/providers/apns.rs:179

  • The client_error identifier isn't in scope here and named placeholders aren't supported by info!. You likely need to reference the correct error variable and use {} formatting with positional arguments.
info!("APNs certificate expired: debug:{dbg}, display: {client_error}");

// Note: Should we pass this error back up?
Err(_e) => None,
};
let public_ip = networking::find_public_ip_addr().ok();
Copy link
Preview

Copilot AI May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silently ignoring errors from find_public_ip_addr may make debugging harder. Consider logging the error at debug or warn level before calling .ok().

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy