Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Mars Rover is program which takes a text file in the format as described below and then displays its resulting rover location to the console.
File Format
8 8
1 2 E
MMLMRMMRRMML
Where line 1 is the size of the survey zone. Line 2 is the start position of the mars rover and the starting direction.
Line 3 contains the commands for the rover to follow. M
moves the rover, L
turns the rover 90 degrees left and R
turns the rover 90 degrees right.
The application does all the pre-checks before executing; from validating program arguments, checking starting points are in the define survey zone and validating all actions are valid. Once the checks have passed, commands are passed to the rover for execution. On completion the resulting location is displayed to the console.
Add this line to your application's Gemfile:
gem 'dallas_mars_rover'
And then execute:
$ bundle
Or install it yourself as:
$ gem install dallas_mars_rover
Just run the executable:
$ dallas_mars_rover command_file
There are 3 sample files to test: file1.txt is the test file file2.txt is a case failure file3.txt is a larger test pass
And it will output the resultant position to the console.
See the screenshot for usage examples
I implemented this assignment as a gem as it shows all the features that make up a ruby application. From gem creation, using bundler, versioning and ruby conventions. Traditionally code correctness would be tested using TDD or BDD, I implement some basic tests showing the use of minitest, but for this solution pencil and graph paper was used to test as well. I design the app to run as modular as possible keeping each major component to its own object, namely:
MarsRover This is the main application. It handles the creation of the objects, the starting of the rover, displaying the results and simple validations on the file passed as an argument. If multiple arguments are passed it checks them to see which are actual files and if more than one file will let the user know to supply one. On successful creation of all the required objects, it passes the commands to the rover for processing.
Commander The commander object handles the validation of the contents of the command file. It reads in the 3 lines and validates each against a set of rules before passing over control. I checks the start position is in the survey zone. Checks the start direction is a valid cardinal point. Then runs all the rover locomotion commands through a validator to see only the 3 required commands are there.
Zone The zone object holds a map of the co-ordinates for the rover and can check if a rover move is valid.
Rover The object for the physical rover. It tracks its current position in the zone and drives and turns based on the commands given to it from the commander object. On completion of processing its commands, it gives control back to MarsRover to return its current position.
Bug reports and pull requests are welcome on GitHub at https://github.com/dallasgoldswain/mars_rover.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that dallas_mars_rover demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.