-
Notifications
You must be signed in to change notification settings - Fork 14
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
Mitgation of script injection risk in CI [was Add support for a method_extras
option]
#59
Conversation
fdfee2e
to
7cbbdaf
Compare
I also attempted to fix the CI in 7cbbdaf, it was attempting to execute my backtick-quoted |
Hello James, Thanks for the PR. Another way to reach the same goal is to define the method as a global function that takes the class instance as its first parameter in a header file and include the header file in the You can find an example in ex002-ROOT, here Templates.h line 18. This lines add a In the example of your unit test, you use a lambda function and supports only reference. The extra header file will be:
Support for pointer (
For your use case, this solution is in my opinion cleaner than inserting custom code in the generated code. Note: if the need to define two versions of the methods is too inconvenient, this can improved. I have already ideas how to avoid it. I can explain them if wanted. That said, there might be use cases that cannot be handled with wrapit, and for which insertion of custom code would be needed. Embedding custom code in function is tricky since you can have conflicts between the generated code, which can evolve with wrapit releases, and custom code. To handle such case, I think we should use hook functions. In you example, the code generated for Nevertheless, before adding hooks everywhere, I believe we should first have concrete use cases that cannot be handled without a hook. Let me know if the provided solution, without hook or embedding code, suits your needs. I will add to the Philippe. |
Thanks for the reply, that's actually an excellent idea :) I didn't think of that. I'm trying it and it seems to be mostly successful, the only thing I'm struggling with is having a method that returns a inline jlcxx::Array<float> foo() {
jlcxx::Array<float> tests{ };
return tests;
} Creates this wrapper in t.method("foo", static_cast<int (*)() >(&foo)); For some reason the return type is being inferred as an t.method("foo", static_cast<jlcxx::Array<float> (*)() >(&foo)); Then compilation succeeds and the function can be called from Julia. Do you know what's up with that? |
The CI workflows will interpolate the PR body text, so something like backticks `` in the PR body would be interpreted as a command for interpolation into the string. Switched to using environment variables instead: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
Ok, turns out it was because I needed to add the CxxWrap and I deleted the commit to add |
method_extras
optionmethod_extras
option]
This allows the user to specify files in the config file that will be inserted into the generated wrappers for specific types. It makes customizing the wrappers a bit easier, since otherwise the only option would be to take the generated wrappers, modify them, and either commit the changes or save the changes as a patch to be applied.
In the future this might need to be extended to add support for extra globals in
JlGlobals.cxx
.