Skip to content

more login#12

Merged
beackers merged 16 commits intomainfrom
login
Dec 16, 2025
Merged

more login#12
beackers merged 16 commits intomainfrom
login

Conversation

@beackers
Copy link
Owner

@beackers beackers commented Dec 11, 2025

About time I put a proper body on this PR. Edited Dec. 16th I believe 2025.

I think I added some login stuff unintentionally when I was trying to fix that dumb security bug in the nav.js file. WeWell, folks, here's the rest of it. Introducing logins.

The way logins work is,, users are added by an admin, who can set things like your permission level. (If you don't need permissions beyondd bsimple "I just need the board and chat", you actually don't need a password to log in. Just leave the password field blank.)

Note to admins. Added usernames are kind of on an honor system as far as making sure nobody uses that callsign but that person. If you need to, pop over to the control panel, find the offending user in the table, aand deactivate them wby clicking that little checkbox.

Also! If you're the first one into the system, you need to create an admin account before going any further. There's a predefined admin account exactly for this purpose. Log in with the username "BOOTSTRAP_ADMIN" and password (the password is aclose to the top of the Python app.py file, look for "BOOTSTRAP_ADMIN = {" and look at what's in the generate_password_hash parentheses). Everything done with the bootstrap admin is logged, FYI :) And it disappears after the first admin gets created. Hopefully it's secure enough.

Okay, think that's all I got. Whoo that's a long PR body.

for good reason, whoops... imagine someone mistyped their password, so
now the hash don't match, so now they fail login, so now it gets
posted... okay, I get it, CodeQL. Thanks.
@beackers beackers changed the title nopwdlogged more login Dec 11, 2025
next is adding a way to manage logins
next: work on editing / adding / deleting
@beackers beackers marked this pull request as ready for review December 13, 2025 05:00
@beackers
Copy link
Owner Author

Need to clean up assorted logger stuff. Also remember to reset all databases!

New module = cleaner code. Fact.
userfunc is specifically for MyOp's use and handles everything
user-related.
Also: fixed some other bugs.
Removed a lot of log commands.
I don't remember what I did here XD
cur = c.cursor()
if pwd:
pwd = generate_password_hash(pwd)
print(callsign, name, permissions, active, pwd)

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (password)
as clear text.

Copilot Autofix

AI 3 months ago

The best way to fix this problem is to simply remove the print statement at line 78 in userfunc.py, or, if some logging is still desired, print only nonsensitive fields (such as callsign, name, permissions, active) and omit the password entirely. This ensures no password information (cleartext or hash) will ever be logged or printed to any output, preserving user confidentiality and complying with secure coding standards.

Steps:

  • Locate line 78 (print(callsign, name, permissions, active, pwd)) in userfunc.py.
  • Remove this line or, if debugging/logging is still needed, change it so only non-sensitive fields are printed (e.g., print(callsign, name, permissions, active)).

No new imports or definitions are required for this change.

Suggested changeset 1
userfunc.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/userfunc.py b/userfunc.py
--- a/userfunc.py
+++ b/userfunc.py
@@ -75,7 +75,7 @@
         cur = c.cursor()
         if pwd:
             pwd = generate_password_hash(pwd)
-        print(callsign, name, permissions, active, pwd)
+        print(callsign, name, permissions, active)
         cur.execute("""
         INSERT INTO users (callsign, name, permissions, pwdhash, active) VALUES (?,?,?,?,?);
         """,
EOF
@@ -75,7 +75,7 @@
cur = c.cursor()
if pwd:
pwd = generate_password_hash(pwd)
print(callsign, name, permissions, active, pwd)
print(callsign, name, permissions, active)
cur.execute("""
INSERT INTO users (callsign, name, permissions, pwdhash, active) VALUES (?,?,?,?,?);
""",
Copilot is powered by AI and may make mistakes. Always verify output.
- reworked login checking to use userfunc
- cleaned up templates (still had my username in there, embarrasing...)
- fixed bug (active wasn't a property of a userfunc.User)
Had to turn logged_in into a decorator factory to fix Flask complaining
about session["user"] being accessed before a request because Flask
checks decorators like that. Don't remove the parentheses, because then
it turns into a reference to "wrapper", not a function, and every
@logged_in without parentheses gets a reference to "wrapper", and
everything falls apart because everything gets rewritten.
I'm aware the system log is going to show up a little more strangely
online.
But for now the terminal is more important :)
also the login, that commit is coming too
you can log into the site and see your callsign
also added bootstrap admin user for setting up
going to remove the logged_in training wheels in a moment
considering removing admin stuff for non-admins
made some more things rely on stored username now
unnecessary to log in to non-admin accounts
- log pages the bootstrap visits
- make sure after the bootstrap makes a user, bootstrap disappears
- change default password for the bootstrap to "bootstrapbill"
@beackers beackers merged commit 60fa370 into main Dec 16, 2025
2 of 3 checks passed
@beackers beackers deleted the login branch December 16, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant