Skip to content

Conversation

eric-forte-elastic
Copy link
Contributor

@eric-forte-elastic eric-forte-elastic commented Sep 15, 2025

Pull Request

Issue link(s):
Resolves #5114

Summary - What I changed

Small update to handle unauthorized error in addition to the existing 404 errors. Example error: https://github.com/elastic/detection-rules/actions/runs/17740182447/job/50414401327.
Will now generate the following:
image
OR
image

In this case we need to use text as the 401 error can be either bad credentials or needs auth.

❯ curl --request GET \
            --url "https://api.github.com/gists/0443cfb5016bed103f1940b2f336e45a" \
            --header "accept: application/vnd.github.v3+json"
{
  "message": "Requires authentication",
  "documentation_url": "https://docs.github.com/rest",
  "status": "401"
}⏎                                                                                             
…r-gist-error-handling [$?] is  v1.4.2 via  v3.12.11 (detection-rules-build) on  eric.forte
❯ curl --request GET \
      --url "https://api.github.com/gists/0443cfb5016bed103f1940b2f336e45a" \
      --header "Authorization: token 123" \
      --header "accept: application/vnd.github.v3+json"
{
  "message": "Bad credentials",
  "documentation_url": "https://docs.github.com/rest",
  "status": "401"
}⏎

How To Test

Run python -m detection_rules dev update-navigator-gists with an invalid token.

Checklist

  • Added a label for the type of pr: bug, enhancement, schema, maintenance, Rule: New, Rule: Deprecation, Rule: Tuning, Hunt: New, or Hunt: Tuning so guidelines can be generated
  • Added the meta:rapid-merge label if planning to merge within 24 hours
  • Secret and sensitive material has been managed correctly
  • Automated testing was updated or added to match the most common scenarios
  • Documentation and comments were added for features that require explanation

Contributor checklist

@eric-forte-elastic eric-forte-elastic linked an issue Sep 15, 2025 that may be closed by this pull request
@eric-forte-elastic eric-forte-elastic added python Internal python for the repository patch enhancement New feature or request labels Sep 15, 2025
@eric-forte-elastic eric-forte-elastic self-assigned this Sep 15, 2025
Copy link
Contributor

Enhancement - Guidelines

These guidelines serve as a reminder set of considerations when addressing adding a feature to the code.

Documentation and Context

  • Describe the feature enhancement in detail (alternative solutions, description of the solution, etc.) if not already documented in an issue.
  • Include additional context or screenshots.
  • Ensure the enhancement includes necessary updates to the documentation and versioning.

Code Standards and Practices

  • Code follows established design patterns within the repo and avoids duplication.
  • Ensure that the code is modular and reusable where applicable.

Testing

  • New unit tests have been added to cover the enhancement.
  • Existing unit tests have been updated to reflect the changes.
  • Provide evidence of testing and validating the enhancement (e.g., test logs, screenshots).
  • Validate that any rules affected by the enhancement are correctly updated.
  • Ensure that performance is not negatively impacted by the changes.
  • Verify that any release artifacts are properly generated and tested.
  • Conducted system testing, including fleet, import, and create APIs (e.g., run make test-cli, make test-remote-cli, make test-hunting-cli)

Additional Checks

  • Verify that the enhancement works across all relevant environments (e.g., different OS versions).
  • Confirm that the proper version label is applied to the PR patch, minor, major.

@eric-forte-elastic eric-forte-elastic marked this pull request as ready for review September 15, 2025 18:40
@shashank-elastic shashank-elastic merged commit 99ebad5 into main Sep 16, 2025
15 checks passed
@shashank-elastic shashank-elastic deleted the 5114-fr-updated-navigator-gist-error-handling branch September 16, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto enhancement New feature or request patch python Internal python for the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR] Updated Navigator Gist Error Handling
3 participants