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

Be more strict when parsing plists #88

Merged
merged 3 commits into from
Apr 26, 2022
Merged

Conversation

trufae
Copy link
Contributor

@trufae trufae commented Jan 11, 2018

No description provided.

@trufae
Copy link
Contributor Author

trufae commented Jan 11, 2018

related to #87

@trufae
Copy link
Contributor Author

trufae commented Jan 11, 2018

test case:

var p = require('./');

var o = p.parse(`
<plist>
<dict>
  <key>test</key>
  <string>Testing</string>
  <key>bar</key>
  <string></string>
</dict>
</plist>
`);

console.log(p.build(o));

@trufae
Copy link
Contributor Author

trufae commented Apr 22, 2022

Can i have a review on this at least? i would love to use the official module but it's broken for my usecases so i need to keep maintaining my fork

@mreinstein
Copy link
Collaborator

technically this is a breaking change, right? meaning this would have to be included with a major semver bump to v4, unless I misunderstand

@mreinstein
Copy link
Collaborator

I appreciate the PRs. Please add at least 1 test to validate this behavior

@trufae trufae force-pushed the parse-hard branch 2 times, most recently from 182a40b to d90ff97 Compare April 26, 2022 16:44
@trufae
Copy link
Contributor Author

trufae commented Apr 26, 2022

Should be good to review now

@mreinstein
Copy link
Collaborator

mreinstein commented Apr 26, 2022

Isn't an empty string still considered valid?

@trufae
Copy link
Contributor Author

trufae commented Apr 26, 2022

added a test for the empty string case

@mreinstein
Copy link
Collaborator

maybe I misunderstood the test case. Which part of the plist is considered the invalid part? the <strong>... section?

@trufae
Copy link
Contributor Author

trufae commented Apr 26, 2022

yes. <strong> is not a valid token for a plist. so it shouldnt permit deserializing it because it results on an invalid xml that fails later on when parsing it.

i'm using this library on millions of iOS apps and i think it's fine to consider invalid what's not correct to ease catching bugs in early stages of the problem.

the output of this test without the patch results on this:

<plist>
<dict>
  <key>test</key>
  <key>bar</key>
  <string></string>
</dict>
</plist>

@mreinstein
Copy link
Collaborator

so basically this library switches it's philosophy from permissive to a more strict interpretation in v4, right?

I'm not opposed to this, I think it's probably better to be strict, but I want to ensure this is communicated when the v4 migration doc is written.

@trufae
Copy link
Contributor Author

trufae commented Apr 26, 2022

That's correct. maybe we can have an option disabled by default for this behaviour, so it doesnt breaks. will this way be merged?

also i added the missing line to run the CI on pullreqsts in here

@mreinstein mreinstein merged commit 4031a9d into TooTallNate:master Apr 26, 2022
@trufae
Copy link
Contributor Author

trufae commented Apr 26, 2022

good! :D thanks

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