Giter VIP home page Giter VIP logo

haveibeenpwned's People

Contributors

gideonlegrange avatar martinspielmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

haveibeenpwned's Issues

HaveIBeenPwndApi Adaptation for Android ?

It would be awesome if you adapt this library to support Android 16+
Optional classes and java.util.stream are supported from Android API level 24+ , can you make an workaround to support older versions too ?

Thanks for the good work

okhttp3 error

Hi !

I'm currently trying to use this wrapper, I used the example code to try it out, but when I instantiate my HaveIBeenPwndApi class, this error shows up.

Exception in thread "main" java.lang.NoSuchMethodError: okhttp3.HttpUrl.get(Ljava/lang/String;)Lokhttp3/HttpUrl;
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:458)
at me.legrange.haveibeenpwned.HaveIBeenPwndApi.(HaveIBeenPwndApi.java:59)
at me.legrange.haveibeenpwned.HaveIBeenPwndApi.(HaveIBeenPwndApi.java:41)
...

Code » HaveIBeenPwndApi hibp = new HaveIBeenPwndApi();
Running the program in a git bash window.
Using Windows 10, Java 8, imported the depend using Maven.

Looking forward for an answer,
Maxx_.

Library will throw ArrayIndexOutOfBounds exceptions on certain operations that go through `searchByRange`

Here is the top of a sample stack trace that we have been seeing on some of our production systems that are making a call into the isPlainPasswordPwned method:

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at me.legrange.haveibeenpwned.HaveIBeenPwndApi.lambda$searchByRange$2(HaveIBeenPwndApi.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at me.legrange.haveibeenpwned.HaveIBeenPwndApi.searchByRange(HaveIBeenPwndApi.java:180)
	at me.legrange.haveibeenpwned.HaveIBeenPwndApi.isHashPasswordPwned(HaveIBeenPwndApi.java:221)
	at me.legrange.haveibeenpwned.HaveIBeenPwndApi.isPlainPasswordPwned(HaveIBeenPwndApi.java:209)

The issue here seems to be that the searchByRange helper method is getting input from the remote API, and in each line of the response it receives it is splitting the line based on a : delimiter character. It does not check the input that it has split before indexing into splitResult[1] .

If the code within searchByRange were tweaked to be a little bit more defensive about malformed input and exclude lines that seem to be malformed in this way from the result this problem would disappear.

Not an immediate problem for us -- we can look for the ArrayIndexOutOfBoundsException and catch it separately -- but it seems like a bug worth fixing. And we'll be happy to take the dependency on the new library version if it were fixed. Thanks!

Allow changing API URL for fault injection testing

Can you make it possible to change the URL for Have I Been Pwned in the client library for testing purposes? I want to be able to switch it to a proxy server, so I can test what happens if the server goes down or times out. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.