封裝是要劃定清楚的界限。在網頁瀏覽器中,這可能意味著確保您的行動程式碼不會被其他行動程式碼濫用。在伺服器上,這可能意味著區分經過驗證的資料與未經驗證的資料、區分一個使用者的資料與另一個使用者的資料,或區分允許使用者查看的資料與不允許查看的資料。
public class MyClass {
private final static Logger good =
Logger.getLogger(MyClass.class);
private final static Logger bad =
Logger.getLogger(MyClass.class);
private final static Logger ugly =
Logger.getLogger(MyClass.class);
...
}
Console.Out
或 Console.Error
而不使用專用的記錄工具,會使得程式的運作方式變得非常困難。
public class MyClass {
...
Console.WriteLine("hello world");
...
}
Console.WriteLine()
來撰寫訊息以執行標準輸出。Console.WriteLine
可能會在轉向結構化記錄系統時產生一個錯誤。os.Stdout
或 os.Stderr
而不使用專用的記錄工具,會使得程式的運作方式變得非常困難。
...
func foo(){
fmt.Println("Hello World")
}
fmt.Println()
來撰寫訊息以執行標準輸出。os.Stdout
或 os.Stderr
可能會在轉向結構化記錄系統時產生錯誤。System.out
或 System.err
而不使用專用的記錄工具,會使得程式的運作方式變得非常困難。
public class MyClass
...
System.out.println("hello world");
...
}
System.out.println()
來撰寫訊息以執行標準輸出。System.out
或 System.err
可能會在轉向結構化記錄系統時產生一個錯誤。process.stdout
或 process.stderr
而不使用專用的記錄工具,會使得監控程式的運作方式變得非常困難。
process.stdin.on('readable', function(){
var s = process.stdin.read();
if (s != null){
process.stdout.write(s);
}
});
process.stdout.write()
來撰寫訊息以執行標準輸出。process.stdout
或 process.stderr
可能會在轉向結構化記錄系統時產生一個錯誤。print
或 println
而不使用專用的記錄工具,會使得程式的運作方式變得非常困難。
class MyClass {
...
println("hello world")
...
}
}
print
或 println
來撰寫訊息以執行標準輸出。
sys.stdout.write("hello world")
sys.stdout
或 sys.stderr
可能會在轉向結構化記錄系統時產生一個錯誤。Kernel.puts
、Kernel.warn
或 Kernel.printf
而不使用專用的記錄工具,會使得監控程式的運作方式變得非常困難。
...
puts "hello world"
...
Kernel.puts
來撰寫訊息以執行標準輸出。Kernel.puts
、Kernel.warn
或 Kernel.printf
可能會在轉向結構化記錄系統時產生一個錯誤。Logger
類別,但是會將資訊記錄到系統輸出串流:
require 'logger'
...
logger = Logger.new($stdout)
logger.info("hello world")
...
ERROR_CODE
欄位已宣告為公用與靜態欄位,但不是 final 欄位:
public class MyClass
{
public static int ERROR_CODE = 100;
//...
}
clientaccesspolicy.xml
組態設定檔案中的適當設定來修改策略。但是,變更設定時應特別小心,因為過度允許的跨網域策略會允許惡意應用程式以不適當的方式與受害者服務通訊,導致欺騙、資料遭竊取、傳遞和其他攻擊。clientaccesspolicy.xml
使用萬用字元指定允許服務與哪些網域通訊。
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
*
做為 domain
元素的 uri
屬性值,表示任何網域上的應用程式都可以連線至服務。
...
CALL FUNCTION 'FTP_VERSION'
...
IMPORTING
EXEPATH = p
VERSION = v
WORKING_DIR = dir
RFCPATH = rfcp
RFCVERSION = rfcv
TABLES
FTP_TRACE = FTP_TRACE.
WRITE: 'exepath: ', p, 'version: ', v, 'working_dir: ', dir, 'rfcpath: ', rfcp, 'rfcversion: ', rfcv.
...
string cs="database=northwind;server=mySQLServer...";
SqlConnection conn=new SqlConnection(cs);
...
Console.Writeline(cs);
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
char* path = getenv("PATH");
...
fprintf(stderr, "cannot find exe on path %s\n", path);
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
print(Platform.environment["HOME"]);
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
path := os.Getenv("PATH")
...
log.Printf("Cannot find exe on path %s\n", path)
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
try {
...
} catch (Exception e) {
e.printStackTrace();
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (Exception e) {
String exception = Log.getStackTraceString(e);
Intent i = new Intent();
i.setAction("SEND_EXCEPTION");
i.putExtra("exception", exception);
view.getContext().sendBroadcast(i);
}
...
...
public static final String TAG = "NfcActivity";
private static final String DATA_SPLITTER = "__:DATA:__";
private static final String MIME_TYPE = "application/my.applications.mimetype";
...
TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);
String VERSION = tm.getDeviceSoftwareVersion();
...
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter == null)
return;
String text = TAG + DATA_SPLITTER + VERSION;
NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
MIME_TYPE.getBytes(), new byte[0], text.getBytes());
NdefRecord[] records = { record };
NdefMessage msg = new NdefMessage(records);
nfcAdapter.setNdefPushMessage(msg, this);
...
$log.log(exception);
try {
...
} catch (e: Exception) {
e.printStackTrace()
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (e: Exception) {
val exception = Log.getStackTraceString(e)
val intent = Intent()
intent.action = "SEND_EXCEPTION"
intent.putExtra("exception", exception)
view.context.sendBroadcast(intent)
}
...
...
companion object {
const val TAG = "NfcActivity"
private const val DATA_SPLITTER = "__:DATA:__"
private const val MIME_TYPE = "application/my.applications.mimetype"
}
...
val tm = Context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
val VERSION = tm.getDeviceSoftwareVersion();
...
val nfcAdapter = NfcAdapter.getDefaultAdapter(this)
val text: String = "$TAG$DATA_SPLITTER$VERSION"
val record = NdefRecord(NdefRecord.TNF_MIME_MEDIA, MIME_TYPE.getBytes(), ByteArray(0), text.toByteArray())
val records = arrayOf(record)
val msg = NdefMessage(records)
nfcAdapter.setNdefPushMessage(msg, this)
...
...
NSString* deviceID = [[UIDevice currentDevice] name];
[deviceID writeToFile:@"/dev/stderr" atomically:NO encoding:NSUTF8StringEncoding error:nil];
...
<?php
...
echo "Server error! Printing the backtrace";
debug_print_backtrace();
...
?>
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
begin
log = Logger.new(STDERR)
...
rescue Exception
log.info("Exception: " + $!)
...
end
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。當然,Example 1
中的另一個問題是救援根 Exception
而非特定類型或錯誤/異常,表示它將捕捉到會潛在造成其他不重要負面影響的所有異常。
...
public struct StderrOutputStream: OutputStreamType {
public static let stream = StderrOutputStream()
public func write(string: String) {fputs(string, stderr)}
}
public var errStream = StderrOutputStream.stream
let deviceID = UIDevice.currentDevice().name
println("Device ID: \(deviceID)", &errStream)
...
true
,axis.enableListQuery
會啟用 Web 服務部署描述符號 (WSDD) 的清單。此功能會暴露目前系統組態,而其中可能包含管理服務密碼等敏感資訊。
...
CALL FUNCTION 'FTP_VERSION'
...
IMPORTING
EXEPATH = p
VERSION = v
WORKING_DIR = dir
RFCPATH = rfcp
RFCVERSION = rfcv
TABLES
FTP_TRACE = FTP_TRACE.
WRITE: 'exepath: ', p, 'version: ', v, 'working_dir: ', dir, 'rfcpath: ', rfcp, 'rfcversion: ', rfcv.
...
try {
...
}
catch(e:Error) {
trace(e.getStackTrace());
}
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。<apex:messages/>
元素中洩漏異常資訊:
try {
...
} catch (Exception e) {
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.FATAL, e.getMessage());
ApexPages.addMessage(msg);
}
try
{
...
}
catch (Exception e)
{
Response.Write(e.ToString());
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
int sockfd;
int flags;
char hostname[1024];
hostname[1023] = '\0';
gethostname(hostname, 1023);
...
sockfd = socket(AF_INET, SOCK_STREAM, 0);
flags = 0;
send(sockfd, hostname, strlen(hostname), flags);
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。SQLCODE
和錯誤訊息 SQlERRMC
與 SQL 指令有關,是造成終端機錯誤的原因。
...
EXEC SQL
WHENEVER SQLERROR
PERFORM DEBUG-ERR
SQL-EXEC.
...
DEBUG-ERR.
DISPLAY "Error code is: " SQLCODE.
DISPLAY "Error message is: " SQLERRMC.
...
Example 1
中,資料庫錯誤訊息即可揭露應用程式容易受到 SQL injection 攻擊。其他錯誤訊息還可揭露更多關於系統的間接線索。
<cfcatch type="Any">
<cfset exception=getException(myObj)>
<cfset message=exception.toString()>
<cfoutput>
Exception message: #message#
</cfoutput>
</cfcatch>
func handler(w http.ResponseWriter, r *http.Request) {
host, err := os.Hostname()
...
fmt.Fprintf(w, "%s is busy, please try again later.", host)
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws IOException {
...
PrintWriter out = res.getWriter();
try {
...
} catch (Exception e) {
out.println(e.getMessage());
}
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (Exception e) {
String exception = Log.getStackTraceString(e);
Intent i = new Intent();
i.setAction("SEND_EXCEPTION");
i.putExtra("exception", exception);
view.getContext().sendBroadcast(i);
}
...
...
public static final String TAG = "NfcActivity";
private static final String DATA_SPLITTER = "__:DATA:__";
private static final String MIME_TYPE = "application/my.applications.mimetype";
...
TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);
String VERSION = tm.getDeviceSoftwareVersion();
...
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter == null)
return;
String text = TAG + DATA_SPLITTER + VERSION;
NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
MIME_TYPE.getBytes(), new byte[0], text.getBytes());
NdefRecord[] records = { record };
NdefMessage msg = new NdefMessage(records);
nfcAdapter.setNdefPushMessage(msg, this);
...
...
dirReader.readEntries(function(results){
...
}, function(error){
$("#myTextArea").val('There was a problem: ' + error);
});
...
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
protected fun doPost(req: HttpServletRequest, res: HttpServletResponse) {
...
val out: PrintWriter = res.getWriter()
try {
...
} catch (e: Exception) {
out.println(e.message)
}
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (e: Exception) {
val exception = Log.getStackTraceString(e)
val intent = Intent()
intent.action = "SEND_EXCEPTION"
intent.putExtra("exception", exception)
view.context.sendBroadcast(intent)
}
...
...
companion object {
const val TAG = "NfcActivity"
private const val DATA_SPLITTER = "__:DATA:__"
private const val MIME_TYPE = "application/my.applications.mimetype"
}
...
val tm = Context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
val VERSION = tm.getDeviceSoftwareVersion();
...
val nfcAdapter = NfcAdapter.getDefaultAdapter(this)
val text: String = "$TAG$DATA_SPLITTER$VERSION"
val record = NdefRecord(NdefRecord.TNF_MIME_MEDIA, MIME_TYPE.getBytes(), ByteArray(0), text.toByteArray())
val records = arrayOf(record)
val msg = NdefMessage(records)
nfcAdapter.setNdefPushMessage(msg, this)
...
NSString *deviceName = [[UIDevice currentDevice] name];
NSString *baseUrl = @"http://myserver.com/?dev=";
NSString *urlString = [baseUrl stringByAppendingString:deviceName];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSError *err = nil;
NSURLResponse* response = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
<?php
...
echo "Server error! Printing the backtrace";
debug_print_backtrace();
...
?>
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。PATH_INFO
和 SCRIPT_NAME
列印至頁面中。
...
HTP.htmlOpen;
HTP.headOpen;
HTP.title ('Environment Information');
HTP.headClose;
HTP.bodyOpen;
HTP.br;
HTP.print('Path Information: ' ||
OWA_UTIL.get_cgi_env('PATH_INFO') || '');
HTP.print('Script Name: ' ||
OWA_UTIL.get_cgi_env('SCRIPT_NAME') || '');
HTP.br;
HTP.bodyClose;
HTP.htmlClose;
...
}
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
import cgi
cgi.print_environ()
...
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
response = Rack::Response.new
...
stacktrace = caller # Kernel#caller returns an array of the execution stack
...
response.finish do |res|
res.write "There was a problem: #{stacktrace}"
end
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
def doSomething() = Action { request =>
...
Ok(Html(Properties.osName)) as HTML
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
let deviceName = UIDevice.currentDevice().name
let urlString : String = "http://myserver.com/?dev=\(deviceName)"
let url : NSURL = NSURL(string:urlString)
let request : NSURLRequest = NSURLRequest(URL:url)
var err : NSError?
var response : NSURLResponse?
var data : NSData = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error:&err)
Response
輸出串流:
...
If Err.number <>0 then
Response.Write "An Error Has Occurred on this page!<BR>"
Response.Write "The Error Number is: " & Err.number & "<BR>"
Response.Write "The Description given is: " & Err.Description & "<BR>"
End If
...
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
<!-- TBD: this needs a security audit -->
<form method="POST" action="recalcOrbit">
...
範例 2:如果 name 參數不是要求的一部分,那麼以下的方法會拋出一個
protected void doPost (HttpServletRequest req,
HttpServletResponse res)
throws IOException {
String ip = req.getRemoteAddr();
InetAddress addr = InetAddress.getByName(ip);
...
out.println("hello " + addr.getHostName());
}
NullPointerException
。
protected void doPost (HttpServletRequest req,
HttpServletResponse res)
throws IOException {
String name = getParameter("name");
...
out.println("hello " + name.trim());
}
...
CALL FUNCTION 'FTP_VERSION'
...
IMPORTING
EXEPATH = p
VERSION = v
WORKING_DIR = dir
RFCPATH = rfcp
RFCVERSION = rfcv
TABLES
FTP_TRACE = FTP_TRACE.
WRITE: 'exepath: ', p, 'version: ', v, 'working_dir: ', dir, 'rfcpath: ', rfcp, 'rfcversion: ', rfcv.
...
try {
...
}
catch(e:Error) {
trace(e.getStackTrace());
}
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
try {
...
} catch (Exception e) {
System.Debug(LoggingLevel.ERROR, e.getMessage());
}
string cs="database=northwind;server=mySQLServer...";
SqlConnection conn=new SqlConnection(cs);
...
Console.Writeline(cs);
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
char* path = getenv("PATH");
...
fprintf(stderr, "cannot find exe on path %s\n", path);
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
EXEC CICS DUMP TRANSACTION
DUMPCODE('name')
FROM (data-area)
LENGTH (data-value)
END-EXEC.
...
<cfscript>
try {
obj = CreateObject("person");
}
catch(any excpt) {
f = FileOpen("c:\log.txt", "write");
FileWriteLine(f, "#excpt.Message#");
FileClose(f);
}
</cfscript>
final file = await File('example.txt').create();
final raf = await file.open(mode: FileMode.write);
final data = String.fromEnvironment("PASSWORD");
raf.writeString(data);
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
path := os.Getenv("PATH")
...
log.Printf("Cannot find exe on path %s\n", path)
Example 1
中,搜索路徑可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws IOException {
...
PrintWriter out = res.getWriter();
try {
...
} catch (Exception e) {
out.println(e.getMessage());
}
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (Exception e) {
String exception = Log.getStackTraceString(e);
Intent i = new Intent();
i.setAction("SEND_EXCEPTION");
i.putExtra("exception", exception);
view.getContext().sendBroadcast(i);
}
...
...
public static final String TAG = "NfcActivity";
private static final String DATA_SPLITTER = "__:DATA:__";
private static final String MIME_TYPE = "application/my.applications.mimetype";
...
TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);
String VERSION = tm.getDeviceSoftwareVersion();
...
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
if (nfcAdapter == null)
return;
String text = TAG + DATA_SPLITTER + VERSION;
NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
MIME_TYPE.getBytes(), new byte[0], text.getBytes());
NdefRecord[] records = { record };
NdefMessage msg = new NdefMessage(records);
nfcAdapter.setNdefPushMessage(msg, this);
...
var http = require('http');
...
http.request(options, function(res){
...
}).on('error', function(e){
console.log('There was a problem with the request: ' + e);
});
...
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
try {
...
} catch (e: Exception) {
e.printStackTrace()
}
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
try {
...
} catch (e: Exception) {
Log.e(TAG, Log.getStackTraceString(e))
}
...
...
NSString* deviceID = [[UIDevice currentDevice] name];
NSLog(@"DeviceID: %@", deviceID);
...
deviceID
項目到使用者預設值清單,並且立即將其儲存至 plist 檔案。
...
NSString* deviceID = [[UIDevice currentDevice] name];
[defaults setObject:deviceID forKey:@"deviceID"];
[defaults synchronize];
...
Example 2
中的程式碼會在裝置上未加保護的 plist 檔案中儲存來自行動裝置的系統資訊。雖然許多開發者信任 plist 檔案是任何及所有資料的安全儲存位置,但不應對其絕對信賴,特別是關係到系統資訊和隱私問題時,因為 plist 檔案可由擁有裝置的任何人讀取。
<?php
...
echo "Server error! Printing the backtrace";
debug_print_backtrace();
...
?>
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
try:
...
except:
print(sys.exc_info()[2])
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
...
begin
log = Logger.new(STDERR)
...
rescue Exception
log.info("Exception: " + $!)
...
end
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。當然,Example 1
中的另一個問題是救援根 Exception
而非特定類型或錯誤/異常,表示它將捕捉到會潛在造成其他不重要負面影響的所有異常。
...
println(Properties.osName)
...
Example 1
中,洩漏的資訊可能會暗示有關作業系統類型、系統上安裝的應用程式,以及管理員在配置程式時所花費的努力等資訊。
let deviceName = UIDevice.currentDevice().name
...
NSLog("Device Identifier: %@", deviceName)
ASPError
物件傳送至指令碼偵錯工具 (如 Microsoft 指令碼偵錯工具):
...
Debug.Write Server.GetLastError()
...
UDID
金鑰會儲存唯一裝置識別碼。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>systemName</key>
<string>John's iPhone</string>
<key>systemInfo</key>
<dict>
<key>UDID</key>
<string>2b6f0cc904d137be2e1730235f5664094b831186</string>
<key>systemVersion</key>
<string>4.2</string>
<key>model</key>
<string>iPhone</string>
<key>localizedModel</key>
<string>iPhone</string>
</dict>
</dict>
</plist>
Example 1
中的程式碼在裝置上未加保護的 plist 檔案中儲存來自行動裝置的私人使用者資訊。雖然許多開發者信任 plist 檔案是任何及所有資料的安全儲存位置,但不應對其絕對信賴,特別是關係到系統資訊和隱私問題時,因為 plist 檔案可由擁有裝置的任何人讀取。EnableSensitiveDataLogging
選項設為 true
,這允許了資料庫命令中使用的應用程式資料包含在記錄和異常訊息中。
...
services.AddDbContext<ApplicationDbContext>(options => {
options.UseSqlServer(_configuration.GetConnectionString("ApplicationDbConnection"));
options.EnableSensitiveDataLogging(true);
});
...
log4j.properties
檔案中的項目會在 info
層級記錄所有查詢。
...
log4j.logger.net.sf.hibernate.type=info
log4j.logger.net.sf.hibernate.tool.hbm2ddl=info
...
usrname
參數。
usrname = request.Item("usrname");
if (session.Item(ATTR_USR) == null) {
session.Add(ATTR_USR, usrname);
}
usrname
參數。
usrname = request.getParameter("usrname");
if (session.getAttribute(ATTR_USR) != null) {
session.setAttribute(ATTR_USR, usrname);
}
var GetURL = function() {};
GetURL.prototype = {
run: function(arguments) {
...
arguments.completionFunction({ "URL": document.location.href });
}
...
};
var ExtensionPreprocessingJS = new GetURL;
usrname
參數。
val usrname: String = request.getParameter("usrname")
if (session.getAttribute(ATTR_USR) != null) {
session.setAttribute(ATTR_USR, usrname)
}
webview
。
#import <MobileCoreServices/MobileCoreServices.h>
- (IBAction)done {
...
[self.extensionContext completeRequestReturningItems:@[untrustedItem] completionHandler:nil];
}
usrname
Cookie,並將其值儲存在 HTTP DB 工作階段中,然後驗證使用者是否已通過驗證。
...
IF (OWA_COOKIE.get('usrname').num_vals != 0) THEN
usrname := OWA_COOKIE.get('usrname').vals(1);
END IF;
IF (v('ATTR_USR') IS null) THEN
HTMLDB_UTIL.set_session_state('ATTR_USR', usrname);
END IF;
...
username
參數。
uname = request.GET['username']
request.session['username'] = uname
webview
。
import MobileCoreServices
@IBAction func done() {
...
self.extensionContext!.completeRequestReturningItems([unstrustedItem], completionHandler: nil)
}
usrname
參數。
...
Dim Response As Response
Dim Request As Request
Dim Session As Session
Dim Application As Application
Dim Server As Server
Dim usrname as Variant
Set Response = objContext("Response")
Set Request = objContext("Request")
Set Session = objContext("Session")
Set Application = objContext("Application")
usrname = Request.Form("usrname")
If IsNull(Session("ATTR_USR")) Then
Session("ATTR_USR") = usrname
End If
...
public
存取方法中回傳 private
陣列變數,因此違反了行動程式碼的安全編碼原則。 public
存取方法中回傳 private
陣列變數,透過此方式,您可以呼叫程式碼修改該陣列的內容,這可以輕易地取得陣列 public
存取權限,並阻止程式設計師將它設為 private
的計畫。 public
存取方法回傳 private
陣列變數。
public final class urlTool extends Applet {
private URL[] urls;
public URL[] getURLs() {
return urls;
}
...
}
public class CustomerServiceApplet extends JApplet
{
public void paint(Graphics g)
{
...
conn = DriverManager.getConnection ("jdbc:mysql://db.example.com/customerDB", "csr", "p4ssw0rd");
...