Re: [go-nuts] Re: Golang Github Package References

2022-12-05 Thread Mucas Schlack
Ok,
The package code in question looks like this: -

import (
"context"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/http/httputil"
"net/url"
"os"
"time"
"github.com/go-oauth2/oauth2/v4/generates"
"github.com/go-oauth2/oauth2/v4/errors"
"github.com/go-oauth2/oauth2/v4/manage"
"github.com/go-oauth2/oauth2/v4/models"
"github.com/go-oauth2/oauth2/v4/server"
"github.com/go-oauth2/oauth2/v4/store"
"github.com/go-session/session"
) The problem as I see it, is that when the security of the code relies on
a package is outside the main program/executable, it can open potential
problems of code injection; code changes or forks or if the url has moved,
how these issues could cause the collapse of the integrity of the software.
Snot-bag

Am Mo., 5. Dez. 2022 um 13:05 Uhr schrieb Robert Engels <
reng...@ix.netcom.com>:

> The op is trying to say, they wrote the code using github.com/robaho/fixed
> but then they decide they want to use a fork of fixed (maybe it is being
> maintained better, performance enhancements, etc) but they don’t want to
> change all of their code.
>
> Can they use a replace directive to point at the fork?
>
> I’m uncertain - because the package references in the fork would all need
> to change ? (unless it used relative references which are discouraged).
>
> I think that is the problem.
>
> On Dec 5, 2022, at 5:36 AM, Brian Candler  wrote:
>
> This question makes no sense to me.  If your code actually *uses* "
> github.com/installed-package" then it will fail to build or run without
> it.  On the other hand, if it doesn't use it, then just remove the import
> (the compiler will complain about unused imports anyway)
>
> I also don't know what you mean by "keep referencing" (you only need to
> import it once in a given source file), nor the "security reasons" you
> mention.
>
> Can you be more specific about what exactly you're trying to do?  Can you
> point to the real code in question?
>
> On Monday, 5 December 2022 at 10:46:17 UTC loji...@gmail.com wrote:
>
>> Hello Everyone,
>> I would like to install a Golang Github package, but I do not want to
>> keep referencing the installed package in the "imports" section of the code
>> - for security reasons, and because I want my code to be able to run
>> without those references. Does anyone know if there is a way to do this?
>>
>> For example:
>>
>> import (
>> "log"
>> "net/http"
>> "github.com/installed-package?"
>> )
>>
>> So, how can I remove the "github.com/installed-package"  reference above
>> and still be able to run the package?
>>
>> Regards,
>>
>> Snot-Bag
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/1a747ce2-8cbc-496d-a3bb-65211315e024n%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/JqHFwcFQDdI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/3F50C814-566E-4C72-B836-D669130FFE8D%40ix.netcom.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA8AC4UYo4hZ3-4KTGtoKkGsxu9VtZUBxaFjAwEYH9U8pdU7zg%40mail.gmail.com.


[go-nuts] Golang Github Package References

2022-12-05 Thread Mucas Schlack
Hello Everyone,
I would like to install a Golang Github package, but I do not want to keep 
referencing the installed package in the "imports" section of the code - 
for security reasons, and because I want my code to be able to run without 
those references. Does anyone know if there is a way to do this?

For example: 

import (
"log"
"net/http"
"github.com/installed-package?"
)

So, how can I remove the "github.com/installed-package"  reference above 
and still be able to run the package?

Regards,

Snot-Bag

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1ec2ea3f-efbd-431d-9654-0879079770edn%40googlegroups.com.


[go-nuts] Problems with array slicing reliability?

2022-11-23 Thread Mucas Schlack
Hello Golangers!
Is there anyone who can test the reliability of the following Golang slice 
feature? I am using an AMG64 computer with Windows 10, and Go version 
0.36.0. When I use the following code, to detect and then replace a 
character at any given length *n* (9) in a string with an Uppercase 
Character. Strangely and somehow, the slice pointer will move to another 
position even though the code is not dynamic and has not changed. Is there 
anyone who can trouble shoot this code for me?

Please remember that this is "*test*" code only, so some of it will not 
make any sense or work. It is only "proof of concept" code.

The code to pay attention to is the following - from lines: 80 - 92!

Many thanks for any help you can give!

Mucas

Example code:

package main

import(
//"unicode/utf8"
"math/rand"
"strconv"
"strings"
"fmt"
"time"
"os"
)

var alphanumerics = [62] string {

"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9",

"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
}

func main(){

var (
txtflpth string = "C:\\Workspace\\Transaction Hash.txt"
flNm string = "Transaction Hash.txt"
CRLF string = "\n"
cntstrt string
AuthKey string
NwStr string
cstart int
cntr int
flEx *os.FileInfo
flEx2 *os.File
trfl *os.File
err error
) 

fmt.Print("State where the hash counter should begin:>> ")
fmt.Scanln(&cntstrt)

if cntstrt == "" || cntstrt == " " { 
trfl, err = os.Create(flNm)

if err != nil { panic(err); os.Exit(-1) }
defer trfl.Close() 

} else {
var flEx, err = os.Stat(txtflpth)

fmt.Println(flEx.Mode().String)
//fmt.Println(flEx.IsRegular())
fmt.Println(flEx.IsDir())
fmt.Println(flEx.Name())
fmt.Println(flEx.Size())
fmt.Println(flEx.Sys())

if err != nil { if os.IsNotExist(err) { panic(err) } }

cstart, err = strconv.Atoi(cntstrt)
flEx2, err := os.Open(txtflpth)
defer flEx2.Close() 
}

/*defer func(
if err == trfl.Close() || err == os.IsNotExist(err)!= err { 
panic(err) }
if err == flEx.Close() || err == os.IsNotExist(err)!= err { 
panic(err) }
)*/

if cntstrt != "" && cntstrt != " " { cntr = cstart }

for cntr = cstart; cntr < cstart + 1000; cntr++ {
NwStr = ""
AuthKey = NwStr

for i := 0; i <= 65; i++ {
time.Sleep(10 * time.Nanosecond)
rand.Seed(time.Now().UnixNano()) 
AuthKey = AuthKey + alphanumerics[rand.Intn(62)] //, [A - Z], 
[0-9])
}

var hashRemap = [...] string {"A","U","G","D","E","X"}

AuthKey = "0x" + AuthKey
fmt.Println("Transaction Hash: " + strconv.Itoa(cntr) + ") " + 
AuthKey)
//AuthKey2 := []rune(AuthKey)

StrPos := strings.Index(AuthKey, AuthKey[9:10])
fmt.Printf("The old character %s is at string position: (%d) " + 
CRLF,AuthKey[9:10], StrPos)
//os.Exit(1)

for i := 0; i < 6; i++ {
switch i {
case 0: AuthKey = strings.Replace(AuthKey,AuthKey[9:10], 
hashRemap[0], 1); fmt.Println("Replaced! The New Transaction Hash: " + "(" 
+ strconv.Itoa(i) + ") " + AuthKey); os.Exit(1);
case 1: AuthKey = strings.Replace(AuthKey,"", hashRemap[1], 
1)
case 2: AuthKey = strings.Replace(AuthKey,"", hashRemap[3], 
1) 
case 3: AuthKey = strings.Replace(AuthKey,"", hashRemap[4], 
1)
case 4: AuthKey = strings.Replace(AuthKey,"", hashRemap[5], 
1)
case 5: AuthKey = strings.Replace(AuthKey,"", hashRemap[5], 
1)
}

}

fmt.Println("Transaction Hash: " + strconv.Itoa(cntr) + ") " + 
AuthKey)
if trfl != nil { trfl.WriteString("Transaction Hash: " + 
strconv.Itoa(cntr) + ") " + AuthKey + CRLF) }
if flEx != nil { flEx2.WriteString("Transaction Hash: " + 
strconv.Itoa(cntr) + ") " + AuthKey + CRLF) }

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f27c55aa-836a-453e-a013-a7b752de273bn%40googlegroups.com.