Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
#简介
#安装
gem install oauth_china
#使用
gem 'oauth'
gem 'oauth_china'
config/oauth/douban.yml
config/oauth/sina.yml
config/oauth/qq.yml
config/oauth/sohu.yml
config/oauth/netease.yml
development:
key: "you api key"
secret: "your secret"
url: "http://yoursite.com"
callback: "http://localhost:3000/your_callback_url"
production:
key: "you api key"
secret: "your secret"
url: "http://yoursite.com"
callback: "http://localhost:3000/your_callback_url"
#config/routes.rb
match "syncs/:type/new" => "syncs#new", :as => :sync_new
match "syncs/:type/callback" => "syncs#callback", :as => :sync_callback
# encoding: UTF-8
class SyncsController < ApplicationController
def new
client = OauthChina::Sina.new
authorize_url = client.authorize_url
Rails.cache.write(build_oauth_token_key(client.name, client.oauth_token), client.dump)
redirect_to authorize_url
end
def callback
client = OauthChina::Sina.load(Rails.cache.read(build_oauth_token_key(params[:type], params[:oauth_token])))
client.authorize(:oauth_verifier => params[:oauth_verifier])
results = client.dump
if results[:access_token] && results[:access_token_secret]
#在这里把access token and access token secret存到db
#下次使用的时候:
#client = OauthChina::Sina.load(:access_token => "xx", :access_token_secret => "xxx")
#client.add_status("同步到新浪微薄..")
flash[:notice] = "授权成功!"
else
flash[:notice] = "授权失败!"
end
redirect_to root_path
end
private
def build_oauth_token_key(name, oauth_token)
[name, oauth_token].join("_")
end
end
系统时间要正确设置。否则会出现timstamps refused错误
#API文档
#License This program is free softwareyou can redistribute it and /or modify it under the terms of the GNU General Public License as published by the Free Software Foundataioneither version 2 of the License,or (at your option) any later version.
You should have read the GNU General Public License before start "RTFSC".
If not,see http://www.gnu.org/licenses/
FAQs
Unknown package
We found that oauth_china 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.