Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow to use vips_block_untrusted_set and vips_operation_block_set methods #382

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
jcupitt merged 1 commit into libvips:master from andreyruby:master
Feb 21, 2024

Conversation

@andreyruby
Copy link

@andreyruby andreyruby commented Dec 20, 2023

Some forgotten stuff I think...

I wrote tests same way as they are in python library
https://github.com/libvips/pyvips/blob/a9688b9c7c2a4b448eec0f0a9375c8f34e76354e/tests/test_block.py#L38

Copy link
Member

jcupitt commented Feb 19, 2024
edited
Loading

Hi @aglushkov,

Thank you for doing this work, and sorry for sitting on it for so long.

 Vips.vips_block_untrusted_set(true)

This is a little ugly. How about making a tiny wrapper, like the one for vips_vector_set_enabled()?

https://github.com/libvips/ruby-vips/blob/master/lib/vips.rb#L703-L708

So eg. maybe:

 # Block untrusted loaders from executing.
 def self.block_untrusted enabled
 vips_block_untrusted_set(enabled ? 1 : 0)
 end
 # Set or clear the block flag on a named operation.
 def self.block name
 vips_operation_block_set(name)
 end

Copy link
Author

@jcupitt No worries, added commit with wrappers
Not sure if it's ok to have second enabled parameter, or you want a separate unblock methods.
Also not sure its correct place for wrappers and attach_functions in operation.rb file.
And I would like to check if provided operation name exists, but don't know how I can do this easily

Copy link
Member

jcupitt commented Feb 20, 2024
edited
Loading

We have the global Vips stuff in lib/vips.rb, the wrappers should probably go in there.

Ah you're right, I forgot the enabled param to vips_operation_block_set(). It should probably be required and not optional.

Copy link
Member

jcupitt commented Feb 20, 2024

... could you also add a line to CHANGELOG and credit yourself?

andreyruby reacted with thumbs up emoji

...t methods
```ruby
Vips.block("VipsForeignLoad", true);
Vips.block("VipsForeignLoadJpeg", false)
Vips.block_untrusted(true)
```
Use `vips -l` at the command-line to see the operations classes hierarchy.
Copy link
Member

jcupitt commented Feb 21, 2024

This looks really nice. Thank you for adding this feature @aglushkov !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /