#525 SCM+OAuth: Clone url: Invalid URL.
Closed: MIGRATED a year ago by nikromen. Opened 5 years ago by vorona.

I can't use a private repository with OAuth token, for example https://123:x-oauth-basic@github.com/team/proj.git for build SCM on own hosted private Copr.

Is it bug or expected behavior?

Can we use custom validator instead of wtforms.validators.URL() ?

from wtforms import StringField, validators
from flask_wtf import Form as FlaskForm
from flask import Flask, request, redirect

class PackageFormScm(FlaskForm):

    clone_url = StringField(
        "Clone url",
        validators=[
            validators.DataRequired(),
            validators.URL()])

app = Flask(__name__)
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False

@app.route('/test', methods = ['POST'])
def test():
  form = PackageFormScm(request.form)
  print(form.validate())
  return redirect('/')

app = app.test_client()
app.post('/test', data=dict(clone_url='https://github.com/team/proj.git'))
app.post('/test', data=dict(clone_url='https://123:x-oauth-basic@github.com/team/proj.git'))

# got:
True
False

Great that you took a look at it. Thanks!

On Thursday, February 7, 2019 4:40:00 PM CET Anatolii Vorona wrote:

I can't use a private repository with OAuth token, for example
https://123:x-oauth-basic@github.com/team/proj.git for build SCM on own
hosted private Copr.

Be careful; the clone url (nor any other package configuration) isn't a
secrete information in copr, so make sure that you don't mind that anybody
will see your token.

On Thursday, February 7, 2019 4:40:00 PM CET Anatolii Vorona wrote:

I can't use a private repository with OAuth token, for example
https://123:x-oauth-basic@github.com/team/proj.git for build SCM on own
hosted private Copr.

Be careful; the clone url (nor any other package configuration) isn't a
secrete information in copr, so make sure that you don't mind that anybody
will see your token.

Thank you, i fully understand this ("own hosted private Copr").

Is it bug or expected behavior?

As long as wtforms maintainers consider to be a bug, yes.

Can we use custom validator instead of wtforms.validators.URL() ?

Why not (at least temporarily) but since our Copr instances aren't affected (it's not advisable to put github token into public database fields in copr), I doubt we'll have a time for this.

Would you mind writing a patch?

Metadata Update from @praiskup:
- Issue tagged with: RFE

5 years ago

Metadata Update from @nikromen:
- Issue close_status updated to: MIGRATED
- Issue status updated to: Closed (was: Open)

a year ago

Login to comment on this ticket.

Metadata