* [bitbake-devel][PATCH] bitbake-hashclient: Warn on bad .netrc
@ 2024-03-25 15:56 Joshua Watt
2024-04-13 10:48 ` Paulo Neves
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Watt @ 2024-03-25 15:56 UTC (permalink / raw
To: bitbake-devel; +Cc: Joshua Watt
If there is an error parsing .netrc, warn the user on stderr
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
bitbake/bin/bitbake-hashclient | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient
index 47dd27cd3c2..610787ed2b0 100755
--- a/bitbake/bin/bitbake-hashclient
+++ b/bitbake/bin/bitbake-hashclient
@@ -346,6 +346,8 @@ def main():
login, _, password = auth
except FileNotFoundError:
pass
+ except netrc.NetrcParseError as e:
+ sys.stderr.write(f"Error parsing {e.filename}:{e.lineno}: {e.msg}\n")
func = getattr(args, 'func', None)
if func:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [bitbake-devel][PATCH] bitbake-hashclient: Warn on bad .netrc
2024-03-25 15:56 [bitbake-devel][PATCH] bitbake-hashclient: Warn on bad .netrc Joshua Watt
@ 2024-04-13 10:48 ` Paulo Neves
0 siblings, 0 replies; 2+ messages in thread
From: Paulo Neves @ 2024-04-13 10:48 UTC (permalink / raw
To: Joshua Watt, bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]
What about wget.py@370?
except (FileNotFoundError, netrc.NetrcParseError):
pass
Locally i added a the diagnostic as well because python added a permission check that will make bitbake silently
skip netrc authentication on a not obvious parsing errors. From the docs[1]:
> Parse errors will raise
[NetrcParseError](https://docs.python.org/3/library/netrc.html#netrc.NetrcParseError)
with diagnostic
> information including the file name, line number, and terminating token.
> If no argument is specified on a POSIX system, the presence of passwords in
> the
.netrc
file will raise a
[NetrcParseError](https://docs.python.org/3/library/netrc.html#netrc.NetrcParseError)
if the file
> ownership or permissions are insecure (owned by a user other than the user
> running the process, or accessible for read or write by any other user).
> This implements security behavior equivalent to that of ftp and other
> programs that use
.netrc
.
Paulo Neves
[1]
https://docs.python.org/3/library/netrc.html#netrc.netrc
On 3/25/24 16:56, Joshua Watt wrote:
> If there is an error parsing .netrc, warn the user on stderr
>
> Signed-off-by: Joshua Watt
> [<JPEWhacker@gmail.com>](mailto:JPEWhacker@gmail.com)
> ---
> bitbake/bin/bitbake-hashclient | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient
> index 47dd27cd3c2..610787ed2b0 100755
> --- a/bitbake/bin/bitbake-hashclient
> +++ b/bitbake/bin/bitbake-hashclient
> @@ -346,6 +346,8 @@ def main():
> login, _, password = auth
> except FileNotFoundError:
> pass
> + except netrc.NetrcParseError as e:
> + sys.stderr.write(f"Error parsing {e.filename}:{e.lineno}: {e.msg}\n")
>
> func = getattr(args, 'func', None)
> if func:
> --
> 2.34.1
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16013):
> https://lists.openembedded.org/g/bitbake-devel/message/16013
> Mute This Topic:
> https://lists.openembedded.org/mt/105140768/4454782
> Group Owner:
> bitbake-devel+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/bitbake-devel/unsub
> [
> paulo@myneves.com
> ]
> -=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 3839 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-13 10:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 15:56 [bitbake-devel][PATCH] bitbake-hashclient: Warn on bad .netrc Joshua Watt
2024-04-13 10:48 ` Paulo Neves
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.