Skip to content

Commit

Permalink
clean up removed console.logs compled audit highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfears committed Nov 7, 2024
1 parent f31e0ad commit 869886d
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 48 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions audits/Cure53 Audit 1/auditHighlights/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Audit Highlights
This are commits that are primarly comments walking through code changes found in audits.
Differences are stored in highlights.txt. These are labeled according to the issues they resolve.
Differences are stored in /auditHighlights These are labeled according to the issues they resolve. They follow a consecutive hash scemea where the difference is based of hash of the previous highlight starting at commit 49d7915666cdc2cd45a7cf8216142a51d1460534.

## Goals
to show interaction pathways and highlight which code resolves which of the following issues
Expand All @@ -19,7 +19,7 @@ highlight hash - 98a91fb2565b73b27f9d382acbfdc99a3c81a66b
highlight hash - 484019c6c966687b93ec610d113bf6cbfc09b692

### KYR-01-006 - clearState default wallet alteration without confirmation
highlight hash -
highlight hash - f31e0ade5fba9e2f15fa938ecbbbd37279f00953

---

Expand Down
17 changes: 1 addition & 16 deletions snap/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export class Auth{
const safty = Buffer.from("__challenge__").toString('hex');
//this is done so an evil server couldn't use this function to sign a valid transaction
const prepaired = Buffer.from(safty+dataHex, 'hex');
console.log("prepaired is");
console.log(prepaired);
return prepaired;
}
async signData(data: string):Promise<string>{
Expand All @@ -56,13 +54,6 @@ export class Auth{
const pk = this.keypair.rawPublicKey().toString('hex');
const addr = this.keypair.publicKey();
const proof = await this.signData(testKey);
console.log("auth object -----------------------------")
console.log('pk')
console.log(pk);
console.log('addr');
console.log(addr);
console.log('proof');
console.log(proof);
return {
pk,
addr,
Expand All @@ -89,11 +80,7 @@ export class Auth{
const auth = await this.getAuthObject(testKey);
console.log("sign on post");
jsonData.auth = auth;
console.log("auth is");
console.log(jsonData.auth);
const outAuth = JSON.stringify(jsonData);
console.log("out auth is");
console.log(outAuth)
const response = await fetch(url,
{
method:'POST',
Expand All @@ -103,11 +90,9 @@ export class Auth{
body: outAuth
}
)
console.log(response);

const output = await response.json();
console.log("json output is");
console.log(output);

return output;
}
}
1 change: 0 additions & 1 deletion snap/TransactionAnalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ async function getAddressInfo(addresses:string[]){
}
const response = await fetch(url+query);
const output = await response.json();
console.log(output);
return output._embedded.records;
}

Expand Down
22 changes: 8 additions & 14 deletions snap/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ export class Wallet{
//this.keyPair = nacl.sign.keyPair.fromSeed(seed);
console.log("seeding");
const seed = account.seed;
console.log(seed);
let bufferSeed = new Uint8Array(32);
for(let i = 0; i<32; i++){
bufferSeed[i] = seed[i];
}
console.log("about to make keyPair");
this.keyPair = Keypair.fromRawEd25519Seed(bufferSeed as Buffer);
console.log(this.keyPair);
//this.address = StrKey.encodeEd25519PublicKey(this.keyPair.publicKey.buffer);
this.address = this.keyPair.publicKey();
//this.publicKey = this.keyPair.publicKey
Expand Down Expand Up @@ -101,7 +99,7 @@ export class Wallet{
else{
salt = "salt "+String(numAccounts+1)
}
console.log("salt is: "+salt);

let tempAccount = await Wallet.getTempAccountFromSalt(salt);
tempAccount.name = name;

Expand Down Expand Up @@ -143,11 +141,10 @@ export class Wallet{
setState = true;
}
let currentState = await StateManager.getState();
console.log("got current state");
console.log(currentState);

let walletAccount:walletAccount;
if(currentState.currentAccount === null){
console.log("current State is null");


let success = await Wallet.createNewAccount('Account 1', currentState, setState);
if(!success){
Expand Down Expand Up @@ -208,8 +205,7 @@ export class Wallet{
const seed = await this.getSeedFromSalt(salt);
let keyPair = Keypair.fromRawEd25519Seed(seed as Buffer);
//this.address = StrKey.encodeEd25519PublicKey(this.keyPair.publicKey.buffer);
console.log("seed is");
console.log(seed);

const address = keyPair.publicKey();
const account:walletAccount = {
address:address,
Expand Down Expand Up @@ -273,20 +269,18 @@ export class Wallet{
if(currentState === undefined){
console.log("currentState is undefined")
currentState = await StateManager.getState();
console.log(currentState);

}
console.log(currentState.accounts);

let output:Array<{"name":string, "address":string}> = []
console.log(currentState.accounts);

for(let account of Object.values(currentState.accounts)){
console.log(account);

output.push({
name:account.name,
address:account.address
})
}
console.log("output is");
console.log(output);
return output;
}

Expand Down
8 changes: 2 additions & 6 deletions snap/WalletFuncs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,17 @@ export class WalletFuncs{
throw new Error("user rejected request");
}
txn.sign(this.keyPair);
console.log(txn);
console.log("xdr is: ");
console.log(txn.toEnvelope().toXDR());
return txn;
}

async signAndSubmitTransaction(xdrTransaction: xdr.Transaction, confirmation?:Boolean){
if(confirmation === undefined){
confirmation = true;
}
console.log("inHere")

const signedTxn = await this.signArbitaryTxn(xdrTransaction, confirmation);
console.log("next");
const response = await this.client.submitTransaction(signedTxn);
console.log("response got");
console.log("submited transaction response is");
console.log(response);
if(response.successful){
await Utils.notify("Transaction Successful")
Expand Down
2 changes: 0 additions & 2 deletions snap/federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ export async function lookupAddress(address:string):Promise<fedResponse>{
return {'error':"not found", 'stellar_address':null, 'account_id':null}
}
const output = await res.json();
console.log("output text is:");
console.log(output);
return output;
}
catch(e){
Expand Down
7 changes: 2 additions & 5 deletions snap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export const onRpcRequest: OnRpcRequestHandler = async ({ origin, request }) =>
*
*/
let dataPacket = await getDataPacket(wallet, client);
console.log(operations);


let interfaceId = await sendXLM(dataPacket, wallet, operations, testnet);
let result = await Utils.openDialog(interfaceId);
Expand All @@ -246,10 +246,7 @@ export const onHomePage: OnHomePageHandler = async () => {

export const onUserInput: OnUserInputHandler = async ({id, event}) => {

console.log(id);
console.log(event);
console.log("interacton table is: ");
console.log(InteractionHandler.interactionTable);

if(event.name){


Expand Down
2 changes: 0 additions & 2 deletions snap/screens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export class Screens{
text("Enter a name for account:"),
copyable(address),
]);
console.log("disp is");
console.log(disp);
return await Utils.displayPanel(disp, "prompt")
}

Expand Down

0 comments on commit 869886d

Please sign in to comment.