Skip to content

fix: double escaped http-source selectors - #71

Merged
davidmytton merged 2 commits into
arcjet:mainfrom
jone:main
Aug 22, 2026
Merged

davidmytton merged 2 commits into
arcjet:mainfrom
jone:main

Conversation

@jone

@jone jone commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

The current JSON contains double-escaped http-source selectors.

Invalid example ("id": "google-crawler"):

            "type": "http-json",
            "url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
            "selector": "$.prefixes[*][\\\"ipv6Prefix\\\",\\\"ipv4Prefix\\\"]"

The current file also contains a correct example ("id": "google-crawler-mobile"):

            "type": "http-json",
            "url": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
            "selector": "$.prefixes[*][\"ipv4Prefix\",\"ipv6Prefix\"]"

This change fixes invalid selectors in the data.

Validation

I've added a specific validation for this problem. A better validation would be to actually parse the selector expression, but that would need an a dependency and a package.json. I did not want change the no-dependency principle of the project.

jone added 2 commits August 22, 2026 12:27
The current JSON contains double escaped http-json source selectors
which are not valid.
@jone
jone requested a review from a team as a code owner August 22, 2026 10:35
@arcjet-review arcjet-review Bot added the needs review Awaiting human review label Aug 22, 2026

@davidmytton davidmytton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix!

@arcjet-review arcjet-review Bot removed the needs review Awaiting human review label Aug 22, 2026
@davidmytton
davidmytton merged commit bb69ef0 into arcjet:main Aug 22, 2026
2 checks passed
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.

2 participants