Skip to content

Swift: Add more path injection sinks #11742

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

Merged

Conversation

atorralba
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the Swift label Dec 19, 2022
@atorralba atorralba force-pushed the atorralba/swift/more-path-injection-sinks branch from d6eea64 to 19f76c3 Compare December 20, 2022 09:48
@atorralba atorralba marked this pull request as ready for review December 20, 2022 10:12
@atorralba atorralba requested a review from a team as a code owner December 20, 2022 10:12
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. One small question.

NSString().write(toFile: remoteString, atomically: true, encoding: 0) // $ hasPathInjection=139
let _ = NSKeyedUnarchiver().unarchiveObject(withFile: remoteString) // $ hasPathInjection=139
let _ = ArchiveByteStream.fileStream(fd: remoteString as! FileDescriptor, automaticClose: true) // $ hasPathInjection=139
ArchiveByteStream.withFileStream(fd: remoteString as! FileDescriptor, automaticClose: true) { _ in } // $ hasPathInjection=139
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the implementation used by remoteString as! FileDescriptor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the functions being called? They're stubbed here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it was the conversion from String (remoteString) to FileDescriptor (the argument type) that was puzzling me, I was expecting to see [stub] code for it somewhere. But I guess the test works...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's a forced cast to keep it simple. That would probably not work if the code was actually executed, but it should be good enough for the test.

geoffw0
geoffw0 previously approved these changes Jan 11, 2023
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

LGTM.

@atorralba atorralba force-pushed the atorralba/swift/more-path-injection-sinks branch from 19f76c3 to 6b52c15 Compare January 11, 2023 11:05
@atorralba
Copy link
Contributor Author

Had to rebase to fix conflicts with the GRDB PR.

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

👍

@atorralba atorralba force-pushed the atorralba/swift/more-path-injection-sinks branch from 6b52c15 to c115a9f Compare January 11, 2023 13:28
@atorralba atorralba merged commit c6d9e1e into github:main Jan 11, 2023
@atorralba atorralba deleted the atorralba/swift/more-path-injection-sinks branch January 11, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants