Skip to content
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

Fix typo in manifest regex #6885

Merged
merged 4 commits into from
Aug 8, 2023
Merged

Conversation

lpsinger
Copy link
Contributor

The character class [A-f0-9] contains a typo: the manifest versions are upper-case hex strings.

This fixes the following CodeQL warning:
https://codeql.github.com/codeql-query-help/javascript/js-overly-large-range/

@changeset-bot
Copy link

changeset-bot bot commented Jul 19, 2023

⚠️ No Changeset found

Latest commit: bda9c78

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

The character class `[A-f0-9]` contains a typo: the manifest
versions are upper-case hex strings.

This fixes the following CodeQL warning:
https://codeql.github.com/codeql-query-help/javascript/js-overly-large-range/
@pcattori
Copy link
Contributor

pcattori commented Jul 20, 2023

I think the A-f range is intentional as lowercased hex strings are present in manifest versions:

Screenshot 2023-07-20 at 12 18 33 PM

Plus the integration tests that look for those patterns are now timing out with the proposed changes.

Could change to [A-Fa-f0-9] instead to keep current behavior, or if we can guarantee that uppercase won't be used, then we could drop A-F.

@lpsinger
Copy link
Contributor Author

I think the A-f range is intentional as lowercased hex strings are present in manifest versions:

How very odd. In my Remix 1.19.0 architect project, the filenames have uppercase manifest versions. What hosting target are you using?

templates/arc/plugin-remix.js Outdated Show resolved Hide resolved
@pcattori pcattori merged commit ae03655 into remix-run:dev Aug 8, 2023
9 checks passed
@lpsinger lpsinger deleted the fix-typo-manifest-regex branch August 8, 2023 21:36
@lpsinger
Copy link
Contributor Author

lpsinger commented Aug 8, 2023

@pcattori, did we ever find a reason why in my testing the fingerprints were always uppercase but on yours they were lowercase or mixed case? I just have a lingering worry that there might be another bug there, or at least an inconsistency between different hosting targets.

@pcattori
Copy link
Contributor

pcattori commented Aug 8, 2023

Could be an OS-related thing (case-sensitive vs case-insensitive filesystems?), but not sure. If it comes up, we can create a separate issue.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

🤖 Hello there,

We just published version v0.0.0-nightly-a179aa7-20230809 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-b1149bb-20230810 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@pcattori
Copy link
Contributor

pcattori commented Sep 5, 2023

@lpsinger I've tracked this down! Looks like plugin-remix.js is grabbing the build hash from public/build/manifest-<HASH>.js filename, whereas the rest of the code is looking at the contents of that file, specifically the assets.version field.

Turns out that esbuild uppercases the build hash when including it as part of a filename. By lowercasing that hash before logging it via logDevReady, Remix HMR are flowing correctly.

But something is messing up the HMR mechanism in Remix for the arc template and the grunge stack. Didn't find it before, since arc seems to be forcing a live reload of the app when files change. Not sure why that's happening since livereload option for arc sandbox is supposed to default to false. Even if I explicitly set livereload false in app.arc, it still happens.

@lpsinger
Copy link
Contributor Author

lpsinger commented Sep 5, 2023

@lpsinger I've tracked this down! Looks like plugin-remix.js is grabbing the build hash from public/build/manifest-<HASH>.js filename, whereas the rest of the code is looking at the contents of that file, specifically the assets.version field.

Turns out that esbuild uppercases the build hash when including it as part of a filename. By lowercasing that hash before logging it via logDevReady, Remix HMR are flowing correctly.

Wouldn't it be more consistent to have plugin-remix.js check the file contents?

@pcattori
Copy link
Contributor

pcattori commented Sep 5, 2023

Wouldn't it be more consistent to have plugin-remix.js check the file contents?

💯 agreed. I already have the change locally but haven't pushed it up as a PR since I've got a couple other fixes I was investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants