Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
irjudson-dm-ldap-adapter
Advanced tools
= dm-ldap-adapter
A DataMapper adapter for Lightweight Directory Access Protocol (LDAP) servers.
== Usage
DM LDAP Adapter enables the creation of application objects that map against an existing LDAP server. For example, a "user" can map against the posixAccount schema in an LDAP server providing uidNumber, gidNumber, uid, homeDirectory and userPassword. These are intended to map to unix accounts so that authentication on unix systems can be centrally managed by the LDAP server.
Currently, mapping LDAP schemas to application objects must be done manually by the developer, but the intent is to create a set of objects corresponding to the set of most commonly used LDAP schemas so application developers can leverage them with less effort.
DataMapper.setup(:default, { :adapter => 'ldap', :host => 'localhost', :port => '389', :base => "ou=people,dc=example,dc=com", :username => "cn=admin,dc=example,dc=com", :password => "exPa5$w0rd" })
class User include DataMapper::Resource
@@base = "ou=people,dc=example,dc=com"
@@objectclass = [ "top", "person", "organizationalPerson", "inetOrgPerson", "extensibleObject", "shadowAccount", "posixAccount" ]
property :username, String, :field => "uid", :key => true property :uuid, String, :field => "uniqueidentifier" property :name, String, :field => "cn" property :first_name, String, :field => "givenname" property :last_name, String, :field => "sn" property :mail, String, :field => "mail" property :groupid, Integer, :field => "gidnumber" property :userid, Integer, :field => "uidnumber" property :homedirectory, String, :field => "homedirectory"
def objectclass @@objectclass end
def make_dn "uid=#{netid},#{@@base}" end end
This is exactly like normal datamapper models, with a couple of extras to make LDAP function.
@@base is a class variable that defines where in the LDAP hierarchy this class of objects reside, it represents a path from the root. This is important because each piece of ldap data is uniquely identified by a distinguisedName which is the key attribute + @@base. For example, the distinguishedName "uid=testuser,ou=people,dc=example,dc=com" uniquely identifies the test user in the LDAP server.
@@objectclass is the list of LDAP schemas that are required to define this particular LDAP object. Each schema contributes some set of attributes that, when taken together, define all the objects at that location in the LDAP tree. This list is required when new resources are created in LDAP, but ideally should be hidden from the application developer.
== Code
user = User.new(:username => "dmtest", :uuid => UUID.random_create().to_s, :name => "DataMapper Test", :homedirectory => "/home/dmtest", :first_name => "DataMapperTest", :last_name => "User", :userid => 3, :groupid => 500)
user.save
user = User.first(:username => 'dmtest') puts user
user.update_attributes(:name => 'DM Test') user.save puts user
result = user.destroy puts "Result: #{result}"
== TODO:
Figure out a good testing strategy, get standard adapter tests in place
Finish query implementation (limit, order, etc)
Consider making pre-mapped resources corresponding to the most commonly used LDAP object types so applications can use them without duplication of effort for each application.
Documentation clean up
FAQs
Unknown package
We found that irjudson-dm-ldap-adapter 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.